From 94ab803feee341fb3ddecb881a214a7e6d2c5d6d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Oct 2025 13:54:14 +0800 Subject: [PATCH] Update typescript-eslint to v8.46.0 (#18012) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: fisker --- package.json | 8 +- .../__snapshots__/format.test.js.snap | 53 +++++++ .../format.test.js | 20 +++ .../__snapshots__/format.test.js.snap | 27 ++++ .../format.test.js | 15 ++ .../__snapshots__/format.test.js.snap | 20 +++ .../typescript/modifiers/format.test.js | 4 + yarn.lock | 136 +++++++++--------- 8 files changed, 211 insertions(+), 72 deletions(-) create mode 100644 tests/format/misc/errors/typescript/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap create mode 100644 tests/format/misc/errors/typescript/abstract-accessor-with-implementation/format.test.js create mode 100644 tests/format/misc/errors/typescript/abstract-method-with-implementation/__snapshots__/format.test.js.snap create mode 100644 tests/format/misc/errors/typescript/abstract-method-with-implementation/format.test.js diff --git a/package.json b/package.json index 4848cb0ef..aafa38d23 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,8 @@ "@prettier/html-event-attributes": "0.0.1", "@prettier/html-tags": "1.1.0", "@prettier/parse-srcset": "3.1.0", - "@typescript-eslint/typescript-estree": "8.45.0", - "@typescript-eslint/visitor-keys": "8.45.0", + "@typescript-eslint/typescript-estree": "8.46.0", + "@typescript-eslint/visitor-keys": "8.46.0", "acorn": "8.15.0", "acorn-jsx": "5.3.2", "angular-estree-parser": "13.0.2", @@ -128,8 +128,8 @@ "@eslint/js": "9.35.0", "@stylistic/eslint-plugin": "5.3.1", "@types/estree": "1.0.8", - "@typescript-eslint/eslint-plugin": "8.45.0", - "@typescript-eslint/parser": "8.45.0", + "@typescript-eslint/eslint-plugin": "8.46.0", + "@typescript-eslint/parser": "8.46.0", "browserslist": "4.26.2", "browserslist-to-esbuild": "2.1.1", "buffer": "6.0.3", diff --git a/tests/format/misc/errors/typescript/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap b/tests/format/misc/errors/typescript/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap new file mode 100644 index 000000000..5e99b0ff6 --- /dev/null +++ b/tests/format/misc/errors/typescript/abstract-accessor-with-implementation/__snapshots__/format.test.js.snap @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`snippet: #0 [babel-ts] format 1`] = ` +"Method 'getter' cannot have an implementation because it is marked abstract. (2:3) + 1 | abstract class Foo { +> 2 | abstract get getter() { } + | ^ + 3 | } +Cause: Method 'getter' cannot have an implementation because it is marked abstract. (2:2)" +`; + +exports[`snippet: #0 [oxc-ts] format 1`] = ` +"Accessor 'getter' cannot have an implementation because it is marked abstract. (2:16) + 1 | abstract class Foo { +> 2 | abstract get getter() { } + | ^^^^^^ + 3 | }" +`; + +exports[`snippet: #0 [typescript] format 1`] = ` +"An abstract accessor cannot have an implementation. (2:16) + 1 | abstract class Foo { +> 2 | abstract get getter() { } + | ^^^^^^ + 3 | } +Cause: An abstract accessor cannot have an implementation." +`; + +exports[`snippet: #1 [babel-ts] format 1`] = ` +"Method 'setter' cannot have an implementation because it is marked abstract. (2:3) + 1 | abstract class Foo { +> 2 | abstract set setter(v) { } + | ^ + 3 | } +Cause: Method 'setter' cannot have an implementation because it is marked abstract. (2:2)" +`; + +exports[`snippet: #1 [oxc-ts] format 1`] = ` +"Accessor 'setter' cannot have an implementation because it is marked abstract. (2:16) + 1 | abstract class Foo { +> 2 | abstract set setter(v) { } + | ^^^^^^ + 3 | }" +`; + +exports[`snippet: #1 [typescript] format 1`] = ` +"An abstract accessor cannot have an implementation. (2:16) + 1 | abstract class Foo { +> 2 | abstract set setter(v) { } + | ^^^^^^ + 3 | } +Cause: An abstract accessor cannot have an implementation." +`; diff --git a/tests/format/misc/errors/typescript/abstract-accessor-with-implementation/format.test.js b/tests/format/misc/errors/typescript/abstract-accessor-with-implementation/format.test.js new file mode 100644 index 000000000..83b8d15f4 --- /dev/null +++ b/tests/format/misc/errors/typescript/abstract-accessor-with-implementation/format.test.js @@ -0,0 +1,20 @@ +import { outdent } from "outdent"; + +runFormatTest( + { + importMeta: import.meta, + snippets: [ + outdent` + abstract class Foo { + abstract get getter() { } + } + `, + outdent` + abstract class Foo { + abstract set setter(v) { } + } + `, + ], + }, + ["babel-ts", "typescript", "oxc-ts"], +); diff --git a/tests/format/misc/errors/typescript/abstract-method-with-implementation/__snapshots__/format.test.js.snap b/tests/format/misc/errors/typescript/abstract-method-with-implementation/__snapshots__/format.test.js.snap new file mode 100644 index 000000000..524cfdbf6 --- /dev/null +++ b/tests/format/misc/errors/typescript/abstract-method-with-implementation/__snapshots__/format.test.js.snap @@ -0,0 +1,27 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`snippet: #0 [babel-ts] format 1`] = ` +"Method 'method' cannot have an implementation because it is marked abstract. (2:3) + 1 | abstract class Foo { +> 2 | abstract method() { } + | ^ + 3 | } +Cause: Method 'method' cannot have an implementation because it is marked abstract. (2:2)" +`; + +exports[`snippet: #0 [oxc-ts] format 1`] = ` +"Method 'method' cannot have an implementation because it is marked abstract. (2:12) + 1 | abstract class Foo { +> 2 | abstract method() { } + | ^^^^^^ + 3 | }" +`; + +exports[`snippet: #0 [typescript] format 1`] = ` +"Method 'method' cannot have an implementation because it is marked abstract. (2:12) + 1 | abstract class Foo { +> 2 | abstract method() { } + | ^^^^^^ + 3 | } +Cause: Method 'method' cannot have an implementation because it is marked abstract." +`; diff --git a/tests/format/misc/errors/typescript/abstract-method-with-implementation/format.test.js b/tests/format/misc/errors/typescript/abstract-method-with-implementation/format.test.js new file mode 100644 index 000000000..ab4c2f0d9 --- /dev/null +++ b/tests/format/misc/errors/typescript/abstract-method-with-implementation/format.test.js @@ -0,0 +1,15 @@ +import { outdent } from "outdent"; + +runFormatTest( + { + importMeta: import.meta, + snippets: [ + outdent` + abstract class Foo { + abstract method() { } + } + `, + ], + }, + ["babel-ts", "typescript", "oxc-ts"], +); diff --git a/tests/format/misc/errors/typescript/modifiers/__snapshots__/format.test.js.snap b/tests/format/misc/errors/typescript/modifiers/__snapshots__/format.test.js.snap index 052bca72e..cdf5f3fd3 100644 --- a/tests/format/misc/errors/typescript/modifiers/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/typescript/modifiers/__snapshots__/format.test.js.snap @@ -4031,3 +4031,23 @@ exports[`snippet: #182 [typescript] format 1`] = ` 3 | } Cause: 'declare' modifier cannot appear on an index signature" `; + +exports[`snippet: #183 [babel-ts] format 1`] = ` +"Unexpected token, expected "," (1:12) +> 1 | ({abstract method(){}}) + | ^ +Cause: Unexpected token, expected "," (1:11)" +`; + +exports[`snippet: #183 [oxc-ts] format 1`] = ` +"'abstract' modifier cannot be used here. (1:3) +> 1 | ({abstract method(){}}) + | ^^^^^^^^" +`; + +exports[`snippet: #183 [typescript] format 1`] = ` +"'abstract' modifier cannot be used here. (1:3) +> 1 | ({abstract method(){}}) + | ^^^^^^^^ +Cause: 'abstract' modifier cannot be used here." +`; diff --git a/tests/format/misc/errors/typescript/modifiers/format.test.js b/tests/format/misc/errors/typescript/modifiers/format.test.js index 8caf3f4c0..6c09b9964 100644 --- a/tests/format/misc/errors/typescript/modifiers/format.test.js +++ b/tests/format/misc/errors/typescript/modifiers/format.test.js @@ -138,6 +138,10 @@ runFormatTest( declare [index: string]: number } `, + + // `ObjectLiteral` + // https://github.com/typescript-eslint/typescript-eslint/issues/11687 + ...["abstract"].map((modifier) => `({${modifier} method(){}})`), ], }, ["babel-ts", "typescript", "oxc-ts"], diff --git a/yarn.lock b/yarn.lock index 2da13f4fd..683ac6856 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2573,106 +2573,106 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:8.45.0": - version: 8.45.0 - resolution: "@typescript-eslint/eslint-plugin@npm:8.45.0" +"@typescript-eslint/eslint-plugin@npm:8.46.0": + version: 8.46.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.46.0" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:8.45.0" - "@typescript-eslint/type-utils": "npm:8.45.0" - "@typescript-eslint/utils": "npm:8.45.0" - "@typescript-eslint/visitor-keys": "npm:8.45.0" + "@typescript-eslint/scope-manager": "npm:8.46.0" + "@typescript-eslint/type-utils": "npm:8.46.0" + "@typescript-eslint/utils": "npm:8.46.0" + "@typescript-eslint/visitor-keys": "npm:8.46.0" graphemer: "npm:^1.4.0" ignore: "npm:^7.0.0" natural-compare: "npm:^1.4.0" ts-api-utils: "npm:^2.1.0" peerDependencies: - "@typescript-eslint/parser": ^8.45.0 + "@typescript-eslint/parser": ^8.46.0 eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" - checksum: 10/6d31dbd3354028b4a010af0ea2614a171b11616e6f20d36d74529b8888681ae8d15e1269122b8a8d5fae117bdd66dac4a38cfc99dc2a0ee33bd22c10075f63e4 + checksum: 10/415afd894a5fec9cfe2c327c8b26377045979cc6bdf720aeecb32af335b9e6865c70fa6a355dd16f52a36dc38f50755df3eb1466d5822c53c80465ff824c9881 languageName: node linkType: hard -"@typescript-eslint/parser@npm:8.45.0": - version: 8.45.0 - resolution: "@typescript-eslint/parser@npm:8.45.0" +"@typescript-eslint/parser@npm:8.46.0": + version: 8.46.0 + resolution: "@typescript-eslint/parser@npm:8.46.0" dependencies: - "@typescript-eslint/scope-manager": "npm:8.45.0" - "@typescript-eslint/types": "npm:8.45.0" - "@typescript-eslint/typescript-estree": "npm:8.45.0" - "@typescript-eslint/visitor-keys": "npm:8.45.0" + "@typescript-eslint/scope-manager": "npm:8.46.0" + "@typescript-eslint/types": "npm:8.46.0" + "@typescript-eslint/typescript-estree": "npm:8.46.0" + "@typescript-eslint/visitor-keys": "npm:8.46.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" - checksum: 10/4f8b7c73ae3b53c2adc4e981ac2ca90839a118947635481b45d29423d39b7b73cde2b185ad1084c9e19c3239444bf1be81f40b861176eec4540cb46848731991 + checksum: 10/6838fde776fd2b2932b259a20cc89b517e0c94a2cfa363a5e8531095c23fb35d8f803196f6594026d0510bf2a8ec003c67181bb2c407904685a64c97602da65f languageName: node linkType: hard -"@typescript-eslint/project-service@npm:8.45.0": - version: 8.45.0 - resolution: "@typescript-eslint/project-service@npm:8.45.0" +"@typescript-eslint/project-service@npm:8.46.0": + version: 8.46.0 + resolution: "@typescript-eslint/project-service@npm:8.46.0" dependencies: - "@typescript-eslint/tsconfig-utils": "npm:^8.45.0" - "@typescript-eslint/types": "npm:^8.45.0" + "@typescript-eslint/tsconfig-utils": "npm:^8.46.0" + "@typescript-eslint/types": "npm:^8.46.0" debug: "npm:^4.3.4" peerDependencies: typescript: ">=4.8.4 <6.0.0" - checksum: 10/919c8260dae79eaec79de84a5ae66fbb09c2ab7aca8c3b7785cb011582a2864c8091e64c84013b05bce812e522fbc4a5ae1c68f86404e078fc84da0fe80247ce + checksum: 10/de11af23ae6b82769b667e8d6e81d47ce039c7817465b99c1e29c8fbcac58af898bebe70368a274cd7b3c7232354134d53ceba0415b8d7e18317037bc4a4a2f7 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:8.45.0, @typescript-eslint/scope-manager@npm:^8.44.1": - version: 8.45.0 - resolution: "@typescript-eslint/scope-manager@npm:8.45.0" +"@typescript-eslint/scope-manager@npm:8.46.0, @typescript-eslint/scope-manager@npm:^8.44.1": + version: 8.46.0 + resolution: "@typescript-eslint/scope-manager@npm:8.46.0" dependencies: - "@typescript-eslint/types": "npm:8.45.0" - "@typescript-eslint/visitor-keys": "npm:8.45.0" - checksum: 10/e45d63a0109eca00f6b431d87e73eacfa03b1795905f123e9144bcacb5abb83888167d1849317c6f90ba1f3553196b2eab13e5e7cdd1050d7a84eaadb65ba801 + "@typescript-eslint/types": "npm:8.46.0" + "@typescript-eslint/visitor-keys": "npm:8.46.0" + checksum: 10/ed85abd08c0edf088b1b11757c658acf593cf84051bddde651304a609d3a6cd9e331149e88653676606a565c3f92c191d4af049f540f6e3bb692a4f38305fd71 languageName: node linkType: hard -"@typescript-eslint/tsconfig-utils@npm:8.45.0, @typescript-eslint/tsconfig-utils@npm:^8.45.0": - version: 8.45.0 - resolution: "@typescript-eslint/tsconfig-utils@npm:8.45.0" +"@typescript-eslint/tsconfig-utils@npm:8.46.0, @typescript-eslint/tsconfig-utils@npm:^8.46.0": + version: 8.46.0 + resolution: "@typescript-eslint/tsconfig-utils@npm:8.46.0" peerDependencies: typescript: ">=4.8.4 <6.0.0" - checksum: 10/91696bbc34758749d3647236986bf418bacdc0de0e27c2d39cd7c2408c404c35ed18c47c2a55aea0bb9525cc7eb656586359c4e651144603f3438ce93fe80081 + checksum: 10/e78a66a854322423aca835070c5ee9489975c4d80d2f8ffe9cf4d6e3f67a1646ddc05b086f7156599c90ad521670ca572a4315f2b49a5922c33d6e49723558e4 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:8.45.0, @typescript-eslint/type-utils@npm:^8.0.0, @typescript-eslint/type-utils@npm:^8.44.1": - version: 8.45.0 - resolution: "@typescript-eslint/type-utils@npm:8.45.0" +"@typescript-eslint/type-utils@npm:8.46.0, @typescript-eslint/type-utils@npm:^8.0.0, @typescript-eslint/type-utils@npm:^8.44.1": + version: 8.46.0 + resolution: "@typescript-eslint/type-utils@npm:8.46.0" dependencies: - "@typescript-eslint/types": "npm:8.45.0" - "@typescript-eslint/typescript-estree": "npm:8.45.0" - "@typescript-eslint/utils": "npm:8.45.0" + "@typescript-eslint/types": "npm:8.46.0" + "@typescript-eslint/typescript-estree": "npm:8.46.0" + "@typescript-eslint/utils": "npm:8.46.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^2.1.0" peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" - checksum: 10/81017b3f4780a65a4e4268ab208f1cb8891c1ced9ade23d8eb4575b18aeb99fe59a0d0ddbb4eea9c086567a1b4515d3466e850d4c81ec0d2d88658c43877a6cf + checksum: 10/5405b71b91d02ed4eac1028fc156c053953403b9f48393d92340b15a8b05bee5bf1281324c6283ac31a0e03cc1a19baf94768cb3fd70b4621f8c07a4243837db languageName: node linkType: hard -"@typescript-eslint/types@npm:8.45.0, @typescript-eslint/types@npm:^8.41.0, @typescript-eslint/types@npm:^8.44.1, @typescript-eslint/types@npm:^8.45.0": - version: 8.45.0 - resolution: "@typescript-eslint/types@npm:8.45.0" - checksum: 10/889ded2b9bf376c876611b2a37f89051fdc8ec501314a4b97832caefa4305bffc4b752548941ce2e7f9659a81336d096d439d4c2ed236c99fefdf60b715593dd +"@typescript-eslint/types@npm:8.46.0, @typescript-eslint/types@npm:^8.41.0, @typescript-eslint/types@npm:^8.44.1, @typescript-eslint/types@npm:^8.46.0": + version: 8.46.0 + resolution: "@typescript-eslint/types@npm:8.46.0" + checksum: 10/0118b0dd592bf4beaf41e8c6be812980dd0adea44d48c90d8b0272777b58d4cfd6326b8bc363efa3c640be476a6bf3632aee2d97052d5e34071e6576b9c28264 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:8.45.0, @typescript-eslint/typescript-estree@npm:^8.44.1": - version: 8.45.0 - resolution: "@typescript-eslint/typescript-estree@npm:8.45.0" +"@typescript-eslint/typescript-estree@npm:8.46.0, @typescript-eslint/typescript-estree@npm:^8.44.1": + version: 8.46.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.46.0" dependencies: - "@typescript-eslint/project-service": "npm:8.45.0" - "@typescript-eslint/tsconfig-utils": "npm:8.45.0" - "@typescript-eslint/types": "npm:8.45.0" - "@typescript-eslint/visitor-keys": "npm:8.45.0" + "@typescript-eslint/project-service": "npm:8.46.0" + "@typescript-eslint/tsconfig-utils": "npm:8.46.0" + "@typescript-eslint/types": "npm:8.46.0" + "@typescript-eslint/visitor-keys": "npm:8.46.0" debug: "npm:^4.3.4" fast-glob: "npm:^3.3.2" is-glob: "npm:^4.0.3" @@ -2681,32 +2681,32 @@ __metadata: ts-api-utils: "npm:^2.1.0" peerDependencies: typescript: ">=4.8.4 <6.0.0" - checksum: 10/2fb4e63ad6128afbada8eabaabfe7d5a8f1a1f387bb13d7d3209103493ba974b518bf47b17e9a853beba10ec81efd5582ebf628c2eb77a924cf67d4d85466e5e + checksum: 10/61053bd0c35a1fe5c82aef00cb70dbe0878ab28e55550cc1e2d6e7d4a0520c81947eb7505227c85a742a93db905d7e7376aed7d958dc257507b9bdda1daf0b00 languageName: node linkType: hard -"@typescript-eslint/utils@npm:8.45.0, @typescript-eslint/utils@npm:^8.0.0, @typescript-eslint/utils@npm:^8.44.1": - version: 8.45.0 - resolution: "@typescript-eslint/utils@npm:8.45.0" +"@typescript-eslint/utils@npm:8.46.0, @typescript-eslint/utils@npm:^8.0.0, @typescript-eslint/utils@npm:^8.44.1": + version: 8.46.0 + resolution: "@typescript-eslint/utils@npm:8.46.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.7.0" - "@typescript-eslint/scope-manager": "npm:8.45.0" - "@typescript-eslint/types": "npm:8.45.0" - "@typescript-eslint/typescript-estree": "npm:8.45.0" + "@typescript-eslint/scope-manager": "npm:8.46.0" + "@typescript-eslint/types": "npm:8.46.0" + "@typescript-eslint/typescript-estree": "npm:8.46.0" peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: ">=4.8.4 <6.0.0" - checksum: 10/9e675a0da4434bd434901f9ba3e1e91d4d7ad542d7fcf8c23534a67f2f9039a569da20929e67a6562e3a263be226ad424cd0c1ac80f7828f4285f7f34e361926 + checksum: 10/4e0da60de389799afdd36249fd4bcf9e085a4d6f119e241e436a701b45cdf10becc3f1e3cdef29ebbf147a81f40d9a4800d428cb4a66799d3e4aa80b879c9ee2 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:8.45.0": - version: 8.45.0 - resolution: "@typescript-eslint/visitor-keys@npm:8.45.0" +"@typescript-eslint/visitor-keys@npm:8.46.0": + version: 8.46.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.46.0" dependencies: - "@typescript-eslint/types": "npm:8.45.0" + "@typescript-eslint/types": "npm:8.46.0" eslint-visitor-keys: "npm:^4.2.1" - checksum: 10/8ae7e19c69c1f67fa8f952c18a09ad42a8cba492545d6e1dca6750e760893773f69ec6b1a96d0997e833c82aecc5ff7fb9546c5abd6c4427d91206670cf8ff37 + checksum: 10/37e6145b6a5e960c59777d7fc86f722ff696e76c627106ac4577b945ca35744a5f96525d77bde50fe8c328503e9392e21e3adb7cf9899ae0efc054d63f4c3916 languageName: node linkType: hard @@ -7585,10 +7585,10 @@ __metadata: "@prettier/parse-srcset": "npm:3.1.0" "@stylistic/eslint-plugin": "npm:5.3.1" "@types/estree": "npm:1.0.8" - "@typescript-eslint/eslint-plugin": "npm:8.45.0" - "@typescript-eslint/parser": "npm:8.45.0" - "@typescript-eslint/typescript-estree": "npm:8.45.0" - "@typescript-eslint/visitor-keys": "npm:8.45.0" + "@typescript-eslint/eslint-plugin": "npm:8.46.0" + "@typescript-eslint/parser": "npm:8.46.0" + "@typescript-eslint/typescript-estree": "npm:8.46.0" + "@typescript-eslint/visitor-keys": "npm:8.46.0" acorn: "npm:8.15.0" acorn-jsx: "npm:5.3.2" angular-estree-parser: "npm:13.0.2"