From 0e026389e39cfa438c7a330dcbb89084d78ef13d Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 24 Jul 2018 23:30:29 +0200 Subject: [PATCH 1/8] add tslint config for test folder --- tslint.test.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tslint.test.json diff --git a/tslint.test.json b/tslint.test.json new file mode 100644 index 0000000..7b38a0d --- /dev/null +++ b/tslint.test.json @@ -0,0 +1,10 @@ +{ + "extends": [ + "./tslint.json" + ], + "rules": { + "no-implicit-dependencies": false, + "no-reference": false, + "no-submodule-imports": false + } +} From c73cb188adfab288978516ca730b6493f45e8451 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 24 Jul 2018 23:31:10 +0200 Subject: [PATCH 2/8] update tslint rules --- tslint.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tslint.json b/tslint.json index eb89414..852186d 100644 --- a/tslint.json +++ b/tslint.json @@ -40,7 +40,7 @@ "no-construct": true, "no-debugger": true, "no-duplicate-variable": true, - "no-empty": true, + "no-empty": false, "no-eval": true, "no-inferrable-types": false, "no-shadowed-variable": true, @@ -49,7 +49,6 @@ "no-this-assignment": false, "no-unused-expression": true, "no-unused-variable": true, - "no-unreachable": true, "no-use-before-declare": true, "no-var-keyword": true, "object-literal-sort-keys": true, From b804f4ca84b8b5607ffc615019eeb3f525522181 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 24 Jul 2018 23:31:52 +0200 Subject: [PATCH 3/8] use tslint.test.json config on visual studio code --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4244981..1c7e639 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ // Place your settings in this file to overwrite default and user settings. { - "typescript.tsdk": "node_modules/typescript/lib" + "typescript.tsdk": "node_modules/typescript/lib", + "tslint.configFile": "tslint.test.json" } From 7b14ca2a72fdf2ae5fae45e0fa61be22e2de0764 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 24 Jul 2018 23:32:07 +0200 Subject: [PATCH 4/8] add tslint scripts --- package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7584c6d..cf3ed2d 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,17 @@ "test": "karma start --single-run", "mocha": "mocha test/**/*.test.ts --require ts-node/register", "autoformat": "prettier --config .prettierrc --write {src,test}/**/*.ts", - "tslint-check": "tslint-config-prettier-check ./tslint.json", + "tslint-check:src": "tslint-config-prettier-check ./tslint.json", + "tslint-check:test": "tslint-config-prettier-check ./tslint.test.json", + "tslint:src": "tslint --project tsconfig.json", + "tslint:test": "tslint --config tslint.test.json --project tsconfig.test.json", + "tslint": "npm run tslint-check:src && npm run tslint-check:test && npm run tslint:src && npm run tslint:test", "clean-up": "rimraf .nyc_output && rimraf coverage && rimraf lib && rimraf dev", "compile:src": "tsc -d", "compile:test": "tsc -p tsconfig.test.json -d", "prepare": "npm run clean-up && npm run compile:src", "prepublishOnly": "publish-please guard", - "publish-please": "npm run autoformat && npm run clean-up && npm run test && publish-please" + "publish-please": "npm run tslint && npm run autoformat && npm run clean-up && npm run test && publish-please" }, "repository": { "type": "git", From 73d0d87eaad5e89b6a8a63d38e62a4e9e8b6643d Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 24 Jul 2018 23:32:16 +0200 Subject: [PATCH 5/8] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d364f17..426c759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ - Update TypeScript Compiler Options (see #38). +- Enforce TSLint rules (see #39). + - Update dev dependencies to latest version. ### [v0.0.5](https://github.com/RobotlegsJS/RobotlegsJS-Phaser-SignalCommandMap/releases/tag/0.0.5) - 2017-09-26 From 68da4a7fdeaa89b11fdb472e3aaee5040e1091dc Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 24 Jul 2018 23:33:56 +0200 Subject: [PATCH 6/8] update tslint rules --- tslint.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tslint.json b/tslint.json index 852186d..cd72ff2 100644 --- a/tslint.json +++ b/tslint.json @@ -48,7 +48,6 @@ "no-switch-case-fall-through": false, "no-this-assignment": false, "no-unused-expression": true, - "no-unused-variable": true, "no-use-before-declare": true, "no-var-keyword": true, "object-literal-sort-keys": true, From 1dcafff41b5f9b856b05e2873d48acc10a187cf7 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 24 Jul 2018 23:37:10 +0200 Subject: [PATCH 7/8] ignore tslint.test.json when publishing package to NPM --- .npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmignore b/.npmignore index a9ccd0c..0996658 100644 --- a/.npmignore +++ b/.npmignore @@ -20,6 +20,7 @@ tsconfig.json tsconfig.test.json tsfmt.json tslint.json +tslint.test.json typings.json webpack.config.js yarn.lock From 25287a6cb42132a13d2de644019b3da075e41c43 Mon Sep 17 00:00:00 2001 From: Tiago Schenkel Date: Tue, 24 Jul 2018 23:40:12 +0200 Subject: [PATCH 8/8] update tslint rules --- tslint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tslint.json b/tslint.json index cd72ff2..b022fe0 100644 --- a/tslint.json +++ b/tslint.json @@ -40,7 +40,7 @@ "no-construct": true, "no-debugger": true, "no-duplicate-variable": true, - "no-empty": false, + "no-empty": true, "no-eval": true, "no-inferrable-types": false, "no-shadowed-variable": true,