@tanstack/eslint-plugin-query 5.101.2 → 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/legacy/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
|
]);
|
|
@@ -384,7 +394,11 @@ var ExhaustiveDepsUtils = {
|
|
|
384
394
|
return false;
|
|
385
395
|
}
|
|
386
396
|
}
|
|
387
|
-
return reference.identifier.name !== "undefined" && reference.identifier.parent.type !== import_utils3.AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent);
|
|
397
|
+
return reference.identifier.name !== "undefined" && !ExhaustiveDepsUtils.isFunctionCallTarget(reference.identifier) && reference.identifier.parent.type !== import_utils3.AST_NODE_TYPES.NewExpression && !ExhaustiveDepsUtils.isInstanceOfKind(reference.identifier.parent);
|
|
398
|
+
},
|
|
399
|
+
isFunctionCallTarget(identifier) {
|
|
400
|
+
const callee = ASTUtils.traverseUpMemberExpression(identifier);
|
|
401
|
+
return callee.parent !== void 0 && callee.parent.type === import_utils3.AST_NODE_TYPES.CallExpression && callee.parent.callee === callee;
|
|
388
402
|
},
|
|
389
403
|
/**
|
|
390
404
|
* Given required refs and existing queryKey entries, compute missing dependency paths
|
|
@@ -555,11 +569,7 @@ var ExhaustiveDepsUtils = {
|
|
|
555
569
|
*/
|
|
556
570
|
computeRefPath(params) {
|
|
557
571
|
const { identifier, sourceCode } = params;
|
|
558
|
-
const fullChainNode = ASTUtils.
|
|
559
|
-
import_utils3.AST_NODE_TYPES.MemberExpression,
|
|
560
|
-
import_utils3.AST_NODE_TYPES.TSNonNullExpression,
|
|
561
|
-
import_utils3.AST_NODE_TYPES.Identifier
|
|
562
|
-
]);
|
|
572
|
+
const fullChainNode = ASTUtils.traverseUpMemberExpression(identifier);
|
|
563
573
|
const fullText = ExhaustiveDepsUtils.normalizeChain(
|
|
564
574
|
sourceCode.getText(fullChainNode)
|
|
565
575
|
);
|