@typescript-eslint/eslint-plugin 6.2.1-alpha.31 → 6.2.1-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/rules/no-unused-vars.md +17 -0
- package/package.json +7 -7
|
@@ -8,3 +8,20 @@ description: 'Disallow unused variables.'
|
|
|
8
8
|
|
|
9
9
|
This rule extends the base [`eslint/no-unused-vars`](https://eslint.org/docs/rules/no-unused-vars) rule.
|
|
10
10
|
It adds support for TypeScript features, such as types.
|
|
11
|
+
|
|
12
|
+
## Benefits Over TypeScript
|
|
13
|
+
|
|
14
|
+
TypeScript provides [`noUnusedLocals`](https://www.typescriptlang.org/tsconfig#noUnusedLocals) and [`noUnusedParameters`](https://www.typescriptlang.org/tsconfig#noUnusedParameters) compiler options that can report errors on unused local variables or parameters, respectively.
|
|
15
|
+
Those compiler options can be convenient to use if you don't want to set up ESLint and typescript-eslint.
|
|
16
|
+
However:
|
|
17
|
+
|
|
18
|
+
- These lint rules are more configurable than TypeScript's compiler options.
|
|
19
|
+
- For example, the [`varsIgnorePattern` option](https://eslint.org/docs/latest/rules/no-unused-vars#varsignorepattern) can customize what names are always allowed to be exempted. TypeScript hardcodes its exemptions to names starting with `_`.
|
|
20
|
+
- [ESLint can be configured](https://eslint.org/docs/latest/use/configure/rules) within lines, files, and folders. TypeScript compiler options are linked to their TSConfig file.
|
|
21
|
+
- Many projects configure TypeScript's reported errors to block builds more aggressively than ESLint complaints. Blocking builds on unused variables can be inconvenient.
|
|
22
|
+
|
|
23
|
+
We generally recommend using `@typescript-eslint/no-unused-vars` to flag unused locals and parameters instead of TypeScript.
|
|
24
|
+
|
|
25
|
+
:::tip
|
|
26
|
+
Editors such as VS Code will still generally "grey out" unused variables even if `noUnusedLocals` and `noUnusedParameters` are not enabled in a project.
|
|
27
|
+
:::
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "6.2.1-alpha.
|
|
3
|
+
"version": "6.2.1-alpha.32+03df26d6d",
|
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@eslint-community/regexpp": "^4.5.1",
|
|
60
|
-
"@typescript-eslint/scope-manager": "6.2.1-alpha.
|
|
61
|
-
"@typescript-eslint/type-utils": "6.2.1-alpha.
|
|
62
|
-
"@typescript-eslint/utils": "6.2.1-alpha.
|
|
63
|
-
"@typescript-eslint/visitor-keys": "6.2.1-alpha.
|
|
60
|
+
"@typescript-eslint/scope-manager": "6.2.1-alpha.32+03df26d6d",
|
|
61
|
+
"@typescript-eslint/type-utils": "6.2.1-alpha.32+03df26d6d",
|
|
62
|
+
"@typescript-eslint/utils": "6.2.1-alpha.32+03df26d6d",
|
|
63
|
+
"@typescript-eslint/visitor-keys": "6.2.1-alpha.32+03df26d6d",
|
|
64
64
|
"debug": "^4.3.4",
|
|
65
65
|
"graphemer": "^1.4.0",
|
|
66
66
|
"ignore": "^5.2.4",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@types/natural-compare": "*",
|
|
76
76
|
"@types/prettier": "*",
|
|
77
77
|
"@typescript-eslint/rule-schema-to-typescript-types": "6.2.0",
|
|
78
|
-
"@typescript-eslint/rule-tester": "6.2.1-alpha.
|
|
78
|
+
"@typescript-eslint/rule-tester": "6.2.1-alpha.32+03df26d6d",
|
|
79
79
|
"ajv": "^6.12.6",
|
|
80
80
|
"chalk": "^5.3.0",
|
|
81
81
|
"cross-fetch": "*",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"type": "opencollective",
|
|
101
101
|
"url": "https://opencollective.com/typescript-eslint"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "03df26d6d3a1bae1e2ddecc19a84101055732fbb"
|
|
104
104
|
}
|