@typescript-eslint/eslint-plugin 8.32.1-alpha.6 → 8.32.1-alpha.8
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 +1 @@
|
|
1
|
-
{"version":3,"file":"consistent-indexed-object-style.d.ts","sourceRoot":"","sources":["../../src/rules/consistent-indexed-object-style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAanE,MAAM,MAAM,UAAU,GAClB,sBAAsB,GACtB,gCAAgC,GAChC,cAAc,CAAC;AACnB,MAAM,MAAM,OAAO,GAAG,CAAC,iBAAiB,GAAG,QAAQ,CAAC,CAAC;;AAErD,
|
1
|
+
{"version":3,"file":"consistent-indexed-object-style.d.ts","sourceRoot":"","sources":["../../src/rules/consistent-indexed-object-style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAanE,MAAM,MAAM,UAAU,GAClB,sBAAsB,GACtB,gCAAgC,GAChC,cAAc,CAAC;AACnB,MAAM,MAAM,OAAO,GAAG,CAAC,iBAAiB,GAAG,QAAQ,CAAC,CAAC;;AAErD,wBA2OG"}
|
@@ -139,9 +139,7 @@ exports.default = (0, util_1.createRule)({
|
|
139
139
|
const scope = context.sourceCode.getScope(key);
|
140
140
|
const superVar = utils_1.ASTUtils.findVariable(scope, parentId.name);
|
141
141
|
if (superVar) {
|
142
|
-
const isCircular =
|
143
|
-
node.range[0] <= item.identifier.range[0] &&
|
144
|
-
node.range[1] >= item.identifier.range[1]);
|
142
|
+
const isCircular = isDeeplyReferencingType(node.parent, superVar, new Set([parentId]));
|
145
143
|
if (isCircular) {
|
146
144
|
return;
|
147
145
|
}
|
@@ -155,7 +153,9 @@ exports.default = (0, util_1.createRule)({
|
|
155
153
|
...(canFix && {
|
156
154
|
fix: (fixer) => {
|
157
155
|
const keyType = context.sourceCode.getText(constraint);
|
158
|
-
const valueType =
|
156
|
+
const valueType = node.typeAnnotation
|
157
|
+
? context.sourceCode.getText(node.typeAnnotation)
|
158
|
+
: 'any';
|
159
159
|
let recordText = `Record<${keyType}, ${valueType}>`;
|
160
160
|
if (node.optional === '+' || node.optional === true) {
|
161
161
|
recordText = `Partial<${recordText}>`;
|
@@ -201,6 +201,11 @@ function isDeeplyReferencingType(node, superVar, visited) {
|
|
201
201
|
return isDeeplyReferencingType(node.typeAnnotation, superVar, visited);
|
202
202
|
case utils_1.AST_NODE_TYPES.TSIndexedAccessType:
|
203
203
|
return [node.indexType, node.objectType].some(type => isDeeplyReferencingType(type, superVar, visited));
|
204
|
+
case utils_1.AST_NODE_TYPES.TSMappedType:
|
205
|
+
if (node.typeAnnotation) {
|
206
|
+
return isDeeplyReferencingType(node.typeAnnotation, superVar, visited);
|
207
|
+
}
|
208
|
+
break;
|
204
209
|
case utils_1.AST_NODE_TYPES.TSConditionalType:
|
205
210
|
return [
|
206
211
|
node.checkType,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
3
|
-
"version": "8.32.1-alpha.
|
3
|
+
"version": "8.32.1-alpha.8",
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
5
5
|
"files": [
|
6
6
|
"dist",
|
@@ -61,10 +61,10 @@
|
|
61
61
|
},
|
62
62
|
"dependencies": {
|
63
63
|
"@eslint-community/regexpp": "^4.10.0",
|
64
|
-
"@typescript-eslint/scope-manager": "8.32.1-alpha.
|
65
|
-
"@typescript-eslint/type-utils": "8.32.1-alpha.
|
66
|
-
"@typescript-eslint/utils": "8.32.1-alpha.
|
67
|
-
"@typescript-eslint/visitor-keys": "8.32.1-alpha.
|
64
|
+
"@typescript-eslint/scope-manager": "8.32.1-alpha.8",
|
65
|
+
"@typescript-eslint/type-utils": "8.32.1-alpha.8",
|
66
|
+
"@typescript-eslint/utils": "8.32.1-alpha.8",
|
67
|
+
"@typescript-eslint/visitor-keys": "8.32.1-alpha.8",
|
68
68
|
"graphemer": "^1.4.0",
|
69
69
|
"ignore": "^7.0.0",
|
70
70
|
"natural-compare": "^1.4.0",
|
@@ -73,8 +73,8 @@
|
|
73
73
|
"devDependencies": {
|
74
74
|
"@types/mdast": "^4.0.3",
|
75
75
|
"@types/natural-compare": "*",
|
76
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.32.1-alpha.
|
77
|
-
"@typescript-eslint/rule-tester": "8.32.1-alpha.
|
76
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.32.1-alpha.8",
|
77
|
+
"@typescript-eslint/rule-tester": "8.32.1-alpha.8",
|
78
78
|
"@vitest/coverage-v8": "^3.1.3",
|
79
79
|
"ajv": "^6.12.6",
|
80
80
|
"cross-fetch": "*",
|