@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.
@@ -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 referenceNode = ASTUtils.traverseUpOnly(x.identifier, [
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.traverseUpOnly(identifier, [
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
  );