@tanstack/eslint-plugin-query 5.101.3 → 5.101.4
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/build/legacy/_tsup-dts-rollup.d.cts +2 -0
- package/build/legacy/_tsup-dts-rollup.d.ts +2 -0
- package/build/legacy/{chunk-WVNZFPYE.js → chunk-25PZGVEE.js} +18 -8
- package/build/legacy/chunk-25PZGVEE.js.map +1 -0
- package/build/legacy/index.cjs +17 -7
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.js +1 -1
- package/build/legacy/rules.cjs +17 -7
- package/build/legacy/rules.cjs.map +1 -1
- package/build/legacy/rules.js +1 -1
- package/build/modern/_tsup-dts-rollup.d.cts +2 -0
- package/build/modern/_tsup-dts-rollup.d.ts +2 -0
- package/build/modern/{chunk-VALYN6GR.js → chunk-LDCUUAIY.js} +18 -8
- package/build/modern/chunk-LDCUUAIY.js.map +1 -0
- package/build/modern/index.cjs +17 -7
- package/build/modern/index.cjs.map +1 -1
- package/build/modern/index.js +1 -1
- package/build/modern/rules.cjs +17 -7
- package/build/modern/rules.cjs.map +1 -1
- package/build/modern/rules.js +1 -1
- package/package.json +1 -1
- package/src/rules/exhaustive-deps/exhaustive-deps.utils.ts +14 -5
- package/src/utils/ast-utils.ts +31 -4
- package/build/legacy/chunk-WVNZFPYE.js.map +0 -1
- package/build/modern/chunk-VALYN6GR.js.map +0 -1
package/build/modern/rules.cjs
CHANGED
|
@@ -137,6 +137,13 @@ var ASTUtils = {
|
|
|
137
137
|
}
|
|
138
138
|
return identifier;
|
|
139
139
|
},
|
|
140
|
+
traverseUpMemberExpression(node) {
|
|
141
|
+
const parent = node.parent;
|
|
142
|
+
if (parent !== void 0 && (parent.type === import_utils.AST_NODE_TYPES.MemberExpression && parent.object === node || parent.type === import_utils.AST_NODE_TYPES.ChainExpression || parent.type === import_utils.AST_NODE_TYPES.TSNonNullExpression)) {
|
|
143
|
+
return ASTUtils.traverseUpMemberExpression(parent);
|
|
144
|
+
}
|
|
145
|
+
return node;
|
|
146
|
+
},
|
|
140
147
|
isDeclaredInNode(params) {
|
|
141
148
|
const { functionNode, reference, scopeManager } = params;
|
|
142
149
|
const scope = scopeManager.acquire(functionNode);
|
|
@@ -159,7 +166,10 @@ var ASTUtils = {
|
|
|
159
166
|
return references2;
|
|
160
167
|
};
|
|
161
168
|
const references = collectReferences(scope).filter((x) => x.isRead() && !scope.set.has(x.identifier.name)).map((x) => {
|
|
162
|
-
const
|
|
169
|
+
const memberPath = ASTUtils.traverseUpMemberExpression(x.identifier);
|
|
170
|
+
const memberExpression = memberPath.parent;
|
|
171
|
+
const isComputedCallProperty = memberExpression !== void 0 && memberExpression.type === import_utils.AST_NODE_TYPES.MemberExpression && memberExpression.computed && memberExpression.property === memberPath && memberExpression.parent.type === import_utils.AST_NODE_TYPES.CallExpression && memberExpression.parent.callee === memberExpression;
|
|
172
|
+
const referenceNode = isComputedCallProperty ? memberPath : ASTUtils.traverseUpOnly(x.identifier, [
|
|
163
173
|
import_utils.AST_NODE_TYPES.MemberExpression,
|
|
164
174
|
import_utils.AST_NODE_TYPES.Identifier
|
|
165
175
|
]);
|
|
@@ -380,7 +390,11 @@ var ExhaustiveDepsUtils = {
|
|
|
380
390
|
return false;
|
|
381
391
|
}
|
|
382
392
|
}
|
|
383
|
-
return reference.identifier.name !== "undefined" && reference.identifier.parent.type !== import_utils3.AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent);
|
|
393
|
+
return reference.identifier.name !== "undefined" && !ExhaustiveDepsUtils.isFunctionCallTarget(reference.identifier) && reference.identifier.parent.type !== import_utils3.AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent);
|
|
394
|
+
},
|
|
395
|
+
isFunctionCallTarget(identifier) {
|
|
396
|
+
const callee = ASTUtils.traverseUpMemberExpression(identifier);
|
|
397
|
+
return callee.parent !== void 0 && callee.parent.type === import_utils3.AST_NODE_TYPES.CallExpression && callee.parent.callee === callee;
|
|
384
398
|
},
|
|
385
399
|
/**
|
|
386
400
|
* Given required refs and existing queryKey entries, compute missing dependency paths
|
|
@@ -551,11 +565,7 @@ var ExhaustiveDepsUtils = {
|
|
|
551
565
|
*/
|
|
552
566
|
computeRefPath(params) {
|
|
553
567
|
const { identifier, sourceCode } = params;
|
|
554
|
-
const fullChainNode = ASTUtils.
|
|
555
|
-
import_utils3.AST_NODE_TYPES.MemberExpression,
|
|
556
|
-
import_utils3.AST_NODE_TYPES.TSNonNullExpression,
|
|
557
|
-
import_utils3.AST_NODE_TYPES.Identifier
|
|
558
|
-
]);
|
|
568
|
+
const fullChainNode = ASTUtils.traverseUpMemberExpression(identifier);
|
|
559
569
|
const fullText = ExhaustiveDepsUtils.normalizeChain(
|
|
560
570
|
sourceCode.getText(fullChainNode)
|
|
561
571
|
);
|