Update to eslint v9, typescript-eslint v8 (#59518)
This commit is contained in:
Родитель
7049af5f4f
Коммит
01a874a8ba
|
@ -123,24 +123,15 @@ export default tseslint.config(
|
|||
"@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-empty-object-type": "off", // {} is a totally useful and valid type.
|
||||
"@typescript-eslint/no-require-imports": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
// Ignore: (solely underscores | starting with exactly one underscore)
|
||||
argsIgnorePattern: "^(_+$|_[^_])",
|
||||
varsIgnorePattern: "^(_+$|_[^_])",
|
||||
// Not setting an ignore pattern for caught errors; those can always be safely removed.
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-inferrable-types": "off",
|
||||
|
@ -239,7 +230,8 @@ export default tseslint.config(
|
|||
"@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-unsafe-function-type": "off",
|
||||
"@typescript-eslint/no-wrapper-object-types": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
|
||||
// scripts/eslint/rules
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
21
package.json
21
package.json
|
@ -42,7 +42,7 @@
|
|||
"@dprint/formatter": "^0.4.1",
|
||||
"@dprint/typescript": "0.91.6",
|
||||
"@esfx/canceltoken": "^1.0.0",
|
||||
"@eslint/js": "^8.57.0",
|
||||
"@eslint/js": "^9.9.0",
|
||||
"@octokit/rest": "^21.0.1",
|
||||
"@types/chai": "^4.3.17",
|
||||
"@types/diff": "^5.2.1",
|
||||
|
@ -52,8 +52,9 @@
|
|||
"@types/node": "latest",
|
||||
"@types/source-map-support": "^0.5.10",
|
||||
"@types/which": "^3.0.4",
|
||||
"@typescript-eslint/utils": "^7.18.0",
|
||||
"azure-devops-node-api": "^14.0.1",
|
||||
"@typescript-eslint/rule-tester": "^8.1.0",
|
||||
"@typescript-eslint/utils": "^8.1.0",
|
||||
"azure-devops-node-api": "^14.0.2",
|
||||
"c8": "^10.1.2",
|
||||
"chai": "^4.5.0",
|
||||
"chalk": "^4.1.2",
|
||||
|
@ -61,25 +62,25 @@
|
|||
"diff": "^5.2.0",
|
||||
"dprint": "^0.47.2",
|
||||
"esbuild": "^0.23.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-formatter-autolinkable-stylish": "^1.3.0",
|
||||
"eslint": "^9.9.0",
|
||||
"eslint-formatter-autolinkable-stylish": "^1.4.0",
|
||||
"fast-xml-parser": "^4.4.1",
|
||||
"glob": "^10.4.5",
|
||||
"globals": "^15.9.0",
|
||||
"hereby": "^1.9.0",
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"knip": "^5.27.0",
|
||||
"knip": "^5.27.2",
|
||||
"minimist": "^1.2.8",
|
||||
"mocha": "^10.7.0",
|
||||
"mocha": "^10.7.3",
|
||||
"mocha-fivemat-progress-reporter": "^0.1.0",
|
||||
"monocart-coverage-reports": "^2.10.0",
|
||||
"monocart-coverage-reports": "^2.10.2",
|
||||
"ms": "^2.1.3",
|
||||
"node-fetch": "^3.3.2",
|
||||
"playwright": "^1.45.3",
|
||||
"playwright": "^1.46.0",
|
||||
"source-map-support": "^0.5.21",
|
||||
"tslib": "^2.6.3",
|
||||
"typescript": "^5.5.4",
|
||||
"typescript-eslint": "^7.18.0",
|
||||
"typescript-eslint": "^8.1.0",
|
||||
"which": "^3.0.1"
|
||||
},
|
||||
"overrides": {
|
||||
|
|
|
@ -2,10 +2,11 @@ const { RuleTester } = require("./support/RuleTester.cjs");
|
|||
const rule = require("../rules/argument-trivia.cjs");
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
},
|
||||
},
|
||||
parser: require.resolve("@typescript-eslint/parser"),
|
||||
});
|
||||
|
||||
ruleTester.run("argument-trivia", rule, {
|
||||
|
|
|
@ -2,10 +2,11 @@ const { RuleTester } = require("./support/RuleTester.cjs");
|
|||
const rule = require("../rules/debug-assert.cjs");
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
},
|
||||
},
|
||||
parser: require.resolve("@typescript-eslint/parser"),
|
||||
});
|
||||
|
||||
ruleTester.run("debug-assert", rule, {
|
||||
|
|
|
@ -2,10 +2,11 @@ const { RuleTester } = require("./support/RuleTester.cjs");
|
|||
const rule = require("../rules/js-extensions.cjs");
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
},
|
||||
},
|
||||
parser: require.resolve("@typescript-eslint/parser"),
|
||||
});
|
||||
|
||||
ruleTester.run("js-extensions", rule, {
|
||||
|
|
|
@ -2,10 +2,11 @@ const { RuleTester } = require("./support/RuleTester.cjs");
|
|||
const rule = require("../rules/no-in-operator.cjs");
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
},
|
||||
},
|
||||
parser: require.resolve("@typescript-eslint/parser"),
|
||||
});
|
||||
|
||||
ruleTester.run("no-in-operator", rule, {
|
||||
|
|
|
@ -2,10 +2,11 @@ const { RuleTester } = require("./support/RuleTester.cjs");
|
|||
const rule = require("../rules/no-keywords.cjs");
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
},
|
||||
},
|
||||
parser: require.resolve("@typescript-eslint/parser"),
|
||||
});
|
||||
|
||||
ruleTester.run("no-keywords", rule, {
|
||||
|
|
|
@ -2,10 +2,11 @@ const { RuleTester } = require("./support/RuleTester.cjs");
|
|||
const rule = require("../rules/only-arrow-functions.cjs");
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
},
|
||||
},
|
||||
parser: require.resolve("@typescript-eslint/parser"),
|
||||
});
|
||||
|
||||
ruleTester.run("only-arrow-functions", rule, {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
const path = require("path");
|
||||
const { TSESLint } = require("@typescript-eslint/utils");
|
||||
const Mocha = require("mocha");
|
||||
const { RuleTester } = require("@typescript-eslint/rule-tester");
|
||||
|
||||
RuleTester.afterAll = Mocha.after;
|
||||
|
||||
module.exports.ROOT_DIR = path.join(process.cwd(), "scripts", "eslint", "tests", "fixtures");
|
||||
module.exports.FILENAME = path.join(module.exports.ROOT_DIR, "file.ts");
|
||||
module.exports.RuleTester = TSESLint.RuleTester;
|
||||
module.exports.RuleTester = RuleTester;
|
||||
|
|
|
@ -45,7 +45,7 @@ class FailedTestsReporter extends Mocha.reporters.Base {
|
|||
try {
|
||||
reporter = require(reporterOptions.reporter);
|
||||
}
|
||||
catch (_) {
|
||||
catch {
|
||||
reporter = require(path.resolve(process.cwd(), reporterOptions.reporter));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ startOfDiags.split(EOL).forEach(line => {
|
|||
execSync(`grep -rnw 'src' -e 'Diagnostics.${diagName}'`).toString();
|
||||
process.stdout.write(".");
|
||||
}
|
||||
catch (error) {
|
||||
catch {
|
||||
missingNames.push(diagName);
|
||||
process.stdout.write("x");
|
||||
}
|
||||
|
|
|
@ -1792,7 +1792,7 @@ export let sys: System = (() => {
|
|||
try {
|
||||
buffer = _fs.readFileSync(fileName);
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return undefined;
|
||||
}
|
||||
let len = buffer.length;
|
||||
|
@ -1863,7 +1863,7 @@ export let sys: System = (() => {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1882,7 +1882,7 @@ export let sys: System = (() => {
|
|||
directories.sort();
|
||||
return { files, directories };
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return emptyFileSystemEntries;
|
||||
}
|
||||
}
|
||||
|
@ -1911,7 +1911,7 @@ export let sys: System = (() => {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
|
@ -1952,7 +1952,7 @@ export let sys: System = (() => {
|
|||
try {
|
||||
return statSync(path)?.mtime;
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return undefined;
|
||||
}
|
||||
finally {
|
||||
|
@ -1964,7 +1964,7 @@ export let sys: System = (() => {
|
|||
try {
|
||||
_fs.utimesSync(path, time, time);
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1973,7 +1973,7 @@ export let sys: System = (() => {
|
|||
try {
|
||||
return _fs.unlinkSync(path);
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -723,7 +723,7 @@ export function validateLocaleAndSetLanguage(
|
|||
try {
|
||||
fileContents = sys.readFile(filePath);
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
if (errors) {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, filePath));
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ export function createCachedDirectoryStructureHost(host: DirectoryStructureHost,
|
|||
try {
|
||||
return createCachedFileSystemEntries(rootDir, rootDirPath);
|
||||
}
|
||||
catch (_e) {
|
||||
catch {
|
||||
// If there is exception to read directories, dont cache the result and direct the calls to host
|
||||
Debug.assert(!cachedReadDirectoryResult.has(ensureTrailingDirectorySeparator(rootDirPath)));
|
||||
return undefined;
|
||||
|
|
|
@ -41,7 +41,7 @@ export function readTestFile(path: string) {
|
|||
try {
|
||||
content = Harness.IO.readFile(Harness.userSpecifiedRoot + path);
|
||||
}
|
||||
catch (err) {
|
||||
catch {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ export function initializeNodeSystem(): StartInput {
|
|||
try {
|
||||
this.fd = fs.openSync(this.logFilename, "w");
|
||||
}
|
||||
catch (_) {
|
||||
catch {
|
||||
// swallow the error and keep logging disabled if file cannot be opened
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ export function initializeNodeSystem(): StartInput {
|
|||
const factory = require("./cancellationToken.js");
|
||||
cancellationToken = factory(sys.args);
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
cancellationToken = ts.server.nullCancellationToken;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class FileLog implements ts.server.typingsInstaller.Log {
|
|||
try {
|
||||
fs.appendFileSync(this.logFile, `[${ts.server.nowString()}] ${text}${sys.newLine}`);
|
||||
}
|
||||
catch (e) {
|
||||
catch {
|
||||
this.logFile = undefined;
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче