diff --git a/.eslintrc.json b/.eslintrc.json index 128607493da..4324d33702d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,8 +3,7 @@ "parserOptions": { "warnOnUnsupportedTypeScriptVersion": false, "ecmaVersion": 6, - "sourceType": "module", - "project": "./tsconfig.eslint.json" + "sourceType": "module" }, "env": { "browser": false, @@ -25,8 +24,6 @@ "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-misused-new": "error", "@typescript-eslint/no-this-alias": "error", - "@typescript-eslint/no-unnecessary-qualifier": "error", - "@typescript-eslint/no-unnecessary-type-assertion": "error", "@typescript-eslint/prefer-for-of": "error", "@typescript-eslint/prefer-function-type": "error", "@typescript-eslint/prefer-namespace-keyword": "error", @@ -80,8 +77,9 @@ "no-return-await": "error", "no-restricted-globals": ["error", { "name": "setTimeout" }, - { "name": "setInterval" }, { "name": "clearTimeout" }, + { "name": "setInterval" }, + { "name": "clearInterval" }, { "name": "setImmediate" }, { "name": "clearImmediate" } ], @@ -102,24 +100,5 @@ "space-in-parens": "error", "unicode-bom": ["error", "never"], "use-isnan": "error" - }, - "overrides": [{ - "files": ["src/lib/*.d.ts"], - "rules": { - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/prefer-function-type": "off", - "@typescript-eslint/unified-signatures": "off", - - // scripts/eslint/rules - "no-keywords": "off", - - // eslint - "no-var": "off" - } - }, { - "files": ["src/lib/es2019.array.d.ts"], - "rules": { - "@typescript-eslint/array-type": "off" - } - }] + } } diff --git a/.vscode/settings.json b/.vscode/settings.json index 294364106e6..4f481751900 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,13 @@ { "eslint.validate": [ - "javascript", { "language": "typescript", "autoFix": true } ], "eslint.options": { - "rulePaths": ["./scripts/eslint/built/rules/"], - } + "rulePaths": ["../scripts/eslint/built/rules/"], + "ext": [".ts"] + }, + "eslint.workingDirectories": ["./src", "./scripts"] } \ No newline at end of file diff --git a/Gulpfile.js b/Gulpfile.js index e2e972a0a45..3828dc5b050 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -333,13 +333,14 @@ task("run-eslint-rules-tests").description = "Runs the eslint rule tests"; const lintFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("lint")); }; const lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); }; -const eslint = (path) => async () => { +const eslint = (folder) => async () => { const args = [ "node_modules/eslint/bin/eslint", + "--config", `${ folder }/.eslintrc.json`, "--format", "autolinkable-stylish", "--rulesdir", "scripts/eslint/built/rules", "--ext", ".ts", - `${ path }`, + `${ folder }`, ]; if (cmdLineOptions.fix) { diff --git a/package.json b/package.json index c5bc46360ec..719f85b351a 100644 --- a/package.json +++ b/package.json @@ -55,9 +55,9 @@ "@types/through2": "latest", "@types/travis-fold": "latest", "@types/xml2js": "^0.4.0", - "@typescript-eslint/eslint-plugin": "2.0.0-alpha.4", - "@typescript-eslint/experimental-utils": "2.0.0-alpha.4", - "@typescript-eslint/parser": "2.0.0-alpha.4", + "@typescript-eslint/eslint-plugin": "2.0.0", + "@typescript-eslint/experimental-utils": "2.0.0", + "@typescript-eslint/parser": "2.0.0", "async": "latest", "azure-devops-node-api": "^8.0.0", "browser-resolve": "^1.11.2", @@ -67,7 +67,7 @@ "convert-source-map": "latest", "del": "latest", "eslint": "6.1.0", - "eslint-formatter-autolinkable-stylish": "1.0.0", + "eslint-formatter-autolinkable-stylish": "1.0.1", "eslint-plugin-import": "2.18.2", "eslint-plugin-jsdoc": "15.7.2", "eslint-plugin-no-null": "1.0.2", diff --git a/scripts/.eslintrc.json b/scripts/.eslintrc.json new file mode 100644 index 00000000000..f86ba9ecb6a --- /dev/null +++ b/scripts/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "extends": "../.eslintrc.json", + "parserOptions": { + "tsconfigRootDir": "scripts", + "project": [ + "./importDefinitelyTypedTests/tsconfig.json", + "./eslint/tsconfig.json", + "./tsconfig.json" + ] + } +} diff --git a/scripts/eslint/tsconfig.json b/scripts/eslint/tsconfig.json index 6ddaa3e12f8..5d015028f71 100644 --- a/scripts/eslint/tsconfig.json +++ b/scripts/eslint/tsconfig.json @@ -22,11 +22,10 @@ "include": [ "rules", - "tests", - "tests/support/*.json" + "tests" ], "exclude": [ - "tests/fixtures" + "fixtures" ] } diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index ed805def651..607386a299c 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,24 +1,27 @@ { "compilerOptions": { + "strictNullChecks": true, "removeComments": false, - "target": "es6", - "module": "commonjs", "declaration": false, "sourceMap": true, - "lib": [ - "es6", - "scripthost" - ], - "strictNullChecks": true, "newLine": "lf", - "types": ["node"] + "target": "es6", + "module": "commonjs", + "types": ["node"], + "lib": ["es6", "scripthost"], }, - "files": [ - "produceLKG.ts", - "buildProtocol.ts", - "processDiagnosticMessages.ts", + + "includes": [ "generateLocalizedDiagnosticMessages.ts", + "processDiagnosticMessages.ts", "configurePrerelease.ts", + "failed-tests.d.ts", + "buildProtocol.ts", + "produceLKG.ts", "word2md.ts" + ], + + "exclude": [ + "ambient.d.ts" ] } diff --git a/src/.eslintrc.json b/src/.eslintrc.json new file mode 100644 index 00000000000..73687932e2f --- /dev/null +++ b/src/.eslintrc.json @@ -0,0 +1,29 @@ +{ + "extends": "../.eslintrc.json", + "parserOptions": { + "tsconfigRootDir": "src", + "project": "./tsconfig-base.json" + }, + "overrides": [ + { + "files": ["lib/*.d.ts"], + "rules": { + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/prefer-function-type": "off", + "@typescript-eslint/unified-signatures": "off", + + // scripts/eslint/rules + "no-keywords": "off", + + // eslint + "no-var": "off" + } + }, + { + "files": ["lib/es2019.array.d.ts"], + "rules": { + "@typescript-eslint/array-type": "off" + } + } + ] +} diff --git a/src/watchGuard/watchGuard.ts b/src/watchGuard/watchGuard.ts index 8ec248ebb87..3835540d9c9 100644 --- a/src/watchGuard/watchGuard.ts +++ b/src/watchGuard/watchGuard.ts @@ -15,4 +15,4 @@ try { watcher.close(); } catch { /*ignore*/ } -process.exit(0); \ No newline at end of file +process.exit(0); diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json deleted file mode 100644 index 4cfd6ea1ab2..00000000000 --- a/tsconfig.eslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./src/tsconfig-base.json", - "include": [ - "src/**/*", - "scripts/**/*" - ] -}