@typescript-eslint/eslint-plugin 8.73.1-alpha.11 → 8.73.1-alpha.13
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/rules/array-type.js
CHANGED
|
@@ -200,8 +200,10 @@ exports.default = (0, util_1.createRule)({
|
|
|
200
200
|
const type = typeParams[0];
|
|
201
201
|
const typeParens = typeNeedsParentheses(type);
|
|
202
202
|
const parentParens = readonlyPrefix &&
|
|
203
|
-
node.parent.type === utils_1.AST_NODE_TYPES.TSArrayType
|
|
204
|
-
|
|
203
|
+
(node.parent.type === utils_1.AST_NODE_TYPES.TSArrayType ||
|
|
204
|
+
(node.parent.type === utils_1.AST_NODE_TYPES.TSIndexedAccessType &&
|
|
205
|
+
node.parent.objectType === node)) &&
|
|
206
|
+
!(0, util_1.isParenthesized)(node, context.sourceCode);
|
|
205
207
|
const start = `${parentParens ? '(' : ''}${readonlyPrefix}${typeParens ? '(' : ''}`;
|
|
206
208
|
const end = `${typeParens ? ')' : ''}${isReadonlyWithGenericArrayType ? '' : `[]`}${parentParens ? ')' : ''}`;
|
|
207
209
|
context.report({
|
|
@@ -267,6 +267,16 @@ exports.default = (0, util_1.createRule)({
|
|
|
267
267
|
'AccessorProperty[value != null]'(node) {
|
|
268
268
|
checkAssignment(node.key, node.value, node, getComparisonType(node.typeAnnotation));
|
|
269
269
|
},
|
|
270
|
+
'ArrayExpression > SpreadElement'(node) {
|
|
271
|
+
const restType = services.getTypeAtLocation(node.argument);
|
|
272
|
+
if ((0, util_1.isTypeAnyType)(restType) || (0, util_1.isTypeAnyArrayType)(restType, checker)) {
|
|
273
|
+
context.report({
|
|
274
|
+
node,
|
|
275
|
+
messageId: 'unsafeArraySpread',
|
|
276
|
+
data: createData(restType),
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
},
|
|
270
280
|
'AssignmentExpression[operator = "="], AssignmentPattern'(node) {
|
|
271
281
|
let didReport = checkAssignment(node.left, node.right, node,
|
|
272
282
|
// the variable already has some form of a type to compare against
|
|
@@ -278,6 +288,17 @@ exports.default = (0, util_1.createRule)({
|
|
|
278
288
|
checkObjectDestructureHelper(node.left, node.right);
|
|
279
289
|
}
|
|
280
290
|
},
|
|
291
|
+
'JSXAttribute[value != null]'(node) {
|
|
292
|
+
const value = (0, util_1.nullThrows)(node.value, util_1.NullThrowsReasons.MissingToken(node.type, 'value'));
|
|
293
|
+
if (value.type !== utils_1.AST_NODE_TYPES.JSXExpressionContainer ||
|
|
294
|
+
value.expression.type === utils_1.AST_NODE_TYPES.JSXEmptyExpression) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
checkAssignment(node.name, value.expression, value.expression, ComparisonType.Contextual);
|
|
298
|
+
},
|
|
299
|
+
'ObjectExpression > Property'(node) {
|
|
300
|
+
checkAssignment(node.key, node.value, node, ComparisonType.Contextual);
|
|
301
|
+
},
|
|
281
302
|
'PropertyDefinition[value != null]'(node) {
|
|
282
303
|
checkAssignment(node.key, node.value, node, getComparisonType(node.typeAnnotation));
|
|
283
304
|
},
|
|
@@ -291,33 +312,6 @@ exports.default = (0, util_1.createRule)({
|
|
|
291
312
|
checkObjectDestructureHelper(node.id, init);
|
|
292
313
|
}
|
|
293
314
|
},
|
|
294
|
-
// object pattern props are checked via assignments
|
|
295
|
-
':not(ObjectPattern) > Property'(node) {
|
|
296
|
-
if (node.value.type === utils_1.AST_NODE_TYPES.AssignmentPattern ||
|
|
297
|
-
node.value.type === utils_1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression) {
|
|
298
|
-
// handled by other selector
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
checkAssignment(node.key, node.value, node, ComparisonType.Contextual);
|
|
302
|
-
},
|
|
303
|
-
'ArrayExpression > SpreadElement'(node) {
|
|
304
|
-
const restType = services.getTypeAtLocation(node.argument);
|
|
305
|
-
if ((0, util_1.isTypeAnyType)(restType) || (0, util_1.isTypeAnyArrayType)(restType, checker)) {
|
|
306
|
-
context.report({
|
|
307
|
-
node,
|
|
308
|
-
messageId: 'unsafeArraySpread',
|
|
309
|
-
data: createData(restType),
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
'JSXAttribute[value != null]'(node) {
|
|
314
|
-
const value = (0, util_1.nullThrows)(node.value, util_1.NullThrowsReasons.MissingToken(node.type, 'value'));
|
|
315
|
-
if (value.type !== utils_1.AST_NODE_TYPES.JSXExpressionContainer ||
|
|
316
|
-
value.expression.type === utils_1.AST_NODE_TYPES.JSXEmptyExpression) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
checkAssignment(node.name, value.expression, value.expression, ComparisonType.Contextual);
|
|
320
|
-
},
|
|
321
315
|
};
|
|
322
316
|
},
|
|
323
317
|
});
|
|
@@ -241,7 +241,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
241
241
|
checkSite(node.right);
|
|
242
242
|
},
|
|
243
243
|
NewExpression: checkArguments,
|
|
244
|
-
'Property
|
|
244
|
+
'ObjectExpression > Property'(node) {
|
|
245
245
|
checkSite(node.value);
|
|
246
246
|
},
|
|
247
247
|
'PropertyDefinition, AccessorProperty'(node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "8.73.1-alpha.
|
|
3
|
+
"version": "8.73.1-alpha.13",
|
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@eslint-community/regexpp": "^4.12.2",
|
|
50
|
-
"@typescript-eslint/scope-manager": "8.73.1-alpha.
|
|
51
|
-
"@typescript-eslint/type-utils": "8.73.1-alpha.
|
|
52
|
-
"@typescript-eslint/utils": "8.73.1-alpha.
|
|
53
|
-
"@typescript-eslint/visitor-keys": "8.73.1-alpha.
|
|
50
|
+
"@typescript-eslint/scope-manager": "8.73.1-alpha.13",
|
|
51
|
+
"@typescript-eslint/type-utils": "8.73.1-alpha.13",
|
|
52
|
+
"@typescript-eslint/utils": "8.73.1-alpha.13",
|
|
53
|
+
"@typescript-eslint/visitor-keys": "8.73.1-alpha.13",
|
|
54
54
|
"ignore": "^7.0.5",
|
|
55
55
|
"natural-compare": "^1.4.0",
|
|
56
56
|
"ts-api-utils": "^2.5.0"
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@types/mdast": "^4.0.4",
|
|
61
61
|
"@types/natural-compare": "^1.4.3",
|
|
62
62
|
"@types/react": "^18.3.21",
|
|
63
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.73.1-alpha.
|
|
64
|
-
"@typescript-eslint/rule-tester": "8.73.1-alpha.
|
|
63
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.73.1-alpha.13",
|
|
64
|
+
"@typescript-eslint/rule-tester": "8.73.1-alpha.13",
|
|
65
65
|
"@typescript/native": "npm:typescript@7.1.0-dev.20261009.1",
|
|
66
66
|
"@vitest/coverage-v8": "^5.0.3",
|
|
67
67
|
"ajv": "^6.12.6",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"vitest": "^5.0.3"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"@typescript-eslint/parser": "^8.73.1-alpha.
|
|
84
|
+
"@typescript-eslint/parser": "^8.73.1-alpha.13",
|
|
85
85
|
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
|
86
86
|
"typescript": ">=4.8.4 <6.1.0"
|
|
87
87
|
},
|