@typescript-eslint/eslint-plugin 8.50.2-alpha.6 → 8.50.2-alpha.7
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.
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: TSESLint.RuleModule<"dynamicDelete", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
1
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"dynamicDelete", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
3
2
|
name: string;
|
|
4
3
|
};
|
|
5
4
|
export default _default;
|
|
@@ -10,7 +10,6 @@ exports.default = (0, util_1.createRule)({
|
|
|
10
10
|
description: 'Disallow using the `delete` operator on computed key expressions',
|
|
11
11
|
recommended: 'strict',
|
|
12
12
|
},
|
|
13
|
-
fixable: 'code',
|
|
14
13
|
messages: {
|
|
15
14
|
dynamicDelete: 'Do not delete dynamically computed property keys.',
|
|
16
15
|
},
|
|
@@ -18,13 +17,6 @@ exports.default = (0, util_1.createRule)({
|
|
|
18
17
|
},
|
|
19
18
|
defaultOptions: [],
|
|
20
19
|
create(context) {
|
|
21
|
-
function createFixer(member) {
|
|
22
|
-
if (member.property.type === utils_1.AST_NODE_TYPES.Literal &&
|
|
23
|
-
typeof member.property.value === 'string') {
|
|
24
|
-
return createPropertyReplacement(member.property, `.${member.property.value}`);
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
20
|
return {
|
|
29
21
|
'UnaryExpression[operator=delete]'(node) {
|
|
30
22
|
if (node.argument.type !== utils_1.AST_NODE_TYPES.MemberExpression ||
|
|
@@ -35,19 +27,9 @@ exports.default = (0, util_1.createRule)({
|
|
|
35
27
|
context.report({
|
|
36
28
|
node: node.argument.property,
|
|
37
29
|
messageId: 'dynamicDelete',
|
|
38
|
-
fix: createFixer(node.argument),
|
|
39
30
|
});
|
|
40
31
|
},
|
|
41
32
|
};
|
|
42
|
-
function createPropertyReplacement(property, replacement) {
|
|
43
|
-
return (fixer) => fixer.replaceTextRange(getTokenRange(property), replacement);
|
|
44
|
-
}
|
|
45
|
-
function getTokenRange(property) {
|
|
46
|
-
return [
|
|
47
|
-
(0, util_1.nullThrows)(context.sourceCode.getTokenBefore(property), util_1.NullThrowsReasons.MissingToken('token before', 'property')).range[0],
|
|
48
|
-
(0, util_1.nullThrows)(context.sourceCode.getTokenAfter(property), util_1.NullThrowsReasons.MissingToken('token after', 'property')).range[1],
|
|
49
|
-
];
|
|
50
|
-
}
|
|
51
33
|
},
|
|
52
34
|
});
|
|
53
35
|
function isAcceptableIndexExpression(property) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "8.50.2-alpha.
|
|
3
|
+
"version": "8.50.2-alpha.7",
|
|
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.50.2-alpha.
|
|
63
|
-
"@typescript-eslint/type-utils": "8.50.2-alpha.
|
|
64
|
-
"@typescript-eslint/utils": "8.50.2-alpha.
|
|
65
|
-
"@typescript-eslint/visitor-keys": "8.50.2-alpha.
|
|
62
|
+
"@typescript-eslint/scope-manager": "8.50.2-alpha.7",
|
|
63
|
+
"@typescript-eslint/type-utils": "8.50.2-alpha.7",
|
|
64
|
+
"@typescript-eslint/utils": "8.50.2-alpha.7",
|
|
65
|
+
"@typescript-eslint/visitor-keys": "8.50.2-alpha.7",
|
|
66
66
|
"ignore": "^7.0.0",
|
|
67
67
|
"natural-compare": "^1.4.0",
|
|
68
68
|
"ts-api-utils": "^2.1.0"
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/mdast": "^4.0.3",
|
|
72
72
|
"@types/natural-compare": "*",
|
|
73
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.50.2-alpha.
|
|
74
|
-
"@typescript-eslint/rule-tester": "8.50.2-alpha.
|
|
73
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.50.2-alpha.7",
|
|
74
|
+
"@typescript-eslint/rule-tester": "8.50.2-alpha.7",
|
|
75
75
|
"@vitest/coverage-v8": "^3.1.3",
|
|
76
76
|
"ajv": "^6.12.6",
|
|
77
77
|
"cross-fetch": "*",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"vitest": "^3.1.3"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@typescript-eslint/parser": "^8.50.2-alpha.
|
|
94
|
+
"@typescript-eslint/parser": "^8.50.2-alpha.7",
|
|
95
95
|
"eslint": "^8.57.0 || ^9.0.0",
|
|
96
96
|
"typescript": ">=4.8.4 <6.0.0"
|
|
97
97
|
},
|