From c1b6296e4221887469474a12c3d4be05548b01c4 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 15 Aug 2025 20:32:54 -0700 Subject: [PATCH 1/8] chore: disable postinstall for renovate --- tools/scripts/postinstall.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/postinstall.mts b/tools/scripts/postinstall.mts index c6bfcd2f3a97..9343d73a084e 100644 --- a/tools/scripts/postinstall.mts +++ b/tools/scripts/postinstall.mts @@ -20,7 +20,7 @@ const $ = $_config({ * We therefore use an env var for this. */ -if (process.env.SKIP_POSTINSTALL) { +if (process.env.SKIP_POSTINSTALL || process.env.MEND_HOSTED === "true") { console.log( '\nSkipping postinstall script because $SKIP_POSTINSTALL is set...\n', ); From 37d9ccc03037d789e136284633c33cabdd014a85 Mon Sep 17 00:00:00 2001 From: Kirk Waiblinger <53019676+kirkwaiblinger@users.noreply.github.com> Date: Fri, 15 Aug 2025 21:39:02 -0600 Subject: [PATCH 2/8] fix(typescript-estree): correct range of import assertion with trailing comma (#11478) Co-authored-by: fisker Cheung --- .prettierignore | 3 +- .../config.ts | 4 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 149 +++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 202 ++++++++++++++++++ .../snapshots/3-Babel-Error.shot | 4 + .../fixtures-with-differences-errors.shot | 3 +- .../tests/fixtures-without-babel-support.shot | 7 +- packages/ast-spec/tests/fixtures.test.ts | 2 +- .../tests/util/parsers/parser-types.ts | 21 -- packages/ast-spec/tsconfig.spec.json | 8 + packages/ast-spec/typings/global.d.ts | 20 ++ packages/typescript-estree/src/convert.ts | 7 +- 13 files changed, 405 insertions(+), 26 deletions(-) create mode 100644 packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/config.ts create mode 100644 packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts create mode 100644 packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-Error.shot create mode 100644 packages/ast-spec/typings/global.d.ts diff --git a/.prettierignore b/.prettierignore index 77ec15cde8cf..c5f057dfff86 100644 --- a/.prettierignore +++ b/.prettierignore @@ -25,8 +25,9 @@ packages/ast-spec/src/special/ExportSpecifier/fixtures/value-export-specifier/fi # TODO - remove this once prettier supports it # https://github.com/prettier/prettier/issues/16072 -packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-assert/fixture.ts packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-import-attributes-with/fixture.ts +# https://github.com/prettier/prettier/issues/17405 +packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/config.ts b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/config.ts new file mode 100644 index 000000000000..0b761eb56eb3 --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/config.ts @@ -0,0 +1,4 @@ +export default { + expectBabelToNotSupport: + 'waiting for https://github.com/babel/babel/pull/17465 to be released', +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts new file mode 100644 index 000000000000..f5ad318ad5f4 --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts @@ -0,0 +1 @@ +type TrailingComma = import("A", { with: { "resolution-mode": "import", }, } ); diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..f1f332ffa5de --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,149 @@ +Program { + type: "Program", + body: [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + declare: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "TrailingComma", + optional: false, + + range: [5, 18], + loc: { + start: { column: 5, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + typeAnnotation: TSImportType { + type: "TSImportType", + argument: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: ""A"", + value: "A", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + options: ObjectExpression { + type: "ObjectExpression", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "with", + optional: false, + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: false, + value: ObjectExpression { + type: "ObjectExpression", + properties: [ + Property { + type: "Property", + computed: false, + key: Literal { + type: "Literal", + raw: ""resolution-mode"", + value: "resolution-mode", + + range: [43, 60], + loc: { + start: { column: 43, line: 1 }, + end: { column: 60, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: ""import"", + value: "import", + + range: [62, 70], + loc: { + start: { column: 62, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + + range: [43, 70], + loc: { + start: { column: 43, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + ], + + range: [41, 73], + loc: { + start: { column: 41, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + + range: [35, 73], + loc: { + start: { column: 35, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + ], + + range: [33, 76], + loc: { + start: { column: 33, line: 1 }, + end: { column: 76, line: 1 }, + }, + }, + qualifier: null, + typeArguments: null, + + range: [21, 78], + loc: { + start: { column: 21, line: 1 }, + end: { column: 78, line: 1 }, + }, + }, + + range: [0, 79], + loc: { + start: { column: 0, line: 1 }, + end: { column: 79, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 80], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} \ No newline at end of file diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..cae5e0bcfd9e --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,202 @@ +[ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "TrailingComma", + + range: [5, 18], + loc: { + start: { column: 5, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "import", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + String { + type: "String", + value: ""A"", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [33, 34], + loc: { + start: { column: 33, line: 1 }, + end: { column: 34, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "with", + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [39, 40], + loc: { + start: { column: 39, line: 1 }, + end: { column: 40, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [41, 42], + loc: { + start: { column: 41, line: 1 }, + end: { column: 42, line: 1 }, + }, + }, + String { + type: "String", + value: ""resolution-mode"", + + range: [43, 60], + loc: { + start: { column: 43, line: 1 }, + end: { column: 60, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [60, 61], + loc: { + start: { column: 60, line: 1 }, + end: { column: 61, line: 1 }, + }, + }, + String { + type: "String", + value: ""import"", + + range: [62, 70], + loc: { + start: { column: 62, line: 1 }, + end: { column: 70, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [70, 71], + loc: { + start: { column: 70, line: 1 }, + end: { column: 71, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [72, 73], + loc: { + start: { column: 72, line: 1 }, + end: { column: 73, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [73, 74], + loc: { + start: { column: 73, line: 1 }, + end: { column: 74, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [75, 76], + loc: { + start: { column: 75, line: 1 }, + end: { column: 76, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [77, 78], + loc: { + start: { column: 77, line: 1 }, + end: { column: 78, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [78, 79], + loc: { + start: { column: 78, line: 1 }, + end: { column: 79, line: 1 }, + }, + }, +] \ No newline at end of file diff --git a/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-Error.shot new file mode 100644 index 000000000000..8f216bc26e47 --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/snapshots/3-Babel-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > type > TSImportType > type-import-type-with-trailing-comma-in-import-attributes > Babel - Error`] +SyntaxError: Unexpected token, expected "}" (1:73) diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index 7051aa777fbb..006a68578577 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -47,7 +47,8 @@ exports[`AST Fixtures > List fixtures with Error differences`] "legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/fixture.ts", "legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/fixture.ts", "legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/fixture.ts", - "type/TSImportType/fixtures/_error_/type-import-type-with-import-attributes-assert/fixture.ts" + "type/TSImportType/fixtures/_error_/type-import-type-with-import-attributes-assert/fixture.ts", + "type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts" ], "TSESTree errored but Babel didn't": [ "declaration/TSDeclareFunction/fixtures/_error_/generator-ambient/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-without-babel-support.shot b/packages/ast-spec/tests/fixtures-without-babel-support.shot index 0a63977a3f5e..a13f680d01a0 100644 --- a/packages/ast-spec/tests/fixtures-without-babel-support.shot +++ b/packages/ast-spec/tests/fixtures-without-babel-support.shot @@ -1,4 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > List fixtures we expect babel to not support`] -[] +[ + [ + "type/TSImportType/fixtures/type-import-type-with-trailing-comma-in-import-attributes/fixture.ts", + "waiting for https://github.com/babel/babel/pull/17465 to be released" + ] +] diff --git a/packages/ast-spec/tests/fixtures.test.ts b/packages/ast-spec/tests/fixtures.test.ts index 16534e6f0c1e..b6400540425c 100644 --- a/packages/ast-spec/tests/fixtures.test.ts +++ b/packages/ast-spec/tests/fixtures.test.ts @@ -4,7 +4,7 @@ import * as path from 'node:path'; import { pathToFileURL } from 'node:url'; import { VitestSnapshotEnvironment } from 'vitest/snapshot'; -import type { ASTFixtureConfig, Fixture } from './util/parsers/parser-types.js'; +import type { Fixture } from './util/parsers/parser-types.js'; import { getErrorLabel } from './util/getErrorLabel.js'; import { parseBabel } from './util/parsers/babel.js'; diff --git a/packages/ast-spec/tests/util/parsers/parser-types.ts b/packages/ast-spec/tests/util/parsers/parser-types.ts index e1d382876654..e95a648c6f24 100644 --- a/packages/ast-spec/tests/util/parsers/parser-types.ts +++ b/packages/ast-spec/tests/util/parsers/parser-types.ts @@ -5,27 +5,6 @@ interface SuccessSnapshotPaths { readonly tokens: SnapshotPathFn; } -/** - * We define this as a global type to make it easier to consume from fixtures. - * It saves us having to import the type into `src` files from a test utils folder. - * This is a convenient property because it saves us from a lot of `../`! - */ -export interface ASTFixtureConfig { - /** - * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript. - * This case only usually occurs when attempting to lint invalid code. - */ - readonly allowInvalidAST?: boolean; - - /** - * Specifies that we expect that babel doesn't yet support the code in this fixture, so we expect that it will error. - * This should not be used if we expect babel to throw for this feature due to a valid parser error! - * - * The value should be a description of why there isn't support - for example a github issue URL. - */ - readonly expectBabelToNotSupport?: string; -} - export interface Fixture { readonly absolute: string; readonly babelParsed: ParserResponse; diff --git a/packages/ast-spec/tsconfig.spec.json b/packages/ast-spec/tsconfig.spec.json index fa52d4c4e988..0f776aea58e3 100644 --- a/packages/ast-spec/tsconfig.spec.json +++ b/packages/ast-spec/tsconfig.spec.json @@ -3,6 +3,14 @@ "compilerOptions": { "outDir": "../../dist/packages/ast-spec" }, + "include": [ + "tests", + "typings", + "**/fixtures/**/config.ts", + "vitest.config.mts", + "package.json" + ], + "exclude": ["**/fixtures/**/fixture.ts"], "references": [ { "path": "../typescript-estree/tsconfig.build.json" diff --git a/packages/ast-spec/typings/global.d.ts b/packages/ast-spec/typings/global.d.ts new file mode 100644 index 000000000000..7dd0713ea5d4 --- /dev/null +++ b/packages/ast-spec/typings/global.d.ts @@ -0,0 +1,20 @@ +/** + * We define this as a global type to make it easier to consume from fixtures. + * It saves us having to import the type into `src` files from a test utils folder. + * This is a convenient property because it saves us from a lot of `../`! + */ +interface ASTFixtureConfig { + /** + * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript. + * This case only usually occurs when attempting to lint invalid code. + */ + readonly allowInvalidAST?: boolean; + + /** + * Specifies that we expect that babel doesn't yet support the code in this fixture, so we expect that it will error. + * This should not be used if we expect babel to throw for this feature due to a valid parser error! + * + * The value should be a description of why there isn't support - for example a github issue URL. + */ + readonly expectBabelToNotSupport?: string; +} diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index e4564c92aa72..dccb674537c6 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -3166,11 +3166,16 @@ export class Converter { const commaToken = findNextToken(node.argument, node, this.ast)!; const openBraceToken = findNextToken(commaToken, node, this.ast)!; - const closeBraceToken = findNextToken( + const tokenAfterAttributes = findNextToken( node.attributes, node, this.ast, )!; + // Since TS 5.9, there could be a trailing comma, i.e. `{ with: { ... }, }` + const closeBraceToken = + tokenAfterAttributes.kind === ts.SyntaxKind.CommaToken + ? findNextToken(tokenAfterAttributes, node, this.ast)! + : tokenAfterAttributes; const withOrAssertToken = findNextToken( openBraceToken, node, From 3426f0dd6f1f89d923720ff1af53b672809e5587 Mon Sep 17 00:00:00 2001 From: Kirk Waiblinger <53019676+kirkwaiblinger@users.noreply.github.com> Date: Fri, 15 Aug 2025 21:44:42 -0600 Subject: [PATCH 3/8] fix(typescript-eslint): export `plugin`, `parser`, and `configs` that are compatible with both `defineConfig()` and `tseslint.config()` (#11475) --- packages/typescript-eslint/package.json | 12 ++++ .../src/compatibility-types.ts | 25 +++++++ packages/typescript-eslint/src/index.ts | 66 ++++++++++++------- .../tests/type-compatibility.test-d.ts | 49 ++++++++++++++ packages/typescript-eslint/vitest.config.mts | 4 ++ 5 files changed, 134 insertions(+), 22 deletions(-) create mode 100644 packages/typescript-eslint/src/compatibility-types.ts create mode 100644 packages/typescript-eslint/tests/type-compatibility.test-d.ts diff --git a/packages/typescript-eslint/package.json b/packages/typescript-eslint/package.json index 3b828ed2dd7c..ed9e55806bd5 100644 --- a/packages/typescript-eslint/package.json +++ b/packages/typescript-eslint/package.json @@ -78,6 +78,18 @@ "targets": { "lint": { "command": "eslint" + }, + "typecheck": { + "outputs": [ + "{workspaceRoot}/dist", + "{projectRoot}/dist" + ] + }, + "test": { + "dependsOn": [ + "^build", + "typecheck" + ] } } } diff --git a/packages/typescript-eslint/src/compatibility-types.ts b/packages/typescript-eslint/src/compatibility-types.ts new file mode 100644 index 000000000000..10357e93accf --- /dev/null +++ b/packages/typescript-eslint/src/compatibility-types.ts @@ -0,0 +1,25 @@ +/* + * This file contains types that are intentionally wide/inaccurate, that exist + * for the purpose of satisfying both `defineConfig()` and `tseslint.config()`. + * See https://github.com/typescript-eslint/typescript-eslint/issues/10899 + */ + +export interface CompatibleParser { + parseForESLint(text: string): { + ast: unknown; + scopeManager: unknown; + }; +} + +export interface CompatibleConfig { + name?: string; + rules?: object; +} + +export type CompatibleConfigArray = CompatibleConfig[]; + +export interface CompatiblePlugin { + meta: { + name: string; + }; +} diff --git a/packages/typescript-eslint/src/index.ts b/packages/typescript-eslint/src/index.ts index b123d80b4db2..02197940789a 100644 --- a/packages/typescript-eslint/src/index.ts +++ b/packages/typescript-eslint/src/index.ts @@ -1,14 +1,23 @@ // see the comment in config-helper.ts for why this doesn't use /ts-eslint import type { TSESLint } from '@typescript-eslint/utils'; +import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; import pluginBase from '@typescript-eslint/eslint-plugin'; import rawPlugin from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/raw-plugin'; import { addCandidateTSConfigRootDir } from '@typescript-eslint/typescript-estree'; +import type { + CompatibleConfig, + CompatibleConfigArray, + CompatibleParser, + CompatiblePlugin, +} from './compatibility-types'; + import { config } from './config-helper'; import { getTSConfigRootDirFromStack } from './getTSConfigRootDirFromStack'; -export const parser: TSESLint.FlatConfig.Parser = rawPlugin.parser; +export const parser: CompatibleParser = + rawPlugin.parser as CompatibleParser satisfies FlatConfig.Parser; /* we could build a plugin object here without the `configs` key - but if we do @@ -33,30 +42,30 @@ use our new package); however legacy configs consumed via `@eslint/eslintrc` would never be able to satisfy this constraint and thus users would be blocked from using them. */ -export const plugin: TSESLint.FlatConfig.Plugin = pluginBase as Omit< - typeof pluginBase, - 'configs' ->; +export const plugin: CompatiblePlugin = + pluginBase satisfies FlatConfig.Plugins['string']; export const configs = createConfigsGetters({ /** * Enables each the rules provided as a part of typescript-eslint. Note that many rules are not applicable in all codebases, or are meant to be configured. * @see {@link https://typescript-eslint.io/users/configs#all} */ - all: rawPlugin.flatConfigs['flat/all'], + all: rawPlugin.flatConfigs['flat/all'] as CompatibleConfigArray, /** * A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint. * We don't recommend using this directly; instead, extend from an earlier recommended rule. * @see {@link https://typescript-eslint.io/users/configs#base} */ - base: rawPlugin.flatConfigs['flat/base'], + base: rawPlugin.flatConfigs['flat/base'] as CompatibleConfig, /** * A utility ruleset that will disable type-aware linting and all type-aware rules available in our project. * @see {@link https://typescript-eslint.io/users/configs#disable-type-checked} */ - disableTypeChecked: rawPlugin.flatConfigs['flat/disable-type-checked'], + disableTypeChecked: rawPlugin.flatConfigs[ + 'flat/disable-type-checked' + ] as CompatibleConfig, /** * This is a compatibility ruleset that: @@ -64,65 +73,78 @@ export const configs = createConfigsGetters({ * - enables rules that make sense due to TS's typechecking / transpilation. * @see {@link https://typescript-eslint.io/users/configs/#eslint-recommended} */ - eslintRecommended: rawPlugin.flatConfigs['flat/eslint-recommended'], + eslintRecommended: rawPlugin.flatConfigs[ + 'flat/eslint-recommended' + ] as CompatibleConfig, /** * Recommended rules for code correctness that you can drop in without additional configuration. * @see {@link https://typescript-eslint.io/users/configs#recommended} */ - recommended: rawPlugin.flatConfigs['flat/recommended'], + recommended: rawPlugin.flatConfigs[ + 'flat/recommended' + ] as CompatibleConfigArray, /** * Contains all of `recommended` along with additional recommended rules that require type information. * @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked} */ - recommendedTypeChecked: - rawPlugin.flatConfigs['flat/recommended-type-checked'], + recommendedTypeChecked: rawPlugin.flatConfigs[ + 'flat/recommended-type-checked' + ] as CompatibleConfigArray, /** * A version of `recommended` that only contains type-checked rules and disables of any corresponding core ESLint rules. * @see {@link https://typescript-eslint.io/users/configs#recommended-type-checked-only} */ - recommendedTypeCheckedOnly: - rawPlugin.flatConfigs['flat/recommended-type-checked-only'], + recommendedTypeCheckedOnly: rawPlugin.flatConfigs[ + 'flat/recommended-type-checked-only' + ] as CompatibleConfigArray, /** * Contains all of `recommended`, as well as additional strict rules that can also catch bugs. * @see {@link https://typescript-eslint.io/users/configs#strict} */ - strict: rawPlugin.flatConfigs['flat/strict'], + strict: rawPlugin.flatConfigs['flat/strict'] as CompatibleConfigArray, /** * Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information. * @see {@link https://typescript-eslint.io/users/configs#strict-type-checked} */ - strictTypeChecked: rawPlugin.flatConfigs['flat/strict-type-checked'], + strictTypeChecked: rawPlugin.flatConfigs[ + 'flat/strict-type-checked' + ] as CompatibleConfigArray, /** * A version of `strict` that only contains type-checked rules and disables of any corresponding core ESLint rules. * @see {@link https://typescript-eslint.io/users/configs#strict-type-checked-only} */ - strictTypeCheckedOnly: rawPlugin.flatConfigs['flat/strict-type-checked-only'], + strictTypeCheckedOnly: rawPlugin.flatConfigs[ + 'flat/strict-type-checked-only' + ] as CompatibleConfigArray, /** * Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic. * @see {@link https://typescript-eslint.io/users/configs#stylistic} */ - stylistic: rawPlugin.flatConfigs['flat/stylistic'], + stylistic: rawPlugin.flatConfigs['flat/stylistic'] as CompatibleConfigArray, /** * Contains all of `stylistic`, along with additional stylistic rules that require type information. * @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked} */ - stylisticTypeChecked: rawPlugin.flatConfigs['flat/stylistic-type-checked'], + stylisticTypeChecked: rawPlugin.flatConfigs[ + 'flat/stylistic-type-checked' + ] as CompatibleConfigArray, /** * A version of `stylistic` that only contains type-checked rules and disables of any corresponding core ESLint rules. * @see {@link https://typescript-eslint.io/users/configs#stylistic-type-checked-only} */ - stylisticTypeCheckedOnly: - rawPlugin.flatConfigs['flat/stylistic-type-checked-only'], -}); + stylisticTypeCheckedOnly: rawPlugin.flatConfigs[ + 'flat/stylistic-type-checked-only' + ] as CompatibleConfigArray, +}) satisfies Record; function createConfigsGetters(values: T): T { const configs = {}; diff --git a/packages/typescript-eslint/tests/type-compatibility.test-d.ts b/packages/typescript-eslint/tests/type-compatibility.test-d.ts new file mode 100644 index 000000000000..b0e2f71b81d2 --- /dev/null +++ b/packages/typescript-eslint/tests/type-compatibility.test-d.ts @@ -0,0 +1,49 @@ +import { defineConfig } from 'eslint/config'; + +import tseslint from '../src/index'; + +describe('test for compatibility with config helpers', () => { + test('exported plugin is compatible with tseslint.config()', () => { + tseslint.config({ + plugins: { + '@typescript-eslint': tseslint.plugin, + }, + }); + }); + + test('exported plugin is compatible with defineConfig()', () => { + defineConfig({ + plugins: { + '@typescript-eslint': tseslint.plugin, + }, + }); + }); + + test('exported parser is compatible with tseslint.config()', () => { + tseslint.config({ + languageOptions: { + parser: tseslint.parser, + }, + }); + }); + + test('exported parser is compatible with defineConfig()', () => { + defineConfig({ + languageOptions: { + parser: tseslint.parser, + }, + }); + }); + + test('exported configs are compatible with tseslint.config()', () => { + tseslint.config(tseslint.configs.recommendedTypeChecked); + tseslint.config(tseslint.configs.strict); + tseslint.config(tseslint.configs.eslintRecommended); + }); + + test('exported configs are compatible with defineConfig()', () => { + defineConfig(tseslint.configs.recommendedTypeChecked); + defineConfig(tseslint.configs.strict); + defineConfig(tseslint.configs.eslintRecommended); + }); +}); diff --git a/packages/typescript-eslint/vitest.config.mts b/packages/typescript-eslint/vitest.config.mts index 7d1cc31b83d7..a527ce206583 100644 --- a/packages/typescript-eslint/vitest.config.mts +++ b/packages/typescript-eslint/vitest.config.mts @@ -14,6 +14,10 @@ const vitestConfig = mergeConfig( dir: path.join(import.meta.dirname, 'tests'), name: packageJson.name, root: import.meta.dirname, + typecheck: { + enabled: true, + tsconfig: path.join(import.meta.dirname, 'tsconfig.spec.json'), + }, }, }), ); From 19aa4d6da88b1c3b61f492c1ecdc09d701b31b04 Mon Sep 17 00:00:00 2001 From: Nolan Gajdascz Date: Fri, 15 Aug 2025 23:47:14 -0400 Subject: [PATCH 4/8] fix(utils): correct `calculateConfigForFile` return type (#11451) --- packages/utils/src/ts-eslint/eslint/FlatESLint.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/utils/src/ts-eslint/eslint/FlatESLint.ts b/packages/utils/src/ts-eslint/eslint/FlatESLint.ts index 085a9e0fdfa9..1861200f51b4 100644 --- a/packages/utils/src/ts-eslint/eslint/FlatESLint.ts +++ b/packages/utils/src/ts-eslint/eslint/FlatESLint.ts @@ -6,7 +6,7 @@ import type * as Shared from './ESLintShared'; // eslint-disable-next-line @typescript-eslint/no-unused-vars declare class FlatESLintBase extends Shared.ESLintBase< - FlatConfig.ConfigArray, + FlatConfig.Config | FlatConfig.ConfigArray, FlatESLint.ESLintOptions > { static readonly configType: 'flat'; @@ -18,7 +18,7 @@ declare class FlatESLintBase extends Shared.ESLintBase< * @param filePath The path of the file to retrieve a config object for. * @returns A configuration object for the file or `undefined` if there is no configuration data for the object. */ - calculateConfigForFile(filePath: string): Promise; + calculateConfigForFile(filePath: string): Promise; /** * Finds the config file being used by this instance based on the options From d50a6b11c502c4840f9649789672f49b262ff83c Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sat, 16 Aug 2025 11:57:44 +0800 Subject: [PATCH 5/8] feat(typescript-estree): forbid invalid keys in `EnumMember` (#11232) --- .../snapshots/1-TSESTree-AST.shot | 1 - .../snapshots/5-AST-Alignment-AST.shot | 1 - .../fixtures/_error_/bigint-name/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 +++ .../bigint-name/snapshots/2-Babel-Error.shot | 10 +++ .../snapshots/3-Alignment-Error.shot | 4 + .../_error_/computed-string-name/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 +++ .../snapshots/2-Babel-Error.shot | 10 +++ .../snapshots/3-Alignment-Error.shot | 4 + .../fixtures/_error_/number-name/fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 9 +++ .../number-name/snapshots/2-Babel-Error.shot | 10 +++ .../snapshots/3-Alignment-Error.shot | 4 + .../ast-spec/src/element/TSEnumMember/spec.ts | 45 ++--------- .../snapshots/1-TSESTree-Error.shot | 8 +- .../snapshots/3-Alignment-Error.shot | 2 +- .../snapshots/1-TSESTree-Error.shot | 8 +- .../snapshots/3-Alignment-Error.shot | 2 +- .../snapshots/1-TSESTree-Error.shot | 8 +- .../snapshots/3-Alignment-Error.shot | 2 +- .../const-enum/snapshots/1-TSESTree-AST.shot | 2 - .../snapshots/5-AST-Alignment-AST.shot | 16 ++-- .../snapshots/1-TSESTree-AST.shot | 2 - .../snapshots/5-AST-Alignment-AST.shot | 2 - .../snapshots/1-TSESTree-AST.shot | 2 - .../snapshots/5-AST-Alignment-AST.shot | 2 - .../snapshots/1-TSESTree-AST.shot | 2 - .../snapshots/5-AST-Alignment-AST.shot | 2 - .../enum/snapshots/1-TSESTree-AST.shot | 2 - .../enum/snapshots/5-AST-Alignment-AST.shot | 2 - .../fixtures-with-differences-errors.shot | 3 - .../src/rules/naming-convention.ts | 10 +-- .../rules/no-unsafe-enum-comparison.test.ts | 81 ------------------- .../rules/prefer-literal-enum-member.test.ts | 14 ---- .../rules/switch-exhaustiveness-check.test.ts | 40 --------- .../src/referencer/Referencer.ts | 5 +- packages/typescript-estree/src/convert.ts | 51 +++++++++--- 38 files changed, 162 insertions(+), 231 deletions(-) create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index ddd23006e5d0..9a5146151d36 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index 90fb8dedf846..eeec47153937 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts new file mode 100644 index 000000000000..3fcd08d2bc99 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts @@ -0,0 +1,3 @@ +enum Foo { + 1n = 2 +} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..87ba241f5d40 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > TSESTree - Error`] +TSError + 1 | enum Foo { +> 2 | 1n = 2 + | ^^ An enum member cannot have a numeric name. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..b3afe3afc96e --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > Babel - Error`] +BabelError + 1 | enum Foo { +> 2 | 1n = 2 + | ^ Unexpected token (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..083d80544d72 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts new file mode 100644 index 000000000000..2e99a8d3766b --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts @@ -0,0 +1,3 @@ +enum Foo { + ["A"] = 2 +} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..2079fad90f2e --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > TSESTree - Error`] +TSError + 1 | enum Foo { +> 2 | ["A"] = 2 + | ^^^^^ Computed property names are not allowed in enums. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..c68571c79318 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > Babel - Error`] +BabelError + 1 | enum Foo { +> 2 | ["A"] = 2 + | ^ Unexpected token (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1331cf0d18b9 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts new file mode 100644 index 000000000000..174773e65995 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts @@ -0,0 +1,3 @@ +enum Foo { + 1 = 2 +} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..8dfacb32e5b9 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,9 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > TSESTree - Error`] +TSError + 1 | enum Foo { +> 2 | 1 = 2 + | ^ An enum member cannot have a numeric name. + 3 | } + 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..76b2f2b9c62e --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot @@ -0,0 +1,10 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > Babel - Error`] +BabelError + 1 | enum Foo { +> 2 | 1 = 2 + | ^ Unexpected token (2:2) + 3 | } + 4 | + diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..34e6cebc91e1 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot @@ -0,0 +1,4 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > Error Alignment`] +Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/spec.ts b/packages/ast-spec/src/element/TSEnumMember/spec.ts index a80e963ad278..a4d1b836f951 100644 --- a/packages/ast-spec/src/element/TSEnumMember/spec.ts +++ b/packages/ast-spec/src/element/TSEnumMember/spec.ts @@ -1,44 +1,15 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { StringLiteral } from '../../expression/literal/StringLiteral/spec'; import type { Expression } from '../../unions/Expression'; -import type { - PropertyNameComputed, - PropertyNameNonComputed, -} from '../../unions/PropertyName'; -interface TSEnumMemberBase extends BaseNode { +export interface TSEnumMember extends BaseNode { type: AST_NODE_TYPES.TSEnumMember; - computed: boolean; - id: - | PropertyNameComputed // this should only happen in semantically invalid code (ts error 1164) - | PropertyNameNonComputed; + id: Identifier | StringLiteral; initializer: Expression | undefined; + /** + * @deprecated the enum member is always non-computed. + */ + computed: boolean; } - -/** - * this should only really happen in semantically invalid code (errors 1164 and 2452) - * - * @example - * ```ts - * // VALID: - * enum Foo { ['a'] } - * - * // INVALID: - * const x = 'a'; - * enum Foo { [x] } - * enum Bar { ['a' + 'b'] } - * ``` - */ -export interface TSEnumMemberComputedName extends TSEnumMemberBase { - computed: true; - id: PropertyNameComputed; -} - -export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { - computed: false; - id: PropertyNameNonComputed; -} - -export type TSEnumMember = - | TSEnumMemberComputedName - | TSEnumMemberNonComputedName; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot index c64aaae4a4d8..dc8d857908c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-number > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | export enum Foo { +> 4 | [1], + | ^^^ Computed property names are not allowed in enums. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot index f5e14d5d4b27..f9ae118971e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-number > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot index 866743a38587..90ef25fd26d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-string > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | export enum Foo { +> 4 | ['baz'], + | ^^^^^^^ Computed property names are not allowed in enums. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot index f58190aa21f3..2dc13fd3d5d2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-string > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot index 85b95f8e17d3..7e31fde5e0c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot @@ -1,4 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-var-ref > TSESTree - Error`] -NO ERROR +TSError + 2 | + 3 | export enum Foo { +> 4 | [x], + | ^^^ Computed property names are not allowed in enums. + 5 | } + 6 | diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot index 006e3518ee1f..3909357acf22 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-var-ref > Error Alignment`] -Babel errored but TSESTree didn't +Both errored diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot index 9187f52aade3..238113e5cc58 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -41,7 +40,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot index 1c5c321a9cf2..20c84325ce31 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -81,7 +80,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -121,12 +119,7 @@ Snapshot Diff: - loc: { - start: { column: 15, line: 3 }, - end: { column: 1, line: 6 }, -+ range: [103, 106], -+ loc: { -+ start: { column: 2, line: 5 }, -+ end: { column: 5, line: 5 }, -+ }, - }, +- }, - }, - const: true, - declare: false, @@ -140,7 +133,12 @@ Snapshot Diff: - loc: { - start: { column: 11, line: 3 }, - end: { column: 14, line: 3 }, -- }, ++ range: [103, 106], ++ loc: { ++ start: { column: 2, line: 5 }, ++ end: { column: 5, line: 5 }, ++ }, + }, - }, + ], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot index 0a35e9756f00..01c4d100b383 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -44,7 +43,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot index bc225b94ed0d..603938fb4270 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -85,7 +84,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot index 15279e8049d7..f946f794f043 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -44,7 +43,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot index 695e866e0f98..eff7ba3226bd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -85,7 +84,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot index b1554a6d0194..8f42d8de69bf 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -44,7 +43,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot index b52051becdfb..10c5f8d572d1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -85,7 +84,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot index 513eb9bcd84c..e483a20f2a29 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,6 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -30,7 +29,6 @@ Program { }, TSEnumMember { type: "TSEnumMember", - computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot index 3c1cbd1bc2a0..544b72e407c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,6 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -59,7 +58,6 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', -- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index 006a68578577..9bbb4c97243b 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -27,9 +27,6 @@ exports[`AST Fixtures > List fixtures with Error differences`] "legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/const-assertions/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/import-type-error/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/fixture.ts", diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 03500d825163..02b95a5948fc 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -631,12 +631,10 @@ export default createRule({ // #region interface - 'TSEnumMember[computed != true]': { - handler: ( - node: TSESTree.TSEnumMemberNonComputedName, - validator, - ): void => { - const id = node.id; + TSEnumMember: { + handler: (node: TSESTree.TSEnumMember, validator): void => { + // Unknown reason, can't get the correct type + const id = node.id as TSESTree.Identifier | TSESTree.StringLiteral; const modifiers = new Set(); if (requiresQuoting(id, compilerOptions.target)) { diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts index b592b7fe513d..89e28f163314 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts @@ -1121,87 +1121,6 @@ ruleTester.run('no-unsafe-enum-comparison', rule, { }, ], }, - { - code: ` - enum ComputedKey { - ['test-key' /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === 1; - `, - errors: [ - { - messageId: 'mismatchedCondition', - suggestions: [ - { - messageId: 'replaceValueWithEnum', - output: ` - enum ComputedKey { - ['test-key' /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === ComputedKey['test-key']; - `, - }, - ], - }, - ], - }, - { - code: ` - enum ComputedKey { - [\`test-key\` /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === 1; - `, - errors: [ - { - messageId: 'mismatchedCondition', - suggestions: [ - { - messageId: 'replaceValueWithEnum', - output: ` - enum ComputedKey { - [\`test-key\` /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === ComputedKey[\`test-key\`]; - `, - }, - ], - }, - ], - }, - { - code: ` - enum ComputedKey { - [\`test- - key\` /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === 1; - `, - errors: [ - { - messageId: 'mismatchedCondition', - suggestions: [ - { - messageId: 'replaceValueWithEnum', - output: ` - enum ComputedKey { - [\`test- - key\` /* with comment */] = 1, - } - declare const computedKey: ComputedKey; - computedKey === ComputedKey[\`test- - key\`]; - `, - }, - ], - }, - ], - }, { code: ` enum Fruit { diff --git a/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts b/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts index ea670139ccb3..f655c87e9ce2 100644 --- a/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts @@ -54,11 +54,6 @@ enum ValidQuotedKey { ` enum ValidQuotedKeyWithAssignment { 'a' = 1, -} - `, - ` -enum ValidKeyWithComputedSyntaxButNoComputedKey { - ['a'], } `, { @@ -107,15 +102,6 @@ enum Foo { }, { code: ` -enum Foo { - ['A-1'] = 1 << 0, - C = ~Foo['A-1'], -} - `, - options: [{ allowBitwiseExpressions: true }], - }, - { - code: ` enum Foo { A = 1 << 0, B = 1 << 1, diff --git a/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts b/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts index da5b65c8177f..b18e91e4872a 100644 --- a/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts +++ b/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts @@ -2281,46 +2281,6 @@ switch (value) { }, ], }, - { - code: ` - enum Enum { - 'a' = 1, - [\`key-with - - new-line\`] = 2, - } - - declare const a: Enum; - - switch (a) { - } - `, - errors: [ - { - messageId: 'switchIsNotExhaustive', - suggestions: [ - { - messageId: 'addMissingCases', - output: ` - enum Enum { - 'a' = 1, - [\`key-with - - new-line\`] = 2, - } - - declare const a: Enum; - - switch (a) { - case Enum.a: { throw new Error('Not implemented yet: Enum.a case') } - case Enum['key-with\\n\\n new-line']: { throw new Error('Not implemented yet: Enum[\\'key-with\\\\n\\\\n new-line\\'] case') } - } - `, - }, - ], - }, - ], - }, { code: noFormat` enum Enum { diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 1f621d8f7823..562921170751 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -668,10 +668,7 @@ export class Referencer extends Visitor { name, new TSEnumMemberDefinition(name, member), ); - } else if ( - !member.computed && - member.id.type === AST_NODE_TYPES.Identifier - ) { + } else if (member.id.type === AST_NODE_TYPES.Identifier) { this.currentScope().defineIdentifier( member.id, new TSEnumMemberDefinition(member.id, member), diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index dccb674537c6..150c0ee950ea 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -476,7 +476,7 @@ export class Converter { >( node: Properties, deprecatedKey: Key, - preferredKey: string, + preferredKey: string | undefined, value: Value, ): Properties & Record { let warned = false; @@ -487,10 +487,13 @@ export class Converter { ? (): Value => value : (): Value => { if (!warned) { - process.emitWarning( - `The '${deprecatedKey}' property is deprecated on ${node.type} nodes. Use ${preferredKey} instead. See https://typescript-eslint.io/troubleshooting/faqs/general#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.`, - 'DeprecationWarning', - ); + let message = `The '${deprecatedKey}' property is deprecated on ${node.type} nodes.`; + if (preferredKey) { + message += ` Use ${preferredKey} instead.`; + } + message += + ' See https://typescript-eslint.io/troubleshooting/faqs/general#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.'; + process.emitWarning(message, 'DeprecationWarning'); warned = true; } @@ -3263,12 +3266,38 @@ export class Converter { } case SyntaxKind.EnumMember: { - return this.createNode(node, { - type: AST_NODE_TYPES.TSEnumMember, - computed: node.name.kind === ts.SyntaxKind.ComputedPropertyName, - id: this.convertChild(node.name), - initializer: node.initializer && this.convertChild(node.initializer), - }); + const computed = node.name.kind === ts.SyntaxKind.ComputedPropertyName; + if (computed) { + this.#throwUnlessAllowInvalidAST( + node.name, + 'Computed property names are not allowed in enums.', + ); + } + + if ( + node.name.kind === SyntaxKind.NumericLiteral || + node.name.kind === SyntaxKind.BigIntLiteral + ) { + this.#throwUnlessAllowInvalidAST( + node.name, + 'An enum member cannot have a numeric name.', + ); + } + + return this.createNode( + node, + this.#withDeprecatedGetter( + { + type: AST_NODE_TYPES.TSEnumMember, + id: this.convertChild(node.name), + initializer: + node.initializer && this.convertChild(node.initializer), + }, + 'computed', + undefined, + computed, + ), + ); } case SyntaxKind.ModuleDeclaration: { From 07b8c8ec965315bcdf57ccd9ff44f17f500b1930 Mon Sep 17 00:00:00 2001 From: Kirk Waiblinger <53019676+kirkwaiblinger@users.noreply.github.com> Date: Mon, 18 Aug 2025 10:39:32 -0600 Subject: [PATCH 6/8] chore: fix prettier typo blocking CI (#11488) prettier --- tools/scripts/postinstall.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scripts/postinstall.mts b/tools/scripts/postinstall.mts index 9343d73a084e..e64af26d08fa 100644 --- a/tools/scripts/postinstall.mts +++ b/tools/scripts/postinstall.mts @@ -20,7 +20,7 @@ const $ = $_config({ * We therefore use an env var for this. */ -if (process.env.SKIP_POSTINSTALL || process.env.MEND_HOSTED === "true") { +if (process.env.SKIP_POSTINSTALL || process.env.MEND_HOSTED === 'true') { console.log( '\nSkipping postinstall script because $SKIP_POSTINSTALL is set...\n', ); From 76486227715a02a93a7b537f05c22825b764dbc3 Mon Sep 17 00:00:00 2001 From: Kirk Waiblinger <53019676+kirkwaiblinger@users.noreply.github.com> Date: Mon, 18 Aug 2025 10:40:53 -0600 Subject: [PATCH 7/8] fix(typescript-estree): revert #11232 (feat(typescript-estree): forbid invalid keys in EnumMember) (#11493) Revert "feat(typescript-estree): forbid invalid keys in `EnumMember` (#11232)" This reverts commit d50a6b11c502c4840f9649789672f49b262ff83c. --- .../snapshots/1-TSESTree-AST.shot | 1 + .../snapshots/5-AST-Alignment-AST.shot | 1 + .../fixtures/_error_/bigint-name/fixture.ts | 3 - .../snapshots/1-TSESTree-Error.shot | 9 --- .../bigint-name/snapshots/2-Babel-Error.shot | 10 --- .../snapshots/3-Alignment-Error.shot | 4 - .../_error_/computed-string-name/fixture.ts | 3 - .../snapshots/1-TSESTree-Error.shot | 9 --- .../snapshots/2-Babel-Error.shot | 10 --- .../snapshots/3-Alignment-Error.shot | 4 - .../fixtures/_error_/number-name/fixture.ts | 3 - .../snapshots/1-TSESTree-Error.shot | 9 --- .../number-name/snapshots/2-Babel-Error.shot | 10 --- .../snapshots/3-Alignment-Error.shot | 4 - .../ast-spec/src/element/TSEnumMember/spec.ts | 45 +++++++++-- .../snapshots/1-TSESTree-Error.shot | 8 +- .../snapshots/3-Alignment-Error.shot | 2 +- .../snapshots/1-TSESTree-Error.shot | 8 +- .../snapshots/3-Alignment-Error.shot | 2 +- .../snapshots/1-TSESTree-Error.shot | 8 +- .../snapshots/3-Alignment-Error.shot | 2 +- .../const-enum/snapshots/1-TSESTree-AST.shot | 2 + .../snapshots/5-AST-Alignment-AST.shot | 16 ++-- .../snapshots/1-TSESTree-AST.shot | 2 + .../snapshots/5-AST-Alignment-AST.shot | 2 + .../snapshots/1-TSESTree-AST.shot | 2 + .../snapshots/5-AST-Alignment-AST.shot | 2 + .../snapshots/1-TSESTree-AST.shot | 2 + .../snapshots/5-AST-Alignment-AST.shot | 2 + .../enum/snapshots/1-TSESTree-AST.shot | 2 + .../enum/snapshots/5-AST-Alignment-AST.shot | 2 + .../fixtures-with-differences-errors.shot | 3 + .../src/rules/naming-convention.ts | 10 ++- .../rules/no-unsafe-enum-comparison.test.ts | 81 +++++++++++++++++++ .../rules/prefer-literal-enum-member.test.ts | 14 ++++ .../rules/switch-exhaustiveness-check.test.ts | 40 +++++++++ .../src/referencer/Referencer.ts | 5 +- packages/typescript-estree/src/convert.ts | 51 +++--------- 38 files changed, 231 insertions(+), 162 deletions(-) delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot delete mode 100644 packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index 9a5146151d36..ddd23006e5d0 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index eeec47153937..90fb8dedf846 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -15,6 +15,7 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts deleted file mode 100644 index 3fcd08d2bc99..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/fixture.ts +++ /dev/null @@ -1,3 +0,0 @@ -enum Foo { - 1n = 2 -} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot deleted file mode 100644 index 87ba241f5d40..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/1-TSESTree-Error.shot +++ /dev/null @@ -1,9 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > TSESTree - Error`] -TSError - 1 | enum Foo { -> 2 | 1n = 2 - | ^^ An enum member cannot have a numeric name. - 3 | } - 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot deleted file mode 100644 index b3afe3afc96e..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > Babel - Error`] -BabelError - 1 | enum Foo { -> 2 | 1n = 2 - | ^ Unexpected token (2:2) - 3 | } - 4 | - diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot deleted file mode 100644 index 083d80544d72..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/bigint-name/snapshots/3-Alignment-Error.shot +++ /dev/null @@ -1,4 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > bigint-name > Error Alignment`] -Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts deleted file mode 100644 index 2e99a8d3766b..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/fixture.ts +++ /dev/null @@ -1,3 +0,0 @@ -enum Foo { - ["A"] = 2 -} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot deleted file mode 100644 index 2079fad90f2e..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/1-TSESTree-Error.shot +++ /dev/null @@ -1,9 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > TSESTree - Error`] -TSError - 1 | enum Foo { -> 2 | ["A"] = 2 - | ^^^^^ Computed property names are not allowed in enums. - 3 | } - 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot deleted file mode 100644 index c68571c79318..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > Babel - Error`] -BabelError - 1 | enum Foo { -> 2 | ["A"] = 2 - | ^ Unexpected token (2:2) - 3 | } - 4 | - diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot deleted file mode 100644 index 1331cf0d18b9..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/computed-string-name/snapshots/3-Alignment-Error.shot +++ /dev/null @@ -1,4 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > computed-string-name > Error Alignment`] -Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts deleted file mode 100644 index 174773e65995..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/fixture.ts +++ /dev/null @@ -1,3 +0,0 @@ -enum Foo { - 1 = 2 -} diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot deleted file mode 100644 index 8dfacb32e5b9..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/1-TSESTree-Error.shot +++ /dev/null @@ -1,9 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > TSESTree - Error`] -TSError - 1 | enum Foo { -> 2 | 1 = 2 - | ^ An enum member cannot have a numeric name. - 3 | } - 4 | diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot deleted file mode 100644 index 76b2f2b9c62e..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > Babel - Error`] -BabelError - 1 | enum Foo { -> 2 | 1 = 2 - | ^ Unexpected token (2:2) - 3 | } - 4 | - diff --git a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot deleted file mode 100644 index 34e6cebc91e1..000000000000 --- a/packages/ast-spec/src/element/TSEnumMember/fixtures/_error_/number-name/snapshots/3-Alignment-Error.shot +++ /dev/null @@ -1,4 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`AST Fixtures > element > TSEnumMember > _error_ > number-name > Error Alignment`] -Both errored diff --git a/packages/ast-spec/src/element/TSEnumMember/spec.ts b/packages/ast-spec/src/element/TSEnumMember/spec.ts index a4d1b836f951..a80e963ad278 100644 --- a/packages/ast-spec/src/element/TSEnumMember/spec.ts +++ b/packages/ast-spec/src/element/TSEnumMember/spec.ts @@ -1,15 +1,44 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; -import type { Identifier } from '../../expression/Identifier/spec'; -import type { StringLiteral } from '../../expression/literal/StringLiteral/spec'; import type { Expression } from '../../unions/Expression'; +import type { + PropertyNameComputed, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; -export interface TSEnumMember extends BaseNode { +interface TSEnumMemberBase extends BaseNode { type: AST_NODE_TYPES.TSEnumMember; - id: Identifier | StringLiteral; - initializer: Expression | undefined; - /** - * @deprecated the enum member is always non-computed. - */ computed: boolean; + id: + | PropertyNameComputed // this should only happen in semantically invalid code (ts error 1164) + | PropertyNameNonComputed; + initializer: Expression | undefined; +} + +/** + * this should only really happen in semantically invalid code (errors 1164 and 2452) + * + * @example + * ```ts + * // VALID: + * enum Foo { ['a'] } + * + * // INVALID: + * const x = 'a'; + * enum Foo { [x] } + * enum Bar { ['a' + 'b'] } + * ``` + */ +export interface TSEnumMemberComputedName extends TSEnumMemberBase { + computed: true; + id: PropertyNameComputed; } + +export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { + computed: false; + id: PropertyNameNonComputed; +} + +export type TSEnumMember = + | TSEnumMemberComputedName + | TSEnumMemberNonComputedName; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot index dc8d857908c8..c64aaae4a4d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-TSESTree-Error.shot @@ -1,10 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-number > TSESTree - Error`] -TSError - 2 | - 3 | export enum Foo { -> 4 | [1], - | ^^^ Computed property names are not allowed in enums. - 5 | } - 6 | +NO ERROR diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot index f9ae118971e1..f5e14d5d4b27 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-number > Error Alignment`] -Both errored +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot index 90ef25fd26d8..866743a38587 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-TSESTree-Error.shot @@ -1,10 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-string > TSESTree - Error`] -TSError - 2 | - 3 | export enum Foo { -> 4 | ['baz'], - | ^^^^^^^ Computed property names are not allowed in enums. - 5 | } - 6 | +NO ERROR diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot index 2dc13fd3d5d2..f58190aa21f3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-string > Error Alignment`] -Both errored +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot index 7e31fde5e0c7..85b95f8e17d3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-TSESTree-Error.shot @@ -1,10 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-var-ref > TSESTree - Error`] -TSError - 2 | - 3 | export enum Foo { -> 4 | [x], - | ^^^ Computed property names are not allowed in enums. - 5 | } - 6 | +NO ERROR diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot index 3909357acf22..006e3518ee1f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/3-Alignment-Error.shot @@ -1,4 +1,4 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AST Fixtures > legacy-fixtures > basics > _error_ > export-named-enum-computed-var-ref > Error Alignment`] -Both errored +Babel errored but TSESTree didn't diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot index 238113e5cc58..9187f52aade3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -40,6 +41,7 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot index 20c84325ce31..1c5c321a9cf2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot @@ -15,6 +15,7 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -80,6 +81,7 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -119,7 +121,12 @@ Snapshot Diff: - loc: { - start: { column: 15, line: 3 }, - end: { column: 1, line: 6 }, -- }, ++ range: [103, 106], ++ loc: { ++ start: { column: 2, line: 5 }, ++ end: { column: 5, line: 5 }, ++ }, + }, - }, - const: true, - declare: false, @@ -133,12 +140,7 @@ Snapshot Diff: - loc: { - start: { column: 11, line: 3 }, - end: { column: 14, line: 3 }, -+ range: [103, 106], -+ loc: { -+ start: { column: 2, line: 5 }, -+ end: { column: 5, line: 5 }, -+ }, - }, +- }, - }, + ], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot index 01c4d100b383..0a35e9756f00 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,6 +11,7 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -43,6 +44,7 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot index 603938fb4270..bc225b94ed0d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,6 +19,7 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -84,6 +85,7 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot index f946f794f043..15279e8049d7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,6 +11,7 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -43,6 +44,7 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot index eff7ba3226bd..695e866e0f98 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,6 +19,7 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -84,6 +85,7 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot index 8f42d8de69bf..b1554a6d0194 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot @@ -11,6 +11,7 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -43,6 +44,7 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot index 10c5f8d572d1..b52051becdfb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -19,6 +19,7 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -84,6 +85,7 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot index e483a20f2a29..513eb9bcd84c 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], @@ -29,6 +30,7 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", decorators: [], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot index 544b72e407c8..3c1cbd1bc2a0 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot @@ -15,6 +15,7 @@ Snapshot Diff: - members: Array [ - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], @@ -58,6 +59,7 @@ Snapshot Diff: }, - TSEnumMember { - type: 'TSEnumMember', +- computed: false, - id: Identifier { - type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index 9bbb4c97243b..006a68578577 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -27,6 +27,9 @@ exports[`AST Fixtures > List fixtures with Error differences`] "legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/const-assertions/fixture.ts", + "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/fixture.ts", + "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/fixture.ts", + "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/import-type-error/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/fixture.ts", diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 02b95a5948fc..03500d825163 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -631,10 +631,12 @@ export default createRule({ // #region interface - TSEnumMember: { - handler: (node: TSESTree.TSEnumMember, validator): void => { - // Unknown reason, can't get the correct type - const id = node.id as TSESTree.Identifier | TSESTree.StringLiteral; + 'TSEnumMember[computed != true]': { + handler: ( + node: TSESTree.TSEnumMemberNonComputedName, + validator, + ): void => { + const id = node.id; const modifiers = new Set(); if (requiresQuoting(id, compilerOptions.target)) { diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts index 89e28f163314..b592b7fe513d 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts @@ -1121,6 +1121,87 @@ ruleTester.run('no-unsafe-enum-comparison', rule, { }, ], }, + { + code: ` + enum ComputedKey { + ['test-key' /* with comment */] = 1, + } + declare const computedKey: ComputedKey; + computedKey === 1; + `, + errors: [ + { + messageId: 'mismatchedCondition', + suggestions: [ + { + messageId: 'replaceValueWithEnum', + output: ` + enum ComputedKey { + ['test-key' /* with comment */] = 1, + } + declare const computedKey: ComputedKey; + computedKey === ComputedKey['test-key']; + `, + }, + ], + }, + ], + }, + { + code: ` + enum ComputedKey { + [\`test-key\` /* with comment */] = 1, + } + declare const computedKey: ComputedKey; + computedKey === 1; + `, + errors: [ + { + messageId: 'mismatchedCondition', + suggestions: [ + { + messageId: 'replaceValueWithEnum', + output: ` + enum ComputedKey { + [\`test-key\` /* with comment */] = 1, + } + declare const computedKey: ComputedKey; + computedKey === ComputedKey[\`test-key\`]; + `, + }, + ], + }, + ], + }, + { + code: ` + enum ComputedKey { + [\`test- + key\` /* with comment */] = 1, + } + declare const computedKey: ComputedKey; + computedKey === 1; + `, + errors: [ + { + messageId: 'mismatchedCondition', + suggestions: [ + { + messageId: 'replaceValueWithEnum', + output: ` + enum ComputedKey { + [\`test- + key\` /* with comment */] = 1, + } + declare const computedKey: ComputedKey; + computedKey === ComputedKey[\`test- + key\`]; + `, + }, + ], + }, + ], + }, { code: ` enum Fruit { diff --git a/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts b/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts index f655c87e9ce2..ea670139ccb3 100644 --- a/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts @@ -54,6 +54,11 @@ enum ValidQuotedKey { ` enum ValidQuotedKeyWithAssignment { 'a' = 1, +} + `, + ` +enum ValidKeyWithComputedSyntaxButNoComputedKey { + ['a'], } `, { @@ -102,6 +107,15 @@ enum Foo { }, { code: ` +enum Foo { + ['A-1'] = 1 << 0, + C = ~Foo['A-1'], +} + `, + options: [{ allowBitwiseExpressions: true }], + }, + { + code: ` enum Foo { A = 1 << 0, B = 1 << 1, diff --git a/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts b/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts index b18e91e4872a..da5b65c8177f 100644 --- a/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts +++ b/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts @@ -2281,6 +2281,46 @@ switch (value) { }, ], }, + { + code: ` + enum Enum { + 'a' = 1, + [\`key-with + + new-line\`] = 2, + } + + declare const a: Enum; + + switch (a) { + } + `, + errors: [ + { + messageId: 'switchIsNotExhaustive', + suggestions: [ + { + messageId: 'addMissingCases', + output: ` + enum Enum { + 'a' = 1, + [\`key-with + + new-line\`] = 2, + } + + declare const a: Enum; + + switch (a) { + case Enum.a: { throw new Error('Not implemented yet: Enum.a case') } + case Enum['key-with\\n\\n new-line']: { throw new Error('Not implemented yet: Enum[\\'key-with\\\\n\\\\n new-line\\'] case') } + } + `, + }, + ], + }, + ], + }, { code: noFormat` enum Enum { diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 562921170751..1f621d8f7823 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -668,7 +668,10 @@ export class Referencer extends Visitor { name, new TSEnumMemberDefinition(name, member), ); - } else if (member.id.type === AST_NODE_TYPES.Identifier) { + } else if ( + !member.computed && + member.id.type === AST_NODE_TYPES.Identifier + ) { this.currentScope().defineIdentifier( member.id, new TSEnumMemberDefinition(member.id, member), diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 150c0ee950ea..dccb674537c6 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -476,7 +476,7 @@ export class Converter { >( node: Properties, deprecatedKey: Key, - preferredKey: string | undefined, + preferredKey: string, value: Value, ): Properties & Record { let warned = false; @@ -487,13 +487,10 @@ export class Converter { ? (): Value => value : (): Value => { if (!warned) { - let message = `The '${deprecatedKey}' property is deprecated on ${node.type} nodes.`; - if (preferredKey) { - message += ` Use ${preferredKey} instead.`; - } - message += - ' See https://typescript-eslint.io/troubleshooting/faqs/general#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.'; - process.emitWarning(message, 'DeprecationWarning'); + process.emitWarning( + `The '${deprecatedKey}' property is deprecated on ${node.type} nodes. Use ${preferredKey} instead. See https://typescript-eslint.io/troubleshooting/faqs/general#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.`, + 'DeprecationWarning', + ); warned = true; } @@ -3266,38 +3263,12 @@ export class Converter { } case SyntaxKind.EnumMember: { - const computed = node.name.kind === ts.SyntaxKind.ComputedPropertyName; - if (computed) { - this.#throwUnlessAllowInvalidAST( - node.name, - 'Computed property names are not allowed in enums.', - ); - } - - if ( - node.name.kind === SyntaxKind.NumericLiteral || - node.name.kind === SyntaxKind.BigIntLiteral - ) { - this.#throwUnlessAllowInvalidAST( - node.name, - 'An enum member cannot have a numeric name.', - ); - } - - return this.createNode( - node, - this.#withDeprecatedGetter( - { - type: AST_NODE_TYPES.TSEnumMember, - id: this.convertChild(node.name), - initializer: - node.initializer && this.convertChild(node.initializer), - }, - 'computed', - undefined, - computed, - ), - ); + return this.createNode(node, { + type: AST_NODE_TYPES.TSEnumMember, + computed: node.name.kind === ts.SyntaxKind.ComputedPropertyName, + id: this.convertChild(node.name), + initializer: node.initializer && this.convertChild(node.initializer), + }); } case SyntaxKind.ModuleDeclaration: { From 60c3b26317578b03bf64d8194488ba948c1b05bb Mon Sep 17 00:00:00 2001 From: "typescript-eslint[bot]" Date: Mon, 18 Aug 2025 17:20:55 +0000 Subject: [PATCH 8/8] chore(release): publish 8.40.0 --- CHANGELOG.md | 20 ++++ packages/ast-spec/CHANGELOG.md | 17 ++++ packages/ast-spec/package.json | 2 +- packages/eslint-plugin/CHANGELOG.md | 12 +++ packages/eslint-plugin/package.json | 16 +-- packages/parser/CHANGELOG.md | 6 ++ packages/parser/package.json | 10 +- packages/project-service/CHANGELOG.md | 6 ++ packages/project-service/package.json | 6 +- .../CHANGELOG.md | 6 ++ .../package.json | 6 +- packages/rule-tester/CHANGELOG.md | 6 ++ packages/rule-tester/package.json | 8 +- packages/scope-manager/CHANGELOG.md | 12 +++ packages/scope-manager/package.json | 8 +- packages/tsconfig-utils/CHANGELOG.md | 6 ++ packages/tsconfig-utils/package.json | 2 +- packages/type-utils/CHANGELOG.md | 6 ++ packages/type-utils/package.json | 10 +- packages/types/CHANGELOG.md | 6 ++ packages/types/package.json | 2 +- packages/typescript-eslint/CHANGELOG.md | 12 +++ packages/typescript-eslint/package.json | 10 +- packages/typescript-estree/CHANGELOG.md | 17 ++++ packages/typescript-estree/package.json | 10 +- packages/utils/CHANGELOG.md | 12 +++ packages/utils/package.json | 8 +- packages/visitor-keys/CHANGELOG.md | 6 ++ packages/visitor-keys/package.json | 4 +- yarn.lock | 98 +++++++++---------- 30 files changed, 250 insertions(+), 100 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57e55a765b43..e3f19a841802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### 🩹 Fixes + +- **typescript-eslint:** export `plugin`, `parser`, and `configs` that are compatible with both `defineConfig()` and `tseslint.config()` ([#11475](https://github.com/typescript-eslint/typescript-eslint/pull/11475)) +- **typescript-estree:** correct range of import assertion with trailing comma ([#11478](https://github.com/typescript-eslint/typescript-eslint/pull/11478)) +- **utils:** correct `calculateConfigForFile` return type ([#11451](https://github.com/typescript-eslint/typescript-eslint/pull/11451)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Kirk Waiblinger @kirkwaiblinger +- Nolan Gajdascz @Gajdascz + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) ### 🩹 Fixes diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index fd00cc97cc72..5041687ce5a6 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -1,3 +1,20 @@ +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### 🩹 Fixes + +- **typescript-estree:** correct range of import assertion with trailing comma ([#11478](https://github.com/typescript-eslint/typescript-eslint/pull/11478)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for ast-spec to align it with other projects, there were no code changes. diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 48147e62e3d0..ba03ff05d456 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "8.39.1", + "version": "8.40.0", "description": "Complete specification for the TypeScript-ESTree AST", "private": true, "keywords": [ diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 24ac0116feb4..89976c5c01fc 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -1,3 +1,15 @@ +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### ❤️ Thank You + +- fisker Cheung @fisker + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for eslint-plugin to align it with other projects, there were no code changes. diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 6debdd1e1a5e..e38ecf7a466e 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "8.39.1", + "version": "8.40.0", "description": "TypeScript plugin for ESLint", "files": [ "dist", @@ -59,10 +59,10 @@ }, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.39.1", - "@typescript-eslint/type-utils": "8.39.1", - "@typescript-eslint/utils": "8.39.1", - "@typescript-eslint/visitor-keys": "8.39.1", + "@typescript-eslint/scope-manager": "8.40.0", + "@typescript-eslint/type-utils": "8.40.0", + "@typescript-eslint/utils": "8.40.0", + "@typescript-eslint/visitor-keys": "8.40.0", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", @@ -71,8 +71,8 @@ "devDependencies": { "@types/mdast": "^4.0.3", "@types/natural-compare": "*", - "@typescript-eslint/rule-schema-to-typescript-types": "8.39.1", - "@typescript-eslint/rule-tester": "8.39.1", + "@typescript-eslint/rule-schema-to-typescript-types": "8.40.0", + "@typescript-eslint/rule-tester": "8.40.0", "@vitest/coverage-v8": "^3.1.3", "ajv": "^6.12.6", "cross-fetch": "*", @@ -92,7 +92,7 @@ "vitest": "^3.1.3" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.39.1", + "@typescript-eslint/parser": "^8.40.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" }, diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index f19df12f2a18..76a784632769 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.40.0 (2025-08-18) + +This was a version bump only for parser to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for parser to align it with other projects, there were no code changes. diff --git a/packages/parser/package.json b/packages/parser/package.json index 0bb48c178d8c..707c22d668e5 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "8.39.1", + "version": "8.40.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "files": [ "dist", @@ -51,10 +51,10 @@ "typescript": ">=4.8.4 <6.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "8.39.1", - "@typescript-eslint/types": "8.39.1", - "@typescript-eslint/typescript-estree": "8.39.1", - "@typescript-eslint/visitor-keys": "8.39.1", + "@typescript-eslint/scope-manager": "8.40.0", + "@typescript-eslint/types": "8.40.0", + "@typescript-eslint/typescript-estree": "8.40.0", + "@typescript-eslint/visitor-keys": "8.40.0", "debug": "^4.3.4" }, "devDependencies": { diff --git a/packages/project-service/CHANGELOG.md b/packages/project-service/CHANGELOG.md index 6fbea812651d..811569e0c179 100644 --- a/packages/project-service/CHANGELOG.md +++ b/packages/project-service/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.40.0 (2025-08-18) + +This was a version bump only for project-service to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for project-service to align it with other projects, there were no code changes. diff --git a/packages/project-service/package.json b/packages/project-service/package.json index 56464567bd10..6baf59992728 100644 --- a/packages/project-service/package.json +++ b/packages/project-service/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/project-service", - "version": "8.39.1", + "version": "8.40.0", "description": "Standalone TypeScript project service wrapper for linting.", "files": [ "dist", @@ -49,8 +49,8 @@ "typescript": ">=4.8.4 <6.0.0" }, "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.39.1", - "@typescript-eslint/types": "^8.39.1", + "@typescript-eslint/tsconfig-utils": "^8.40.0", + "@typescript-eslint/types": "^8.40.0", "debug": "^4.3.4" }, "devDependencies": { diff --git a/packages/rule-schema-to-typescript-types/CHANGELOG.md b/packages/rule-schema-to-typescript-types/CHANGELOG.md index ecea6871fe2a..7fe444510994 100644 --- a/packages/rule-schema-to-typescript-types/CHANGELOG.md +++ b/packages/rule-schema-to-typescript-types/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.40.0 (2025-08-18) + +This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for rule-schema-to-typescript-types to align it with other projects, there were no code changes. diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index b1ba2cd63c84..74d9ffd401e3 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/rule-schema-to-typescript-types", - "version": "8.39.1", + "version": "8.40.0", "private": true, "type": "commonjs", "exports": { @@ -32,8 +32,8 @@ "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/type-utils": "8.39.1", - "@typescript-eslint/utils": "8.39.1", + "@typescript-eslint/type-utils": "8.40.0", + "@typescript-eslint/utils": "8.40.0", "natural-compare": "^1.4.0", "prettier": "3.5.0" }, diff --git a/packages/rule-tester/CHANGELOG.md b/packages/rule-tester/CHANGELOG.md index 1fdacfbe49ae..029a948a3158 100644 --- a/packages/rule-tester/CHANGELOG.md +++ b/packages/rule-tester/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.40.0 (2025-08-18) + +This was a version bump only for rule-tester to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for rule-tester to align it with other projects, there were no code changes. diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json index 1ff1435f1b93..775673b300bf 100644 --- a/packages/rule-tester/package.json +++ b/packages/rule-tester/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/rule-tester", - "version": "8.39.1", + "version": "8.40.0", "description": "Tooling to test ESLint rules", "files": [ "dist", @@ -44,9 +44,9 @@ }, "//": "NOTE - AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70", "dependencies": { - "@typescript-eslint/parser": "8.39.1", - "@typescript-eslint/typescript-estree": "8.39.1", - "@typescript-eslint/utils": "8.39.1", + "@typescript-eslint/parser": "8.40.0", + "@typescript-eslint/typescript-estree": "8.40.0", + "@typescript-eslint/utils": "8.40.0", "ajv": "^6.12.6", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "4.6.2", diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 9ccb2753903d..d8c7ed5095b8 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -1,3 +1,15 @@ +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### ❤️ Thank You + +- fisker Cheung @fisker + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for scope-manager to align it with other projects, there were no code changes. diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 49219d37ac2f..2daecf078fd1 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "8.39.1", + "version": "8.40.0", "description": "TypeScript scope analyser for ESLint", "files": [ "dist", @@ -47,11 +47,11 @@ "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "8.39.1", - "@typescript-eslint/visitor-keys": "8.39.1" + "@typescript-eslint/types": "8.40.0", + "@typescript-eslint/visitor-keys": "8.40.0" }, "devDependencies": { - "@typescript-eslint/typescript-estree": "8.39.1", + "@typescript-eslint/typescript-estree": "8.40.0", "@vitest/coverage-v8": "^3.1.3", "@vitest/pretty-format": "^3.1.3", "eslint": "*", diff --git a/packages/tsconfig-utils/CHANGELOG.md b/packages/tsconfig-utils/CHANGELOG.md index 783df6985837..0550c29f4279 100644 --- a/packages/tsconfig-utils/CHANGELOG.md +++ b/packages/tsconfig-utils/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.40.0 (2025-08-18) + +This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for tsconfig-utils to align it with other projects, there were no code changes. diff --git a/packages/tsconfig-utils/package.json b/packages/tsconfig-utils/package.json index 1c6e4c444027..e0a2b8a748ab 100644 --- a/packages/tsconfig-utils/package.json +++ b/packages/tsconfig-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/tsconfig-utils", - "version": "8.39.1", + "version": "8.40.0", "description": "Utilities for collecting TSConfigs for linting scenarios.", "files": [ "dist", diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index c9292049ad18..d1d563254aa8 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.40.0 (2025-08-18) + +This was a version bump only for type-utils to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for type-utils to align it with other projects, there were no code changes. diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index bfd97dce816a..759fb48e783b 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "8.39.1", + "version": "8.40.0", "description": "Type utilities for working with TypeScript + ESLint together", "files": [ "dist", @@ -44,9 +44,9 @@ "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "8.39.1", - "@typescript-eslint/typescript-estree": "8.39.1", - "@typescript-eslint/utils": "8.39.1", + "@typescript-eslint/types": "8.40.0", + "@typescript-eslint/typescript-estree": "8.40.0", + "@typescript-eslint/utils": "8.40.0", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, @@ -55,7 +55,7 @@ "typescript": ">=4.8.4 <6.0.0" }, "devDependencies": { - "@typescript-eslint/parser": "8.39.1", + "@typescript-eslint/parser": "8.40.0", "@vitest/coverage-v8": "^3.1.3", "ajv": "^6.12.6", "eslint": "*", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 17a80e1bed35..362312d7b36c 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.40.0 (2025-08-18) + +This was a version bump only for types to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for types to align it with other projects, there were no code changes. diff --git a/packages/types/package.json b/packages/types/package.json index a6489918ae2d..e00fed13b14b 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "8.39.1", + "version": "8.40.0", "description": "Types for the TypeScript-ESTree AST spec", "files": [ "dist", diff --git a/packages/typescript-eslint/CHANGELOG.md b/packages/typescript-eslint/CHANGELOG.md index 979cbed223be..581ca1d10193 100644 --- a/packages/typescript-eslint/CHANGELOG.md +++ b/packages/typescript-eslint/CHANGELOG.md @@ -1,3 +1,15 @@ +## 8.40.0 (2025-08-18) + +### 🩹 Fixes + +- **typescript-eslint:** export `plugin`, `parser`, and `configs` that are compatible with both `defineConfig()` and `tseslint.config()` ([#11475](https://github.com/typescript-eslint/typescript-eslint/pull/11475)) + +### ❤️ Thank You + +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) ### 🩹 Fixes diff --git a/packages/typescript-eslint/package.json b/packages/typescript-eslint/package.json index ed9e55806bd5..f3249437d2ba 100644 --- a/packages/typescript-eslint/package.json +++ b/packages/typescript-eslint/package.json @@ -1,6 +1,6 @@ { "name": "typescript-eslint", - "version": "8.39.1", + "version": "8.40.0", "description": "Tooling which enables you to use TypeScript with ESLint", "files": [ "dist", @@ -50,10 +50,10 @@ "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/eslint-plugin": "8.39.1", - "@typescript-eslint/parser": "8.39.1", - "@typescript-eslint/typescript-estree": "8.39.1", - "@typescript-eslint/utils": "8.39.1" + "@typescript-eslint/eslint-plugin": "8.40.0", + "@typescript-eslint/parser": "8.40.0", + "@typescript-eslint/typescript-estree": "8.40.0", + "@typescript-eslint/utils": "8.40.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 2259c1b5c99b..89ae1dd46852 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -1,3 +1,20 @@ +## 8.40.0 (2025-08-18) + +### 🚀 Features + +- **typescript-estree:** forbid invalid keys in `EnumMember` ([#11232](https://github.com/typescript-eslint/typescript-eslint/pull/11232)) + +### 🩹 Fixes + +- **typescript-estree:** correct range of import assertion with trailing comma ([#11478](https://github.com/typescript-eslint/typescript-eslint/pull/11478)) + +### ❤️ Thank You + +- fisker Cheung @fisker +- Kirk Waiblinger @kirkwaiblinger + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for typescript-estree to align it with other projects, there were no code changes. diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index a929aa530543..01df8590e4c4 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "8.39.1", + "version": "8.40.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "files": [ "dist", @@ -52,10 +52,10 @@ "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/project-service": "8.39.1", - "@typescript-eslint/tsconfig-utils": "8.39.1", - "@typescript-eslint/types": "8.39.1", - "@typescript-eslint/visitor-keys": "8.39.1", + "@typescript-eslint/project-service": "8.40.0", + "@typescript-eslint/tsconfig-utils": "8.40.0", + "@typescript-eslint/types": "8.40.0", + "@typescript-eslint/visitor-keys": "8.40.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index ec6a8e9a2a20..4eb5650e43aa 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,3 +1,15 @@ +## 8.40.0 (2025-08-18) + +### 🩹 Fixes + +- **utils:** correct `calculateConfigForFile` return type ([#11451](https://github.com/typescript-eslint/typescript-eslint/pull/11451)) + +### ❤️ Thank You + +- Nolan Gajdascz @Gajdascz + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for utils to align it with other projects, there were no code changes. diff --git a/packages/utils/package.json b/packages/utils/package.json index 15879bb746d4..d3549db2065c 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "8.39.1", + "version": "8.40.0", "description": "Utilities for working with TypeScript + ESLint together", "files": [ "dist", @@ -62,9 +62,9 @@ }, "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.39.1", - "@typescript-eslint/types": "8.39.1", - "@typescript-eslint/typescript-estree": "8.39.1" + "@typescript-eslint/scope-manager": "8.40.0", + "@typescript-eslint/types": "8.40.0", + "@typescript-eslint/typescript-estree": "8.40.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 3625a7072bfa..cb5c5f0f33d3 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.40.0 (2025-08-18) + +This was a version bump only for visitor-keys to align it with other projects, there were no code changes. + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + ## 8.39.1 (2025-08-11) This was a version bump only for visitor-keys to align it with other projects, there were no code changes. diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 5adf5c665663..6c4e73577c20 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "8.39.1", + "version": "8.40.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "files": [ "dist", @@ -45,7 +45,7 @@ "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "8.39.1", + "@typescript-eslint/types": "8.40.0", "eslint-visitor-keys": "^4.2.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 29bee77daa40..485535c6e770 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5955,19 +5955,19 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/eslint-plugin@8.39.1, @typescript-eslint/eslint-plugin@workspace:*, @typescript-eslint/eslint-plugin@workspace:^, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": +"@typescript-eslint/eslint-plugin@8.40.0, @typescript-eslint/eslint-plugin@workspace:*, @typescript-eslint/eslint-plugin@workspace:^, @typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin": version: 0.0.0-use.local resolution: "@typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin" dependencies: "@eslint-community/regexpp": ^4.10.0 "@types/mdast": ^4.0.3 "@types/natural-compare": "*" - "@typescript-eslint/rule-schema-to-typescript-types": 8.39.1 - "@typescript-eslint/rule-tester": 8.39.1 - "@typescript-eslint/scope-manager": 8.39.1 - "@typescript-eslint/type-utils": 8.39.1 - "@typescript-eslint/utils": 8.39.1 - "@typescript-eslint/visitor-keys": 8.39.1 + "@typescript-eslint/rule-schema-to-typescript-types": 8.40.0 + "@typescript-eslint/rule-tester": 8.40.0 + "@typescript-eslint/scope-manager": 8.40.0 + "@typescript-eslint/type-utils": 8.40.0 + "@typescript-eslint/utils": 8.40.0 + "@typescript-eslint/visitor-keys": 8.40.0 "@vitest/coverage-v8": ^3.1.3 ajv: ^6.12.6 cross-fetch: "*" @@ -5990,7 +5990,7 @@ __metadata: unist-util-visit: ^5.0.0 vitest: ^3.1.3 peerDependencies: - "@typescript-eslint/parser": ^8.39.1 + "@typescript-eslint/parser": ^8.40.0 eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" languageName: unknown @@ -6006,14 +6006,14 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/parser@8.39.1, @typescript-eslint/parser@workspace:*, @typescript-eslint/parser@workspace:^, @typescript-eslint/parser@workspace:packages/parser": +"@typescript-eslint/parser@8.40.0, @typescript-eslint/parser@workspace:*, @typescript-eslint/parser@workspace:^, @typescript-eslint/parser@workspace:packages/parser": version: 0.0.0-use.local resolution: "@typescript-eslint/parser@workspace:packages/parser" dependencies: - "@typescript-eslint/scope-manager": 8.39.1 - "@typescript-eslint/types": 8.39.1 - "@typescript-eslint/typescript-estree": 8.39.1 - "@typescript-eslint/visitor-keys": 8.39.1 + "@typescript-eslint/scope-manager": 8.40.0 + "@typescript-eslint/types": 8.40.0 + "@typescript-eslint/typescript-estree": 8.40.0 + "@typescript-eslint/visitor-keys": 8.40.0 "@vitest/coverage-v8": ^3.1.3 debug: ^4.3.4 eslint: "*" @@ -6027,12 +6027,12 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/project-service@8.39.1, @typescript-eslint/project-service@workspace:packages/project-service": +"@typescript-eslint/project-service@8.40.0, @typescript-eslint/project-service@workspace:packages/project-service": version: 0.0.0-use.local resolution: "@typescript-eslint/project-service@workspace:packages/project-service" dependencies: - "@typescript-eslint/tsconfig-utils": ^8.39.1 - "@typescript-eslint/types": ^8.39.1 + "@typescript-eslint/tsconfig-utils": ^8.40.0 + "@typescript-eslint/types": ^8.40.0 "@vitest/coverage-v8": ^3.1.3 debug: ^4.3.4 rimraf: "*" @@ -6043,12 +6043,12 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/rule-schema-to-typescript-types@8.39.1, @typescript-eslint/rule-schema-to-typescript-types@workspace:*, @typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types": +"@typescript-eslint/rule-schema-to-typescript-types@8.40.0, @typescript-eslint/rule-schema-to-typescript-types@workspace:*, @typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types": version: 0.0.0-use.local resolution: "@typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types" dependencies: - "@typescript-eslint/type-utils": 8.39.1 - "@typescript-eslint/utils": 8.39.1 + "@typescript-eslint/type-utils": 8.40.0 + "@typescript-eslint/utils": 8.40.0 "@vitest/coverage-v8": ^3.1.3 eslint: "*" natural-compare: ^1.4.0 @@ -6059,15 +6059,15 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/rule-tester@8.39.1, @typescript-eslint/rule-tester@workspace:*, @typescript-eslint/rule-tester@workspace:packages/rule-tester": +"@typescript-eslint/rule-tester@8.40.0, @typescript-eslint/rule-tester@workspace:*, @typescript-eslint/rule-tester@workspace:packages/rule-tester": version: 0.0.0-use.local resolution: "@typescript-eslint/rule-tester@workspace:packages/rule-tester" dependencies: "@types/json-stable-stringify-without-jsonify": ^1.0.2 "@types/lodash.merge": 4.6.9 - "@typescript-eslint/parser": 8.39.1 - "@typescript-eslint/typescript-estree": 8.39.1 - "@typescript-eslint/utils": 8.39.1 + "@typescript-eslint/parser": 8.40.0 + "@typescript-eslint/typescript-estree": 8.40.0 + "@typescript-eslint/utils": 8.40.0 "@vitest/coverage-v8": ^3.1.3 ajv: ^6.12.6 eslint: "*" @@ -6082,13 +6082,13 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/scope-manager@8.39.1, @typescript-eslint/scope-manager@workspace:*, @typescript-eslint/scope-manager@workspace:^, @typescript-eslint/scope-manager@workspace:packages/scope-manager": +"@typescript-eslint/scope-manager@8.40.0, @typescript-eslint/scope-manager@workspace:*, @typescript-eslint/scope-manager@workspace:^, @typescript-eslint/scope-manager@workspace:packages/scope-manager": version: 0.0.0-use.local resolution: "@typescript-eslint/scope-manager@workspace:packages/scope-manager" dependencies: - "@typescript-eslint/types": 8.39.1 - "@typescript-eslint/typescript-estree": 8.39.1 - "@typescript-eslint/visitor-keys": 8.39.1 + "@typescript-eslint/types": 8.40.0 + "@typescript-eslint/typescript-estree": 8.40.0 + "@typescript-eslint/visitor-keys": 8.40.0 "@vitest/coverage-v8": ^3.1.3 "@vitest/pretty-format": ^3.1.3 eslint: "*" @@ -6099,7 +6099,7 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/tsconfig-utils@8.39.1, @typescript-eslint/tsconfig-utils@^8.39.1, @typescript-eslint/tsconfig-utils@workspace:packages/tsconfig-utils": +"@typescript-eslint/tsconfig-utils@8.40.0, @typescript-eslint/tsconfig-utils@^8.40.0, @typescript-eslint/tsconfig-utils@workspace:packages/tsconfig-utils": version: 0.0.0-use.local resolution: "@typescript-eslint/tsconfig-utils@workspace:packages/tsconfig-utils" dependencies: @@ -6112,14 +6112,14 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/type-utils@8.39.1, @typescript-eslint/type-utils@workspace:*, @typescript-eslint/type-utils@workspace:packages/type-utils": +"@typescript-eslint/type-utils@8.40.0, @typescript-eslint/type-utils@workspace:*, @typescript-eslint/type-utils@workspace:packages/type-utils": version: 0.0.0-use.local resolution: "@typescript-eslint/type-utils@workspace:packages/type-utils" dependencies: - "@typescript-eslint/parser": 8.39.1 - "@typescript-eslint/types": 8.39.1 - "@typescript-eslint/typescript-estree": 8.39.1 - "@typescript-eslint/utils": 8.39.1 + "@typescript-eslint/parser": 8.40.0 + "@typescript-eslint/types": 8.40.0 + "@typescript-eslint/typescript-estree": 8.40.0 + "@typescript-eslint/utils": 8.40.0 "@vitest/coverage-v8": ^3.1.3 ajv: ^6.12.6 debug: ^4.3.4 @@ -6134,7 +6134,7 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/types@8.39.1, @typescript-eslint/types@^8.32.1, @typescript-eslint/types@^8.39.1, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": +"@typescript-eslint/types@8.40.0, @typescript-eslint/types@^8.32.1, @typescript-eslint/types@^8.40.0, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": version: 0.0.0-use.local resolution: "@typescript-eslint/types@workspace:packages/types" dependencies: @@ -6207,15 +6207,15 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/typescript-estree@8.39.1, @typescript-eslint/typescript-estree@workspace:*, @typescript-eslint/typescript-estree@workspace:^, @typescript-eslint/typescript-estree@workspace:packages/typescript-estree": +"@typescript-eslint/typescript-estree@8.40.0, @typescript-eslint/typescript-estree@workspace:*, @typescript-eslint/typescript-estree@workspace:^, @typescript-eslint/typescript-estree@workspace:packages/typescript-estree": version: 0.0.0-use.local resolution: "@typescript-eslint/typescript-estree@workspace:packages/typescript-estree" dependencies: "@types/is-glob": ^4.0.4 - "@typescript-eslint/project-service": 8.39.1 - "@typescript-eslint/tsconfig-utils": 8.39.1 - "@typescript-eslint/types": 8.39.1 - "@typescript-eslint/visitor-keys": 8.39.1 + "@typescript-eslint/project-service": 8.40.0 + "@typescript-eslint/tsconfig-utils": 8.40.0 + "@typescript-eslint/types": 8.40.0 + "@typescript-eslint/visitor-keys": 8.40.0 "@vitest/coverage-v8": ^3.1.3 debug: ^4.3.4 eslint: "*" @@ -6233,14 +6233,14 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/utils@8.39.1, @typescript-eslint/utils@^8.24.0, @typescript-eslint/utils@^8.32.1, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": +"@typescript-eslint/utils@8.40.0, @typescript-eslint/utils@^8.24.0, @typescript-eslint/utils@^8.32.1, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@typescript-eslint/utils@workspace:packages/utils" dependencies: "@eslint-community/eslint-utils": ^4.7.0 - "@typescript-eslint/scope-manager": 8.39.1 - "@typescript-eslint/types": 8.39.1 - "@typescript-eslint/typescript-estree": 8.39.1 + "@typescript-eslint/scope-manager": 8.40.0 + "@typescript-eslint/types": 8.40.0 + "@typescript-eslint/typescript-estree": 8.40.0 "@vitest/coverage-v8": ^3.1.3 eslint: "*" rimraf: "*" @@ -6252,11 +6252,11 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/visitor-keys@8.39.1, @typescript-eslint/visitor-keys@workspace:*, @typescript-eslint/visitor-keys@workspace:packages/visitor-keys": +"@typescript-eslint/visitor-keys@8.40.0, @typescript-eslint/visitor-keys@workspace:*, @typescript-eslint/visitor-keys@workspace:packages/visitor-keys": version: 0.0.0-use.local resolution: "@typescript-eslint/visitor-keys@workspace:packages/visitor-keys" dependencies: - "@typescript-eslint/types": 8.39.1 + "@typescript-eslint/types": 8.40.0 "@vitest/coverage-v8": ^3.1.3 eslint: "*" eslint-visitor-keys: ^4.2.1 @@ -19801,10 +19801,10 @@ __metadata: version: 0.0.0-use.local resolution: "typescript-eslint@workspace:packages/typescript-eslint" dependencies: - "@typescript-eslint/eslint-plugin": 8.39.1 - "@typescript-eslint/parser": 8.39.1 - "@typescript-eslint/typescript-estree": 8.39.1 - "@typescript-eslint/utils": 8.39.1 + "@typescript-eslint/eslint-plugin": 8.40.0 + "@typescript-eslint/parser": 8.40.0 + "@typescript-eslint/typescript-estree": 8.40.0 + "@typescript-eslint/utils": 8.40.0 "@vitest/coverage-v8": ^3.1.3 eslint: "*" rimraf: "*"