From 9a23924d55367a3de89368f187318954fe40c439 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:11:56 -0700 Subject: [PATCH] Switch to eslint flat config (#57684) --- .eslint-plugin-local.cjs | 12 -- .eslintrc.json | 177 ---------------------------- eslint.config.mjs | 244 +++++++++++++++++++++++++++++++++++++++ package-lock.json | 102 +++++++--------- package.json | 6 +- src/.eslintrc.json | 49 -------- 6 files changed, 287 insertions(+), 303 deletions(-) delete mode 100644 .eslint-plugin-local.cjs delete mode 100644 .eslintrc.json create mode 100644 eslint.config.mjs delete mode 100644 src/.eslintrc.json diff --git a/.eslint-plugin-local.cjs b/.eslint-plugin-local.cjs deleted file mode 100644 index c950681b24c..00000000000 --- a/.eslint-plugin-local.cjs +++ /dev/null @@ -1,12 +0,0 @@ -const fs = require("fs"); -const path = require("path"); - -const rulesDir = path.join(__dirname, "scripts", "eslint", "rules"); -const ext = ".cjs"; -const ruleFiles = fs.readdirSync(rulesDir).filter(p => p.endsWith(ext)); - -module.exports = { - rules: Object.fromEntries(ruleFiles.map(p => { - return [p.slice(0, -ext.length), require(path.join(rulesDir, p))]; - })), -}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 1c2de33bec6..00000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "warnOnUnsupportedTypeScriptVersion": false, - "sourceType": "module" - }, - "env": { - "browser": false, - "node": true, - "es6": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/stylistic" - ], - "plugins": [ - "@typescript-eslint", - "eslint-plugin-local" - ], - "ignorePatterns": [ - "**/node_modules/**", - "/built/**", - "/tests/**", - "/lib/**", - "/src/lib/*.generated.d.ts", - "/scripts/**/*.js", - "/scripts/**/*.d.*", - "/internal/**", - "/coverage/**" - ], - "rules": { - // eslint - "dot-notation": "error", - "eqeqeq": "error", - "no-caller": "error", - "no-constant-condition": ["error", { "checkLoops": false }], - "no-eval": "error", - "no-extra-bind": "error", - "no-new-func": "error", - "no-new-wrappers": "error", - "no-return-await": "error", - "no-restricted-globals": [ - "error", - { "name": "setTimeout" }, - { "name": "clearTimeout" }, - { "name": "setInterval" }, - { "name": "clearInterval" }, - { "name": "setImmediate" }, - { "name": "clearImmediate" } - ], - "no-template-curly-in-string": "error", - "no-throw-literal": "error", - "no-undef-init": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-const": "error", - "prefer-object-spread": "error", - "unicode-bom": ["error", "never"], - - "no-restricted-syntax": [ - "error", - { - "selector": "Literal[raw=null]", - "message": "Avoid using null; use undefined instead." - }, - { - "selector": "TSNullKeyword", - "message": "Avoid using null; use undefined instead." - } - ], - - // Enabled in eslint:recommended, but not applicable here - "no-extra-boolean-cast": "off", - "no-case-declarations": "off", - "no-cond-assign": "off", - "no-control-regex": "off", - "no-inner-declarations": "off", - - // @typescript-eslint/eslint-plugin - "@typescript-eslint/naming-convention": [ - "error", - { "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } }, - { "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false }, "filter": { "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", "match": false } }, - { "selector": "variable", "format": ["camelCase", "PascalCase", "UPPER_CASE"], "leadingUnderscore": "allow", "filter": { "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", "match": false } }, - { "selector": "function", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } }, - { "selector": "parameter", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false } }, - { "selector": "method", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false } }, - { "selector": "memberLike", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false } }, - { "selector": "enumMember", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } }, - { "selector": "property", "format": null } - ], - - "@typescript-eslint/unified-signatures": "error", - "no-unused-expressions": "off", - "@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }], - - // Rules enabled in typescript-eslint configs that are not applicable here - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/class-literal-property-style": "off", - "@typescript-eslint/consistent-indexed-object-style": "off", - "@typescript-eslint/no-duplicate-enum-values": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-non-null-asserted-optional-chain": "off", - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/ban-types": [ - "error", - { - "extendDefaults": true, - "types": { - // This is theoretically good, but ts-eslint appears to mistake our declaration of Symbol for the global Symbol type. - // See: https://github.com/typescript-eslint/typescript-eslint/issues/7306 - "Symbol": false, - "{}": false // {} is a totally useful and valid type. - } - } - ], - "@typescript-eslint/no-unused-vars": [ - "warn", - { - // Ignore: (solely underscores | starting with exactly one underscore) - "argsIgnorePattern": "^(_+$|_[^_])", - "varsIgnorePattern": "^(_+$|_[^_])" - } - ], - "@typescript-eslint/no-inferrable-types": "off", - - // Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820 - "@typescript-eslint/prefer-optional-chain": "off", - - // scripts/eslint/rules - "local/only-arrow-functions": [ - "error", - { - "allowNamedFunctions": true, - "allowDeclarations": true - } - ], - "local/argument-trivia": "error", - "local/no-in-operator": "error", - "local/debug-assert": "error", - "local/no-keywords": "error", - "local/jsdoc-format": "error", - "local/js-extensions": "error" - }, - "overrides": [ - // By default, the ESLint CLI only looks at .js files. But, it will also look at - // any files which are referenced in an override config. Most users of typescript-eslint - // get this behavior by default by extending a recommended typescript-eslint config, which - // just so happens to override some core ESLint rules. We don't extend from any config, so - // explicitly reference TS files here so the CLI picks them up. - // - // ESLint in VS Code will lint any opened file (so long as it's not eslintignore'd), so - // that will work regardless of the below. - // - // The same applies to mjs files; ESLint appears to not scan those either. - { "files": ["*.ts", "*.mts", "*.cts", "*.mjs", "*.cjs"] }, - { - "files": ["*.mjs", "*.mts"], - "rules": { - // These globals don't exist outside of CJS files. - "no-restricted-globals": [ - "error", - { "name": "__filename" }, - { "name": "__dirname" }, - { "name": "require" }, - { "name": "module" }, - { "name": "exports" } - ] - } - } - ] -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000000..34126cd0ee2 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,244 @@ +// @ts-check +import eslint from "@eslint/js"; +import fs from "fs"; +import globals from "globals"; +import { createRequire } from "module"; +import path from "path"; +import tseslint from "typescript-eslint"; +import url from "url"; + +const __filename = url.fileURLToPath(new URL(import.meta.url)); +const __dirname = path.dirname(__filename); + +const require = createRequire(import.meta.url); + +const rulesDir = path.join(__dirname, "scripts", "eslint", "rules"); +const ext = ".cjs"; +const ruleFiles = fs.readdirSync(rulesDir).filter(p => p.endsWith(ext)); + +export default tseslint.config( + { + files: ["**/*.{ts,tsx,cts,mts,js,cjs,mjs}"], + }, + { + ignores: [ + "**/node_modules/**", + "built/**", + "tests/**", + "lib/**", + "src/lib/*.generated.d.ts", + "scripts/**/*.js", + "scripts/**/*.d.*", + "internal/**", + "coverage/**", + ], + }, + eslint.configs.recommended, + ...tseslint.configs.recommended, + ...tseslint.configs.stylistic, + { + plugins: { + local: { + rules: Object.fromEntries(ruleFiles.map(p => { + return [p.slice(0, -ext.length), require(path.join(rulesDir, p))]; + })), + }, + }, + }, + { + languageOptions: { + parserOptions: { + warnOnUnsupportedTypeScriptVersion: false, + }, + globals: globals.node, + }, + }, + { + rules: { + // eslint + "dot-notation": "error", + "eqeqeq": "error", + "no-caller": "error", + "no-constant-condition": ["error", { checkLoops: false }], + "no-eval": "error", + "no-extra-bind": "error", + "no-new-func": "error", + "no-new-wrappers": "error", + "no-return-await": "error", + "no-template-curly-in-string": "error", + "no-throw-literal": "error", + "no-undef-init": "error", + "no-var": "error", + "object-shorthand": "error", + "prefer-const": "error", + "prefer-object-spread": "error", + "unicode-bom": ["error", "never"], + + "no-restricted-syntax": [ + "error", + { + selector: "Literal[raw=null]", + message: "Avoid using null; use undefined instead.", + }, + { + selector: "TSNullKeyword", + message: "Avoid using null; use undefined instead.", + }, + ], + + // Enabled in eslint:recommended, but not applicable here + "no-extra-boolean-cast": "off", + "no-case-declarations": "off", + "no-cond-assign": "off", + "no-control-regex": "off", + "no-inner-declarations": "off", + + // @typescript-eslint/eslint-plugin + "@typescript-eslint/naming-convention": [ + "error", + { selector: "typeLike", format: ["PascalCase"], filter: { regex: "^(__String|[A-Za-z]+_[A-Za-z]+)$", match: false } }, + { selector: "interface", format: ["PascalCase"], custom: { regex: "^I[A-Z]", match: false }, filter: { regex: "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", match: false } }, + { selector: "variable", format: ["camelCase", "PascalCase", "UPPER_CASE"], leadingUnderscore: "allow", filter: { regex: "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", match: false } }, + { selector: "function", format: ["camelCase", "PascalCase"], leadingUnderscore: "allow", filter: { regex: "^[A-Za-z]+_[A-Za-z]+$", match: false } }, + { selector: "parameter", format: ["camelCase"], leadingUnderscore: "allow", filter: { regex: "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", match: false } }, + { selector: "method", format: ["camelCase", "PascalCase"], leadingUnderscore: "allow", filter: { regex: "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", match: false } }, + { selector: "memberLike", format: ["camelCase"], leadingUnderscore: "allow", filter: { regex: "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", match: false } }, + { selector: "enumMember", format: ["camelCase", "PascalCase"], leadingUnderscore: "allow", filter: { regex: "^[A-Za-z]+_[A-Za-z]+$", match: false } }, + // eslint-disable-next-line no-restricted-syntax + { selector: "property", format: null }, + ], + + "@typescript-eslint/unified-signatures": "error", + "no-unused-expressions": "off", + "@typescript-eslint/no-unused-expressions": ["error", { allowTernary: true }], + + // Rules enabled in typescript-eslint configs that are not applicable here + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/class-literal-property-style": "off", + "@typescript-eslint/consistent-indexed-object-style": "off", + "@typescript-eslint/no-duplicate-enum-values": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/no-non-null-asserted-optional-chain": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/ban-types": [ + "error", + { + extendDefaults: true, + types: { + // This is theoretically good, but ts-eslint appears to mistake our declaration of Symbol for the global Symbol type. + // See: https://github.com/typescript-eslint/typescript-eslint/issues/7306 + "Symbol": false, + "{}": false, // {} is a totally useful and valid type. + }, + }, + ], + "@typescript-eslint/no-unused-vars": [ + "warn", + { + // Ignore: (solely underscores | starting with exactly one underscore) + argsIgnorePattern: "^(_+$|_[^_])", + varsIgnorePattern: "^(_+$|_[^_])", + }, + ], + "@typescript-eslint/no-inferrable-types": "off", + + // Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820 + "@typescript-eslint/prefer-optional-chain": "off", + + // scripts/eslint/rules + "local/only-arrow-functions": [ + "error", + { + allowNamedFunctions: true, + allowDeclarations: true, + }, + ], + "local/argument-trivia": "error", + "local/no-in-operator": "error", + "local/debug-assert": "error", + "local/no-keywords": "error", + "local/jsdoc-format": "error", + "local/js-extensions": "error", + }, + }, + { + files: ["**/*.mjs", "**/*.mts"], + rules: { + // These globals don't exist outside of CJS files. + "no-restricted-globals": [ + "error", + { name: "__filename" }, + { name: "__dirname" }, + { name: "require" }, + { name: "module" }, + { name: "exports" }, + ], + }, + }, + { + files: ["src/**"], + languageOptions: { + parserOptions: { + tsconfigRootDir: __dirname, + project: "./src/tsconfig-eslint.json", + }, + }, + }, + { + files: ["src/**"], + rules: { + "@typescript-eslint/no-unnecessary-type-assertion": "error", + "no-restricted-globals": [ + "error", + { name: "setTimeout" }, + { name: "clearTimeout" }, + { name: "setInterval" }, + { name: "clearInterval" }, + { name: "setImmediate" }, + { name: "clearImmediate" }, + { name: "performance" }, + ], + }, + }, + { + files: ["src/harness/**", "src/testRunner/**"], + rules: { + "no-restricted-globals": "off", + }, + }, + { + files: ["src/lib/*.d.ts"], + ...tseslint.configs.disableTypeChecked, + }, + { + files: ["src/lib/*.d.ts"], + languageOptions: { + globals: {}, + }, + rules: { + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/prefer-function-type": "off", + "@typescript-eslint/unified-signatures": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-unused-vars": "off", + + // scripts/eslint/rules + "local/no-keywords": "off", + + // eslint + "no-var": "off", + "no-restricted-globals": "off", + "no-shadow-restricted-names": "off", + "no-restricted-syntax": "off", + }, + }, + { + files: ["src/lib/es2019.array.d.ts"], + rules: { + "@typescript-eslint/array-type": "off", + }, + }, +); diff --git a/package-lock.json b/package-lock.json index e698729dc95..8191c922b2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@dprint/formatter": "^0.3.0", "@dprint/typescript": "0.91.1", "@esfx/canceltoken": "^1.0.0", + "@eslint/js": "^8.57.0", "@octokit/rest": "^21.0.0", "@types/chai": "^4.3.16", "@types/diff": "^5.2.1", @@ -25,8 +26,6 @@ "@types/node": "latest", "@types/source-map-support": "^0.5.10", "@types/which": "^3.0.4", - "@typescript-eslint/eslint-plugin": "^7.14.1", - "@typescript-eslint/parser": "^7.14.1", "@typescript-eslint/utils": "^7.14.1", "azure-devops-node-api": "^14.0.1", "c8": "^10.1.2", @@ -38,9 +37,9 @@ "esbuild": "^0.21.5", "eslint": "^8.57.0", "eslint-formatter-autolinkable-stylish": "^1.3.0", - "eslint-plugin-local": "^4.2.2", "fast-xml-parser": "^4.4.0", "glob": "^10.4.2", + "globals": "^13.24.0", "hereby": "^1.8.9", "jsonc-parser": "^3.3.1", "knip": "^5.23.1", @@ -53,6 +52,7 @@ "source-map-support": "^0.5.21", "tslib": "^2.6.3", "typescript": "^5.5.2", + "typescript-eslint": "^7.14.1", "which": "^3.0.1" }, "engines": { @@ -1018,18 +1018,6 @@ "node": ">=8.10" } }, - "node_modules/@thisismanta/pessimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@thisismanta/pessimist/-/pessimist-1.2.0.tgz", - "integrity": "sha512-rm8/zjNMuO9hPYhEMavVIIxmvawJJB8mthvbVXd74XUW7V/SbgmtDBQjICbCWKjluvA+gh+cqi7dv85/jexknA==", - "dev": true, - "dependencies": { - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=16.0.0" - } - }, "node_modules/@types/chai": { "version": "4.3.16", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.16.tgz", @@ -2230,22 +2218,6 @@ "eslint": "^8.3.0" } }, - "node_modules/eslint-plugin-local": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-local/-/eslint-plugin-local-4.2.2.tgz", - "integrity": "sha512-9yNacxuEAVw2nYGCAj+ofx74cWODq7N7jcajlq1tzz6xuJS0WFhp72s/WSvIyJG6b/75+n63SKxUFVrt1UHmfQ==", - "dev": true, - "dependencies": { - "@thisismanta/pessimist": "^1.2.0", - "chalk": "^4.0.0" - }, - "bin": { - "eslint-plugin-local": "executable.js" - }, - "peerDependencies": { - "eslint": ">=6.0.0" - } - }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -3311,12 +3283,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "node_modules/lodash.curry": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.curry/-/lodash.curry-4.1.1.tgz", @@ -4693,6 +4659,32 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "7.14.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.14.1.tgz", + "integrity": "sha512-Eo1X+Y0JgGPspcANKjeR6nIqXl4VL5ldXLc15k4m9upq+eY5fhU2IueiEZL6jmHrKH8aCfbIvM/v3IrX5Hg99w==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "7.14.1", + "@typescript-eslint/parser": "7.14.1", + "@typescript-eslint/utils": "7.14.1" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/typical": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", @@ -5626,15 +5618,6 @@ "p-map": "^4.0.0" } }, - "@thisismanta/pessimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@thisismanta/pessimist/-/pessimist-1.2.0.tgz", - "integrity": "sha512-rm8/zjNMuO9hPYhEMavVIIxmvawJJB8mthvbVXd74XUW7V/SbgmtDBQjICbCWKjluvA+gh+cqi7dv85/jexknA==", - "dev": true, - "requires": { - "lodash": "^4.17.21" - } - }, "@types/chai": { "version": "4.3.16", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.16.tgz", @@ -6542,16 +6525,6 @@ "plur": "^4.0.0" } }, - "eslint-plugin-local": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-local/-/eslint-plugin-local-4.2.2.tgz", - "integrity": "sha512-9yNacxuEAVw2nYGCAj+ofx74cWODq7N7jcajlq1tzz6xuJS0WFhp72s/WSvIyJG6b/75+n63SKxUFVrt1UHmfQ==", - "dev": true, - "requires": { - "@thisismanta/pessimist": "^1.2.0", - "chalk": "^4.0.0" - } - }, "eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -7263,12 +7236,6 @@ "p-locate": "^5.0.0" } }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "lodash.curry": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.curry/-/lodash.curry-4.1.1.tgz", @@ -8231,6 +8198,17 @@ "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", "dev": true }, + "typescript-eslint": { + "version": "7.14.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.14.1.tgz", + "integrity": "sha512-Eo1X+Y0JgGPspcANKjeR6nIqXl4VL5ldXLc15k4m9upq+eY5fhU2IueiEZL6jmHrKH8aCfbIvM/v3IrX5Hg99w==", + "dev": true, + "requires": { + "@typescript-eslint/eslint-plugin": "7.14.1", + "@typescript-eslint/parser": "7.14.1", + "@typescript-eslint/utils": "7.14.1" + } + }, "typical": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", diff --git a/package.json b/package.json index 7b83024a0de..fdb3153ea15 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@dprint/formatter": "^0.3.0", "@dprint/typescript": "0.91.1", "@esfx/canceltoken": "^1.0.0", + "@eslint/js": "^8.57.0", "@octokit/rest": "^21.0.0", "@types/chai": "^4.3.16", "@types/diff": "^5.2.1", @@ -51,8 +52,6 @@ "@types/node": "latest", "@types/source-map-support": "^0.5.10", "@types/which": "^3.0.4", - "@typescript-eslint/eslint-plugin": "^7.14.1", - "@typescript-eslint/parser": "^7.14.1", "@typescript-eslint/utils": "^7.14.1", "azure-devops-node-api": "^14.0.1", "c8": "^10.1.2", @@ -64,9 +63,9 @@ "esbuild": "^0.21.5", "eslint": "^8.57.0", "eslint-formatter-autolinkable-stylish": "^1.3.0", - "eslint-plugin-local": "^4.2.2", "fast-xml-parser": "^4.4.0", "glob": "^10.4.2", + "globals": "^13.24.0", "hereby": "^1.8.9", "jsonc-parser": "^3.3.1", "knip": "^5.23.1", @@ -79,6 +78,7 @@ "source-map-support": "^0.5.21", "tslib": "^2.6.3", "typescript": "^5.5.2", + "typescript-eslint": "^7.14.1", "which": "^3.0.1" }, "overrides": { diff --git a/src/.eslintrc.json b/src/.eslintrc.json deleted file mode 100644 index 697574c6a8e..00000000000 --- a/src/.eslintrc.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "extends": "../.eslintrc.json", - "parserOptions": { - "tsconfigRootDir": "src", - "project": "./tsconfig-eslint.json" - }, - "rules": { - "@typescript-eslint/no-unnecessary-type-assertion": "error", - "no-restricted-globals": [ - "error", - { "name": "setTimeout" }, - { "name": "clearTimeout" }, - { "name": "setInterval" }, - { "name": "clearInterval" }, - { "name": "setImmediate" }, - { "name": "clearImmediate" }, - { "name": "performance" } - ] - }, - "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 - "local/no-keywords": "off", - - // eslint - "no-var": "off", - "no-restricted-globals": "off" - } - }, - { - "files": ["lib/es2019.array.d.ts"], - "rules": { - "@typescript-eslint/array-type": "off" - } - }, - { - "files": ["debug/**", "harness/**", "testRunner/**"], - "rules": { - "no-restricted-globals": "off" - } - } - ] -}