@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.
@@ -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
  ]);
@@ -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.traverseUpOnly(identifier, [
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
  );