@typescript-eslint/eslint-plugin 8.47.1-alpha.10 → 8.47.1-alpha.12
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/dist/configs/eslint-recommended-raw.js +6 -1
- package/dist/rules/explicit-member-accessibility.js +1 -7
- package/dist/rules/no-unnecessary-parameter-property-assignment.js +0 -1
- package/dist/rules/parameter-properties.js +1 -7
- package/dist/util/class-scope-analyzer/extractComputedName.js +4 -14
- package/dist/util/collectUnusedVariables.js +3 -7
- package/package.json +8 -8
|
@@ -21,8 +21,13 @@ const config = (style) => ({
|
|
|
21
21
|
'no-dupe-keys': 'off', // ts(1117)
|
|
22
22
|
'no-func-assign': 'off', // ts(2630)
|
|
23
23
|
'no-import-assign': 'off', // ts(2632) & ts(2540)
|
|
24
|
-
// TODO - remove this once we no longer support ESLint v8
|
|
25
24
|
'no-new-native-nonconstructor': 'off', // ts(7009)
|
|
25
|
+
// "no-new-symbol" was deprecated in ESLint 9.0.0 and will be removed in
|
|
26
|
+
// ESLint v11.0.0. See:
|
|
27
|
+
// https://eslint.org/docs/latest/rules/no-new-symbol
|
|
28
|
+
// We need to keep the rule disabled until TSESLint drops support for
|
|
29
|
+
// ESlint 8. See:
|
|
30
|
+
// https://github.com/typescript-eslint/typescript-eslint/pull/8895
|
|
26
31
|
'no-new-symbol': 'off', // ts(7009)
|
|
27
32
|
'no-obj-calls': 'off', // ts(2349)
|
|
28
33
|
'no-redeclare': 'off', // ts(2451)
|
|
@@ -255,15 +255,9 @@ exports.default = (0, util_1.createRule)({
|
|
|
255
255
|
*/
|
|
256
256
|
function checkParameterPropertyAccessibilityModifier(node) {
|
|
257
257
|
const nodeType = 'parameter property';
|
|
258
|
-
// HAS to be an identifier or assignment or TSC will throw
|
|
259
|
-
if (node.parameter.type !== utils_1.AST_NODE_TYPES.Identifier &&
|
|
260
|
-
node.parameter.type !== utils_1.AST_NODE_TYPES.AssignmentPattern) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
258
|
const nodeName = node.parameter.type === utils_1.AST_NODE_TYPES.Identifier
|
|
264
259
|
? node.parameter.name
|
|
265
|
-
:
|
|
266
|
-
node.parameter.left.name;
|
|
260
|
+
: node.parameter.left.name;
|
|
267
261
|
switch (paramPropCheck) {
|
|
268
262
|
case 'explicit': {
|
|
269
263
|
if (!node.accessibility) {
|
|
@@ -64,7 +64,6 @@ exports.default = (0, util_1.createRule)({
|
|
|
64
64
|
((node.parameter.type === utils_1.AST_NODE_TYPES.Identifier && // constructor (public foo) {}
|
|
65
65
|
node.parameter.name === name) ||
|
|
66
66
|
(node.parameter.type === utils_1.AST_NODE_TYPES.AssignmentPattern && // constructor (public foo = 1) {}
|
|
67
|
-
node.parameter.left.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
68
67
|
node.parameter.left.name === name)));
|
|
69
68
|
}
|
|
70
69
|
function getIdentifier(node) {
|
|
@@ -74,15 +74,9 @@ exports.default = (0, util_1.createRule)({
|
|
|
74
74
|
TSParameterProperty(node) {
|
|
75
75
|
const modifiers = getModifiers(node);
|
|
76
76
|
if (!allow.includes(modifiers)) {
|
|
77
|
-
// HAS to be an identifier or assignment or TSC will throw
|
|
78
|
-
if (node.parameter.type !== utils_1.AST_NODE_TYPES.Identifier &&
|
|
79
|
-
node.parameter.type !== utils_1.AST_NODE_TYPES.AssignmentPattern) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
77
|
const name = node.parameter.type === utils_1.AST_NODE_TYPES.Identifier
|
|
83
78
|
? node.parameter.name
|
|
84
|
-
:
|
|
85
|
-
node.parameter.left.name;
|
|
79
|
+
: node.parameter.left.name;
|
|
86
80
|
context.report({
|
|
87
81
|
node,
|
|
88
82
|
messageId: 'preferClassProperty',
|
|
@@ -45,20 +45,10 @@ function extractNonComputedName(nonComputedName) {
|
|
|
45
45
|
*/
|
|
46
46
|
function extractNameForMember(node) {
|
|
47
47
|
if (node.type === utils_1.AST_NODE_TYPES.TSParameterProperty) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// Nonsensical properties -- see https://github.com/typescript-eslint/typescript-eslint/issues/11708
|
|
53
|
-
return null;
|
|
54
|
-
case utils_1.AST_NODE_TYPES.AssignmentPattern:
|
|
55
|
-
if (node.parameter.left.type !== utils_1.AST_NODE_TYPES.Identifier) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
return extractNonComputedName(node.parameter.left);
|
|
59
|
-
case utils_1.AST_NODE_TYPES.Identifier:
|
|
60
|
-
return extractNonComputedName(node.parameter);
|
|
61
|
-
}
|
|
48
|
+
const identifier = node.parameter.type === utils_1.AST_NODE_TYPES.Identifier
|
|
49
|
+
? node.parameter
|
|
50
|
+
: node.parameter.left;
|
|
51
|
+
return extractNonComputedName(identifier);
|
|
62
52
|
}
|
|
63
53
|
if (node.computed) {
|
|
64
54
|
return extractComputedName(node.key);
|
|
@@ -81,20 +81,16 @@ class UnusedVarsVisitor extends scope_manager_1.Visitor {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
TSParameterProperty(node) {
|
|
84
|
-
let identifier
|
|
84
|
+
let identifier;
|
|
85
85
|
switch (node.parameter.type) {
|
|
86
86
|
case utils_1.AST_NODE_TYPES.AssignmentPattern:
|
|
87
|
-
|
|
88
|
-
identifier = node.parameter.left;
|
|
89
|
-
}
|
|
87
|
+
identifier = node.parameter.left;
|
|
90
88
|
break;
|
|
91
89
|
case utils_1.AST_NODE_TYPES.Identifier:
|
|
92
90
|
identifier = node.parameter;
|
|
93
91
|
break;
|
|
94
92
|
}
|
|
95
|
-
|
|
96
|
-
this.markVariableAsUsed(identifier);
|
|
97
|
-
}
|
|
93
|
+
this.markVariableAsUsed(identifier);
|
|
98
94
|
}
|
|
99
95
|
collectUnusedVariables(scope, variables = {
|
|
100
96
|
unusedVariables: new Set(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "8.47.1-alpha.
|
|
3
|
+
"version": "8.47.1-alpha.12",
|
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@eslint-community/regexpp": "^4.10.0",
|
|
62
|
-
"@typescript-eslint/scope-manager": "8.47.1-alpha.
|
|
63
|
-
"@typescript-eslint/type-utils": "8.47.1-alpha.
|
|
64
|
-
"@typescript-eslint/utils": "8.47.1-alpha.
|
|
65
|
-
"@typescript-eslint/visitor-keys": "8.47.1-alpha.
|
|
62
|
+
"@typescript-eslint/scope-manager": "8.47.1-alpha.12",
|
|
63
|
+
"@typescript-eslint/type-utils": "8.47.1-alpha.12",
|
|
64
|
+
"@typescript-eslint/utils": "8.47.1-alpha.12",
|
|
65
|
+
"@typescript-eslint/visitor-keys": "8.47.1-alpha.12",
|
|
66
66
|
"graphemer": "^1.4.0",
|
|
67
67
|
"ignore": "^7.0.0",
|
|
68
68
|
"natural-compare": "^1.4.0",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/mdast": "^4.0.3",
|
|
73
73
|
"@types/natural-compare": "*",
|
|
74
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.47.1-alpha.
|
|
75
|
-
"@typescript-eslint/rule-tester": "8.47.1-alpha.
|
|
74
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.47.1-alpha.12",
|
|
75
|
+
"@typescript-eslint/rule-tester": "8.47.1-alpha.12",
|
|
76
76
|
"@vitest/coverage-v8": "^3.1.3",
|
|
77
77
|
"ajv": "^6.12.6",
|
|
78
78
|
"cross-fetch": "*",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"vitest": "^3.1.3"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@typescript-eslint/parser": "^8.47.1-alpha.
|
|
95
|
+
"@typescript-eslint/parser": "^8.47.1-alpha.12",
|
|
96
96
|
"eslint": "^8.57.0 || ^9.0.0",
|
|
97
97
|
"typescript": ">=4.8.4 <6.0.0"
|
|
98
98
|
},
|