Skip to content

Commit

Permalink
feat(typescript-estree): warn on deprecated AST property accesses (#6525
Browse files Browse the repository at this point in the history
)
  • Loading branch information
JoshuaKGoldberg committed Mar 13, 2023
1 parent f0f45a9 commit 79c058d
Show file tree
Hide file tree
Showing 86 changed files with 1,123 additions and 4,514 deletions.
5 changes: 5 additions & 0 deletions docs/architecture/TypeScript-ESTree.mdx
Expand Up @@ -42,6 +42,11 @@ interface ParseOptions {
*/
comment?: boolean;

/**
* Whether deprecated AST properties should skip calling console.warn on accesses.
*/
suppressDeprecatedPropertyWarnings?: boolean;

/**
* An array of modules to turn explicit debugging on for.
* - 'typescript-eslint' is the same as setting the env var `DEBUG=typescript-eslint:*`
Expand Down
22 changes: 22 additions & 0 deletions docs/linting/Troubleshooting.mdx
Expand Up @@ -246,6 +246,28 @@ See [this issue comment](https://github.com/typescript-eslint/typescript-eslint/
See [Changes to one file are not reflected in linting other files in my IDE](#changes-to-one-file-are-not-reflected-when-linting-other-files-in-my-ide).
Rules such as [`no-unsafe-argument`](https://typescript-eslint.io/rules/no-unsafe-argument), [`no-unsafe-assignment`](https://typescript-eslint.io/rules/no-unsafe-assignment), and [`no-unsafe-call`](https://typescript-eslint.io/rules/no-unsafe-call) are often impacted.

## "The '`<key>`' property is deprecated on '`<type>`' nodes. Use '`<key>`' instead." warnings

If you're seeing this warning, it's likely you're using an ESLint plugin (or other tooling) that hasn't been updated for typescript-eslint v6.
Make sure you're using the latest versions of each of your ESLint plugins (and other tooling).

If you've using many ESLint plugins, have updated each to their latest version, and you're not sure which one this complaint is coming from, try disabling half of them at a time to narrow down which plugin it is.
Then make sure each of those plugins has a GitHub issue asking that they release a version supporting typescript-eslint v6.

:::tip
For developers updating ESLint rules in plugins that still need to support typescript-eslint v5: you may need to `||` fall back to the old property key if the new one doesn't exist:

```diff
- node.typeParameters
+ node.typeArguments || node.typeParameters
```

:::

For more context, see the [Some properties named typeParameters instead of typeArguments](https://github.com/typescript-eslint/typescript-eslint/issues/146) issue, and the implementing [fix: rename typeParameters to typeArguments where needed](https://github.com/typescript-eslint/typescript-eslint/pull/5384) pull request.

The [typescript-eslint v6 release post](https://deploy-preview-6515--typescript-eslint.netlify.app/blog/announcing-typescript-eslint-v6-beta) has more information on typescript-eslint v6.

## My linting feels really slow

If you think you're having issues with performance, see our [Performance Troubleshooting documentation](./troubleshooting/Performance.md).
Expand Up @@ -64,26 +64,6 @@ Program {
end: { column: 29, line: 1 },
},
},
superTypeParameters: TSTypeParameterInstantiation {
type: "TSTypeParameterInstantiation",
params: Array [
TSStringKeyword {
type: "TSStringKeyword",
range: [22, 28],
loc: {
start: { column: 22, line: 1 },
end: { column: 28, line: 1 },
},
},
],
range: [21, 29],
loc: {
start: { column: 21, line: 1 },
end: { column: 29, line: 1 },
},
},
range: [0, 32],
loc: {
Expand Down
Expand Up @@ -46,29 +46,10 @@ exports[`AST Fixtures declaration ClassDeclaration extends-type-param AST Alignm
loc: {
start: { column: 18, line: 1 },
end: { column: 21, line: 1 },
- },
- },
- superTypeArguments: TSTypeParameterInstantiation {
- type: 'TSTypeParameterInstantiation',
- params: Array [
- TSStringKeyword {
- type: 'TSStringKeyword',
-
- range: [22, 28],
- loc: {
- start: { column: 22, line: 1 },
- end: { column: 28, line: 1 },
- },
- },
- ],
-
- range: [21, 29],
- loc: {
- start: { column: 21, line: 1 },
- end: { column: 29, line: 1 },
},
},
superTypeParameters: TSTypeParameterInstantiation {
- superTypeArguments: TSTypeParameterInstantiation {
+ superTypeParameters: TSTypeParameterInstantiation {
type: 'TSTypeParameterInstantiation',
params: Array [
TSStringKeyword {
Expand Down
Expand Up @@ -76,38 +76,6 @@ Program {
end: { column: 27, line: 1 },
},
},
superTypeParameters: TSTypeParameterInstantiation {
type: "TSTypeParameterInstantiation",
params: Array [
TSTypeReference {
type: "TSTypeReference",
typeName: Identifier {
type: "Identifier",
decorators: Array [],
name: "T",
optional: false,
range: [25, 26],
loc: {
start: { column: 25, line: 1 },
end: { column: 26, line: 1 },
},
},
range: [25, 26],
loc: {
start: { column: 25, line: 1 },
end: { column: 26, line: 1 },
},
},
],
range: [24, 27],
loc: {
start: { column: 24, line: 1 },
end: { column: 27, line: 1 },
},
},
typeParameters: TSTypeParameterDeclaration {
type: "TSTypeParameterDeclaration",
params: Array [
Expand Down
Expand Up @@ -49,38 +49,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-
},
},
- superTypeArguments: TSTypeParameterInstantiation {
- type: 'TSTypeParameterInstantiation',
- params: Array [
- TSTypeReference {
- type: 'TSTypeReference',
- typeName: Identifier {
- type: 'Identifier',
- decorators: Array [],
- name: 'T',
- optional: false,
-
- range: [25, 26],
- loc: {
- start: { column: 25, line: 1 },
- end: { column: 26, line: 1 },
- },
- },
-
- range: [25, 26],
- loc: {
- start: { column: 25, line: 1 },
- end: { column: 26, line: 1 },
- },
- },
- ],
-
- range: [24, 27],
- loc: {
- start: { column: 24, line: 1 },
- end: { column: 27, line: 1 },
- },
- },
superTypeParameters: TSTypeParameterInstantiation {
+ superTypeParameters: TSTypeParameterInstantiation {
type: 'TSTypeParameterInstantiation',
params: Array [
TSTypeReference {
Expand Down
Expand Up @@ -78,26 +78,6 @@ Program {
end: { column: 34, line: 4 },
},
},
typeParameters: TSTypeParameterInstantiation {
type: "TSTypeParameterInstantiation",
params: Array [
TSStringKeyword {
type: "TSStringKeyword",
range: [147, 153],
loc: {
start: { column: 35, line: 4 },
end: { column: 41, line: 4 },
},
},
],
range: [146, 154],
loc: {
start: { column: 34, line: 4 },
end: { column: 42, line: 4 },
},
},
range: [139, 154],
loc: {
Expand Down
Expand Up @@ -56,38 +56,17 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method
typeAnnotation: TSTypeReference {
type: 'TSTypeReference',
- typeArguments: TSTypeParameterInstantiation {
- type: 'TSTypeParameterInstantiation',
- params: Array [
- TSStringKeyword {
- type: 'TSStringKeyword',
-
- range: [147, 153],
- loc: {
- start: { column: 35, line: 4 },
- end: { column: 41, line: 4 },
- },
- },
- ],
-
- range: [146, 154],
- loc: {
- start: { column: 34, line: 4 },
- end: { column: 42, line: 4 },
- },
- },
typeName: Identifier {
type: 'Identifier',
- decorators: Array [],
name: 'Promise',
- optional: false,
range: [139, 146],
loc: {
start: { column: 27, line: 4 },
end: { column: 34, line: 4 },
},
},
typeParameters: TSTypeParameterInstantiation {
+ typeName: Identifier {
+ type: 'Identifier',
+ name: 'Promise',
+
+ range: [139, 146],
+ loc: {
+ start: { column: 27, line: 4 },
+ end: { column: 34, line: 4 },
+ },
+ },
+ typeParameters: TSTypeParameterInstantiation {
type: 'TSTypeParameterInstantiation',
params: Array [
TSStringKeyword {
Expand All @@ -105,6 +84,18 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method
loc: {
start: { column: 34, line: 4 },
end: { column: 42, line: 4 },
- },
- },
- typeName: Identifier {
- type: 'Identifier',
- decorators: Array [],
- name: 'Promise',
- optional: false,
-
- range: [139, 146],
- loc: {
- start: { column: 27, line: 4 },
- end: { column: 34, line: 4 },
},
},
Expand Down
Expand Up @@ -78,26 +78,6 @@ Program {
end: { column: 26, line: 4 },
},
},
typeParameters: TSTypeParameterInstantiation {
type: "TSTypeParameterInstantiation",
params: Array [
TSStringKeyword {
type: "TSStringKeyword",
range: [139, 145],
loc: {
start: { column: 27, line: 4 },
end: { column: 33, line: 4 },
},
},
],
range: [138, 146],
loc: {
start: { column: 26, line: 4 },
end: { column: 34, line: 4 },
},
},
range: [131, 146],
loc: {
Expand Down
Expand Up @@ -53,38 +53,17 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method
typeAnnotation: TSTypeReference {
type: 'TSTypeReference',
- typeArguments: TSTypeParameterInstantiation {
- type: 'TSTypeParameterInstantiation',
- params: Array [
- TSStringKeyword {
- type: 'TSStringKeyword',
-
- range: [139, 145],
- loc: {
- start: { column: 27, line: 4 },
- end: { column: 33, line: 4 },
- },
- },
- ],
-
- range: [138, 146],
- loc: {
- start: { column: 26, line: 4 },
- end: { column: 34, line: 4 },
- },
- },
typeName: Identifier {
type: 'Identifier',
- decorators: Array [],
name: 'Promise',
- optional: false,
range: [131, 138],
loc: {
start: { column: 19, line: 4 },
end: { column: 26, line: 4 },
},
},
typeParameters: TSTypeParameterInstantiation {
+ typeName: Identifier {
+ type: 'Identifier',
+ name: 'Promise',
+
+ range: [131, 138],
+ loc: {
+ start: { column: 19, line: 4 },
+ end: { column: 26, line: 4 },
+ },
+ },
+ typeParameters: TSTypeParameterInstantiation {
type: 'TSTypeParameterInstantiation',
params: Array [
TSStringKeyword {
Expand All @@ -104,7 +83,19 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method
end: { column: 34, line: 4 },
},
},
- typeName: Identifier {
- type: 'Identifier',
- decorators: Array [],
- name: 'Promise',
- optional: false,
- range: [131, 138],
- loc: {
- start: { column: 19, line: 4 },
- end: { column: 26, line: 4 },
- },
- },
-
range: [131, 146],
loc: {
start: { column: 19, line: 4 },
Expand Down

0 comments on commit 79c058d

Please sign in to comment.