fix(eslint-plugin-query): ignore call targets in exhaustive-deps#11067
fix(eslint-plugin-query): ignore call targets in exhaustive-deps#11067Newbie012 wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe ChangesExhaustive-deps call-target handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ESLintAST
participant ASTUtils
participant ExhaustiveDepsUtils
participant RuleTests
ESLintAST->>ASTUtils: Resolve member-expression references
ASTUtils-->>ExhaustiveDepsUtils: Return reference paths
ExhaustiveDepsUtils->>ExhaustiveDepsUtils: Exclude function call targets
ExhaustiveDepsUtils-->>RuleTests: Report remaining missing dependencies
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.ts (1)
319-330: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove dead code.
With the introduction of
isFunctionCallTarget, any identifier that resolves to aCallExpressioncallee is now completely filtered out upstream insideisRelevantReference. Consequently,fullChainNodewill never be aCallExpressioncallee here, making thisifblock mathematically unreachable.You can safely remove this logic that previously stripped method names from dependencies.
♻️ Proposed refactor
- if ( - parent && - parent.type === AST_NODE_TYPES.CallExpression && - parent.callee === fullChainNode - ) { - const segments = fullText.split('.') - if (segments.length > 1) { - dependencyPath = segments.slice(0, -1).join('.') - } - - coversRootMembers = false - }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.ts` around lines 319 - 330, Remove the unreachable parent CallExpression check comparing parent.callee with fullChainNode from the dependency-path logic in the surrounding utility function. Delete its segments/dependencyPath adjustment and coversRootMembers assignment, while preserving the remaining reference processing unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/eslint-plugin-query/src/utils/ast-utils.ts`:
- Around line 146-159: Guard all AST parent accesses before reading .type or
recursing: in packages/eslint-plugin-query/src/utils/ast-utils.ts lines 146-159,
update traverseUpMemberExpression to require parent before inspecting it; in
packages/eslint-plugin-query/src/utils/ast-utils.ts lines 201-215, update
getExternalRefs to handle undefined memberExpression and
memberExpression.parent; and in
packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.ts
lines 64-71, update isFunctionCallTarget to guard callee.parent. Preserve
existing traversal behavior for defined nodes.
---
Nitpick comments:
In
`@packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.ts`:
- Around line 319-330: Remove the unreachable parent CallExpression check
comparing parent.callee with fullChainNode from the dependency-path logic in the
surrounding utility function. Delete its segments/dependencyPath adjustment and
coversRootMembers assignment, while preserving the remaining reference
processing unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e4e4bf5a-33be-4a2c-a727-5ce45e15a09c
📒 Files selected for processing (5)
.changeset/soft-pianos-sip.mddocs/eslint/exhaustive-deps.mdpackages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.tspackages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.tspackages/eslint-plugin-query/src/utils/ast-utils.ts
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected --targets=test:sherif,test:knip,tes... |
❌ Failed | 2m 40s | View ↗ |
nx run-many --target=build --exclude=examples/*... |
❌ Failed | 1m 57s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-07-15 15:43:49 UTC
|
seems like a legit failure: |

Related discussion: #11062
🎯 Changes
The
exhaustive-depsrule no longer requires function call targets in query keys. Query keys should contain the serializable values that identify the returned data, not functions or API clients.Values used inside nested callbacks are still checked:
Computed method names are also checked because they can change the returned data:
The documentation now describes query keys as serializable data identifiers and updates the examples to match.
✅ Checklist
🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
exhaustive-depsESLint rule: query keys no longer need to include function call targets, while values referenced within nested callbacks are still required.Documentation
queryKeys with only the serializable values that identify the data.Tests