@typescript-eslint/eslint-plugin 8.63.1-alpha.8 → 8.64.0
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/eslintrc/all.d.ts +0 -2
- package/dist/configs/eslintrc/all.js +0 -2
- package/dist/configs/flat/all.js +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/raw-plugin.d.ts +0 -2
- package/dist/rules/no-loop-func.js +16 -2
- package/dist/rules/no-shadow.js +1 -1
- package/dist/rules/no-this-alias.js +1 -1
- package/dist/rules/no-unnecessary-template-expression.js +2 -2
- package/dist/rules/no-unused-vars.js +1 -1
- package/dist/rules/require-array-sort-compare.js +1 -1
- package/package.json +8 -8
|
@@ -58,8 +58,6 @@ declare const _default: {
|
|
|
58
58
|
'no-invalid-this': "off";
|
|
59
59
|
'@typescript-eslint/no-invalid-this': "error";
|
|
60
60
|
'@typescript-eslint/no-invalid-void-type': "error";
|
|
61
|
-
'no-loop-func': "off";
|
|
62
|
-
'@typescript-eslint/no-loop-func': "error";
|
|
63
61
|
'no-magic-numbers': "off";
|
|
64
62
|
'@typescript-eslint/no-magic-numbers': "error";
|
|
65
63
|
'@typescript-eslint/no-meaningless-void-operator': "error";
|
|
@@ -65,8 +65,6 @@ module.exports = {
|
|
|
65
65
|
'no-invalid-this': 'off',
|
|
66
66
|
'@typescript-eslint/no-invalid-this': 'error',
|
|
67
67
|
'@typescript-eslint/no-invalid-void-type': 'error',
|
|
68
|
-
'no-loop-func': 'off',
|
|
69
|
-
'@typescript-eslint/no-loop-func': 'error',
|
|
70
68
|
'no-magic-numbers': 'off',
|
|
71
69
|
'@typescript-eslint/no-magic-numbers': 'error',
|
|
72
70
|
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
package/dist/configs/flat/all.js
CHANGED
|
@@ -78,8 +78,6 @@ exports.default = (plugin, parser) => [
|
|
|
78
78
|
'no-invalid-this': 'off',
|
|
79
79
|
'@typescript-eslint/no-invalid-this': 'error',
|
|
80
80
|
'@typescript-eslint/no-invalid-void-type': 'error',
|
|
81
|
-
'no-loop-func': 'off',
|
|
82
|
-
'@typescript-eslint/no-loop-func': 'error',
|
|
83
81
|
'no-magic-numbers': 'off',
|
|
84
82
|
'@typescript-eslint/no-magic-numbers': 'error',
|
|
85
83
|
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
package/dist/index.d.ts
CHANGED
|
@@ -60,8 +60,6 @@ declare const _default: {
|
|
|
60
60
|
'no-invalid-this': "off";
|
|
61
61
|
'@typescript-eslint/no-invalid-this': "error";
|
|
62
62
|
'@typescript-eslint/no-invalid-void-type': "error";
|
|
63
|
-
'no-loop-func': "off";
|
|
64
|
-
'@typescript-eslint/no-loop-func': "error";
|
|
65
63
|
'no-magic-numbers': "off";
|
|
66
64
|
'@typescript-eslint/no-magic-numbers': "error";
|
|
67
65
|
'@typescript-eslint/no-meaningless-void-operator': "error";
|
package/dist/raw-plugin.d.ts
CHANGED
|
@@ -82,8 +82,6 @@ declare const _default: {
|
|
|
82
82
|
'no-invalid-this': "off";
|
|
83
83
|
'@typescript-eslint/no-invalid-this': "error";
|
|
84
84
|
'@typescript-eslint/no-invalid-void-type': "error";
|
|
85
|
-
'no-loop-func': "off";
|
|
86
|
-
'@typescript-eslint/no-loop-func': "error";
|
|
87
85
|
'no-magic-numbers': "off";
|
|
88
86
|
'@typescript-eslint/no-magic-numbers': "error";
|
|
89
87
|
'@typescript-eslint/no-meaningless-void-operator': "error";
|
|
@@ -4,11 +4,24 @@ const utils_1 = require("@typescript-eslint/utils");
|
|
|
4
4
|
const util_1 = require("../util");
|
|
5
5
|
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
|
6
6
|
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('no-loop-func');
|
|
7
|
+
const CONSTANT_BINDINGS = new Set(['await using', 'const', 'using']);
|
|
7
8
|
exports.default = (0, util_1.createRule)({
|
|
8
9
|
name: 'no-loop-func',
|
|
9
10
|
meta: {
|
|
10
11
|
type: 'suggestion',
|
|
11
12
|
// defaultOptions, -- base rule does not use defaultOptions
|
|
13
|
+
deprecated: {
|
|
14
|
+
deprecatedSince: '8.64.0',
|
|
15
|
+
replacedBy: [
|
|
16
|
+
{
|
|
17
|
+
rule: {
|
|
18
|
+
name: 'no-loop-func',
|
|
19
|
+
url: 'https://eslint.org/docs/latest/rules/no-loop-func',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
url: 'https://github.com/typescript-eslint/typescript-eslint/issues/12496',
|
|
24
|
+
},
|
|
12
25
|
docs: {
|
|
13
26
|
description: 'Disallow function declarations that contain unsafe references inside loop statements',
|
|
14
27
|
extendsBaseRule: true,
|
|
@@ -100,8 +113,9 @@ exports.default = (0, util_1.createRule)({
|
|
|
100
113
|
if (reference.isTypeReference) {
|
|
101
114
|
return true;
|
|
102
115
|
}
|
|
103
|
-
// Variables which are declared by `const`
|
|
104
|
-
|
|
116
|
+
// Variables which are declared by `const`, `using`, or `await using` are
|
|
117
|
+
// safe. They can't be reassigned, so each iteration captures a fresh one.
|
|
118
|
+
if (CONSTANT_BINDINGS.has(kind)) {
|
|
105
119
|
return true;
|
|
106
120
|
}
|
|
107
121
|
/*
|
package/dist/rules/no-shadow.js
CHANGED
|
@@ -57,7 +57,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
57
57
|
},
|
|
58
58
|
ignoreOnInitialization: {
|
|
59
59
|
type: 'boolean',
|
|
60
|
-
description: 'Whether to ignore the variable initializers when the shadowed variable is presumably still
|
|
60
|
+
description: 'Whether to ignore the variable initializers when the shadowed variable is presumably still uninitialized.',
|
|
61
61
|
},
|
|
62
62
|
ignoreTypeValueShadow: {
|
|
63
63
|
type: 'boolean',
|
|
@@ -21,7 +21,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
21
21
|
properties: {
|
|
22
22
|
allowDestructuring: {
|
|
23
23
|
type: 'boolean',
|
|
24
|
-
description: 'Whether to ignore
|
|
24
|
+
description: 'Whether to ignore destructuring, such as `const { props, state } = this`.',
|
|
25
25
|
},
|
|
26
26
|
allowedNames: {
|
|
27
27
|
type: 'array',
|
|
@@ -173,7 +173,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
173
173
|
}
|
|
174
174
|
return false;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function isUnnecessaryTypeInterpolation({ interpolation, nextQuasi, prevQuasi, }) {
|
|
177
177
|
if (hasCommentsBetweenQuasi(prevQuasi, nextQuasi)) {
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
@@ -337,7 +337,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
const infos = getInterpolationInfos(node).filter(
|
|
340
|
+
const infos = getInterpolationInfos(node).filter(isUnnecessaryTypeInterpolation);
|
|
341
341
|
for (const reportDescriptor of getReportDescriptors(infos)) {
|
|
342
342
|
context.report(reportDescriptor);
|
|
343
343
|
}
|
|
@@ -113,7 +113,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
113
113
|
},
|
|
114
114
|
ignoreRestSiblings: {
|
|
115
115
|
type: 'boolean',
|
|
116
|
-
description: 'Whether to ignore sibling properties in `...`
|
|
116
|
+
description: 'Whether to ignore sibling properties in `...` destructuring.',
|
|
117
117
|
},
|
|
118
118
|
ignoreUsingDeclarations: {
|
|
119
119
|
type: 'boolean',
|
|
@@ -37,7 +37,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
37
37
|
* Check if a given node is an array which all elements are string.
|
|
38
38
|
*/
|
|
39
39
|
function isStringArrayNode(node) {
|
|
40
|
-
const type =
|
|
40
|
+
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node);
|
|
41
41
|
if (checker.isArrayType(type) || checker.isTupleType(type)) {
|
|
42
42
|
const typeArgs = checker.getTypeArguments(type);
|
|
43
43
|
return typeArgs.every(arg => (0, util_1.getTypeName)(checker, arg) === 'string');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.64.0",
|
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"ignore": "^7.0.5",
|
|
50
50
|
"natural-compare": "^1.4.0",
|
|
51
51
|
"ts-api-utils": "^2.5.0",
|
|
52
|
-
"@typescript-eslint/scope-manager": "8.
|
|
53
|
-
"@typescript-eslint/utils": "8.
|
|
54
|
-
"@typescript-eslint/
|
|
55
|
-
"@typescript-eslint/
|
|
52
|
+
"@typescript-eslint/scope-manager": "8.64.0",
|
|
53
|
+
"@typescript-eslint/type-utils": "8.64.0",
|
|
54
|
+
"@typescript-eslint/visitor-keys": "8.64.0",
|
|
55
|
+
"@typescript-eslint/utils": "8.64.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/json-schema": "^7.0.15",
|
|
@@ -76,13 +76,13 @@
|
|
|
76
76
|
"typescript": ">=4.8.4 <6.1.0",
|
|
77
77
|
"unist-util-visit": "^5.0.0",
|
|
78
78
|
"vitest": "^4.0.18",
|
|
79
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.
|
|
80
|
-
"@typescript-eslint/rule-tester": "8.
|
|
79
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.64.0",
|
|
80
|
+
"@typescript-eslint/rule-tester": "8.64.0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
|
84
84
|
"typescript": ">=4.8.4 <6.1.0",
|
|
85
|
-
"@typescript-eslint/parser": "^8.
|
|
85
|
+
"@typescript-eslint/parser": "^8.64.0"
|
|
86
86
|
},
|
|
87
87
|
"funding": {
|
|
88
88
|
"type": "opencollective",
|