fix(eslint-plugin): exhaustive-deps with variables and type assertions (#9643) #9687
main fromrefs/pull/9687/head·merged by TkDodo View on GitHub🎯 Changes#
Recursively dereference variables and type assertions in query keys.
Also dereference even if the referenced expression is not an array expression.
Fixes #9643
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested this code locally with
pnpm test:pr.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Summary by CodeRabbit#
New Features
- Better recognition of stable query keys produced by factory functions and assigned variables.
Bug Fixes
- Reduced false positives for exhaustive-deps by handling const assertions and dereferenced variable query keys.
Refactor
- Centralized and safer query-key resolution to improve reliability and avoid recursion issues.
Tests
- Added tests for factory-produced keys, variable assignments, and const-assertion scenarios.
Chores
- Added changeset entry for a patch release.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: eslint-plugin-query
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between cd290631abacc9aa1f73e18e16f471bb2ceca94e and 960b27dc339995e0aef2a49d0d73e0390a627b78.
📒 Files selected for processing (2)
packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.ts(2 hunks)packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.ts (1)
packages/eslint-plugin-query/src/__tests__/test-utils.ts (1)
normalizeIndent(3-7)
🪛 Biome (2.1.2)
packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts
[error] 175-178: Other switch clauses can erroneously access this declaration. Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Safe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
🔇 Additional comments (2)
packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.ts (2)
229-260: Great coverage for the query key factory regressionCodifies the exact reproduction from #9643, and the paired variant with layered const assertions ensures the new dereferencing logic handles call expressions and returned tuples without flagging false positives. Nicely done.
283-305: Const assertion scenarios nicely capturedThese two cases exercise both the “assert at usage site” and “assert at declaration” pathways, giving strong confidence that recursive dereferencing now accounts for TypeScript
as constchains.@@ -182,3 +164,21 @@182164183165 return queryFn.value.consequent184166 }167+168+function dereferenceVariablesAndTypeAssertions(queryKeyNode: TSESTree.Node, context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>) {169+ for (let i = 0; i < (1 << 16); ++i) {170+ switch (queryKeyNode.type) {171+ case AST_NODE_TYPES.TSAsExpression:172+ queryKeyNode = queryKeyNode.expression173+ break174+ case AST_NODE_TYPES.Identifier:175+ const expression = ASTUtils.getReferencedExpressionByIdentifier({176+ context,177+ node: queryKeyNode,178+ })179+180+ if (expression == null) {181+ return queryKeyNode182+ }183+ queryKeyNode = expression184+ break⚠️ Potential issue | 🔴 Critical
Wrap the Identifier case in a block to satisfy
noSwitchDeclarations.Line 175 defines
const expressiondirectly in theswitchwithout its own block. Biome raises this asnoSwitchDeclarations, which will fail the lint pipeline. Wrap the clause in braces so the lexical binding stays scoped to that case.- case AST_NODE_TYPES.Identifier: - const expression = ASTUtils.getReferencedExpressionByIdentifier({ - context, - node: queryKeyNode, - }) - - if (expression == null) { - return queryKeyNode - } - queryKeyNode = expression - break + case AST_NODE_TYPES.Identifier: { + const expression = ASTUtils.getReferencedExpressionByIdentifier({ + context, + node: queryKeyNode, + }) + + if (expression == null) { + return queryKeyNode + } + queryKeyNode = expression + break + }📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
case AST_NODE_TYPES.Identifier: { const expression = ASTUtils.getReferencedExpressionByIdentifier({ context, node: queryKeyNode, }) if (expression == null) { return queryKeyNode } queryKeyNode = expression break }🧰 Tools
🪛 Biome (2.1.2)
[error] 175-178: Other switch clauses can erroneously access this declaration. Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Safe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
🤖 Prompt for AI Agents
In packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts around lines 174 to 184, the Identifier case in the switch declares a const directly and triggers the noSwitchDeclarations lint rule; wrap the entire case body in a block (add { } around the statements) so the const expression is block-scoped, leaving the logic unchanged and ensuring the lexical binding is scoped to that case.Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 960b27dc339995e0aef2a49d0d73e0390a627b78 and 48acd04fd7b97bc1420b34523071c987e86d7608.
📒 Files selected for processing (1)
packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts(2 hunks)
🔇 Additional comments (2)
packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts (2)
68-68: Good call centralizing dereferencing; confirm fixer intent across variable initializers.Using the dereferenced node enables correct key analysis and now allows fixing array literals defined via variables. Please confirm it's intended that the fixer edits the variable’s initializer (when the array literal is defined elsewhere in the same file) rather than the queryKey property usage.
175-186: noSwitchDeclarations resolved.Wrapping the Identifier case body in braces fixes the Biome lint error. LGTM.
@@ -184,0 +171,21 @@171+ case AST_NODE_TYPES.TSAsExpression:172+ queryKeyNode = queryKeyNode.expression173+ break174+ case AST_NODE_TYPES.Identifier: {175+ const expression = ASTUtils.getReferencedExpressionByIdentifier({176+ context,177+ node: queryKeyNode,178+ })179+180+ if (expression == null) {181+ return queryKeyNode182+ }183+ queryKeyNode = expression184+ break185+ }186+ default:187+ return queryKeyNode188+ }189+ }190+ throw new Error('Recursion limit reached.')191+}⚠️ Potential issue | 🟠 Major
Avoid crashing ESLint on deep/cyclic derefs; add cycle guard and broaden unwraps.
Throwing here can crash linting on cyclic aliases. Guard with a visited set and bail out; also unwrap additional TS wrappers (type assertions, non‑null, parens, satisfies) to cover more real‑world cases.
Apply this diff:
-function dereferenceVariablesAndTypeAssertions(queryKeyNode: TSESTree.Node, context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>) { - for (let i = 0; i < (1 << 16); ++i) { - switch (queryKeyNode.type) { - case AST_NODE_TYPES.TSAsExpression: - queryKeyNode = queryKeyNode.expression - break - case AST_NODE_TYPES.Identifier: { - const expression = ASTUtils.getReferencedExpressionByIdentifier({ - context, - node: queryKeyNode, - }) - - if (expression == null) { - return queryKeyNode - } - queryKeyNode = expression - break - } - default: - return queryKeyNode - } - } - throw new Error('Recursion limit reached.') -} +function dereferenceVariablesAndTypeAssertions( + queryKeyNode: TSESTree.Node, + context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>, +) { + const MAX_STEPS = 1 << 10 + const visited = new Set<TSESTree.Node>() + + for (let i = 0; i < MAX_STEPS; ++i) { + if (visited.has(queryKeyNode)) { + return queryKeyNode + } + visited.add(queryKeyNode) + + switch (queryKeyNode.type) { + case AST_NODE_TYPES.TSAsExpression: + case AST_NODE_TYPES.TSTypeAssertion: + case AST_NODE_TYPES.TSNonNullExpression: + case AST_NODE_TYPES.ParenthesizedExpression: + case AST_NODE_TYPES.TSSatisfiesExpression: + queryKeyNode = queryKeyNode.expression + break + case AST_NODE_TYPES.Identifier: { + const expression = ASTUtils.getReferencedExpressionByIdentifier({ + context, + node: queryKeyNode, + }) + if (expression == null) { + return queryKeyNode + } + queryKeyNode = expression + break + } + default: + return queryKeyNode + } + } + // Bail out quietly if depth exceeded; don't crash the linter. + return queryKeyNode +}📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
function dereferenceVariablesAndTypeAssertions( queryKeyNode: TSESTree.Node, context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>, ) { const MAX_STEPS = 1 << 10 const visited = new Set<TSESTree.Node>() for (let i = 0; i < MAX_STEPS; ++i) { if (visited.has(queryKeyNode)) { return queryKeyNode } visited.add(queryKeyNode) switch (queryKeyNode.type) { case AST_NODE_TYPES.TSAsExpression: case AST_NODE_TYPES.TSTypeAssertion: case AST_NODE_TYPES.TSNonNullExpression: case AST_NODE_TYPES.ParenthesizedExpression: case AST_NODE_TYPES.TSSatisfiesExpression: queryKeyNode = queryKeyNode.expression break case AST_NODE_TYPES.Identifier: { const expression = ASTUtils.getReferencedExpressionByIdentifier({ context, node: queryKeyNode, }) if (expression == null) { return queryKeyNode } queryKeyNode = expression break } default: return queryKeyNode } } // Bail out quietly if depth exceeded; don't crash the linter. return queryKeyNode }🤖 Prompt for AI Agents
In packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts around lines 168 to 191, the current dereferenceVariablesAndTypeAssertions loop throws on deep or cyclic dereferences which can crash ESLint; replace the fixed-iteration guard with a visited-node guard and broaden the set of AST node types you unwrap. Implement a Set to track visited nodes and return the current node if revisited to bail on cycles, and in the switch/unwrap logic handle additional wrappers such as TSNonNullExpression, ParenthesizedExpression, TSSatisfiesExpression (and any other TypeScript wrapper nodes your parser emits), plus any ChainExpression/optional wrappers you need; keep returning the dereferenced node when nothing more can be unwrapped.✅ Addressed in commit 877669f
yeah I would prefer if we didn’t crash, even when the deref limit is reached, we should just silently maybe return nothing?
@TkDodo You're absolutely right! CodeRabbit's suggested implementation actually already handles this correctly - it returns
queryKeyNodeinstead of throwing when the limit is reached:// Bail out quietly if depth exceeded; don't crash the linter. return queryKeyNodeThis approach is perfect because:
- No crashes: The linter continues running even with deep/cyclic references
- Type safety: Still returns a valid
TSESTree.Node - Graceful degradation: Falls back to using the current node as-is, which means the rule may miss some dependencies but won't break
The cycle detection with the
visitedSet is also a nice touch to handle circular references more efficiently before hitting the step limit.The suggested implementation strikes the right balance - it unwraps as much as it safely can, then gracefully bails out without disrupting the linting process.
Hi!
I agree that the current behavior (false positive) is an actual bug and should be fixed, but are we sure we want to support query key factory? it can get quite complicated; I'll give a basic example:
const createKey = (id) => ["foo"]; function useHook({ id }) { return useQuery({ queryKey: createKey({ id }), ... }); // Should it be an error? since `createKey` doesn't pass the `id` to the final array. }I'm not against supporting it, but it's important to note that if we're going to support it, we should decide how ‘deep’ we want to get into this, especially now that
queryOptionsis built in and somewhat simplifies the query keys management.Thoughts? @TkDodo
I was under the impression that query key factories are already (partially) supported. Given your example, I understand that the support isn't perfect, and probably never will be. However, I would have thought that this PR touches query key factory support only peripherally.
I think the example is somewhat flawed because why would you a pass a value (id) to a key factory if it has no influence on the key whatsoever? So yes, this should error, because for all we know, you call a function with
idand it’s not part of the key, so it’s missing.🦋 Changeset detected#
Latest commit: e21267d2a568e9e7aeceac0e45ae28fa15f9bc27
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Name Type @tanstack/eslint-plugin-query Patch Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
View your CI Pipeline Execution ↗ for commit e21267d2a568e9e7aeceac0e45ae28fa15f9bc27
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 45s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 5s View ↗
☁️ Nx Cloud last updated this comment at
2025-09-26 13:13:51UTCActionable comments posted: 0
🧹 Nitpick comments (1)
.changeset/cold-falcons-warn.md (1)
5-6: Tighten the changeset message and auto‑link the issue.Make the summary more descriptive and add “Fixes #9643” so GitHub auto‑closes the issue.
Apply this diff:
-fix: exhaustive-deps with variables and type assertions +fix(exhaustive-deps): recursively dereference identifiers and TS assertions in query keys (variables, as-const), even when the referenced expression is not an array; avoid crashes on cycles + +Fixes #9643📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 877669f6d600146d45c1899f33ea87ffb718fb60 and 0740c7eafc87f60691a7ded9346eacdbf5fe0488.
📒 Files selected for processing (2)
.changeset/cold-falcons-warn.md(1 hunks)packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-02T17:57:33.184Z
Learnt from: TkDodo PR: TanStack/query#9612 File: packages/query-async-storage-persister/src/asyncThrottle.ts:0-0 Timestamp: 2025-09-02T17:57:33.184Z Learning: When importing from tanstack/query-core in other TanStack Query packages like query-async-storage-persister, a workspace dependency "tanstack/query-core": "workspace:*" needs to be added to the package.json.Applied to files:
.changeset/cold-falcons-warn.md
🧬 Code graph analysis (1)
packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts (1)
packages/eslint-plugin-query/src/utils/ast-utils.ts (1)
ASTUtils(5-391)
🔇 Additional comments (2)
packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts (2)
68-71: Good call: centralizing deref logic.Using a helper for dereferencing reduces duplication and keeps the main rule readable.
171-204: Expand unwrapping to cover all type wrappers AddTSTypeAssertion,TSNonNullExpression,ParenthesizedExpression, andTSSatisfiesExpressionto the switch indereferenceVariablesAndTypeAssertions, bump the iteration limit (MAX_STEPS = 1 << 10), and renamevisitedNodestovisited:function dereferenceVariablesAndTypeAssertions( queryKeyNode: TSESTree.Node, context: Readonly<TSESLint.RuleContext<string, ReadonlyArray<unknown>>>, ) { - const visitedNodes = new Set<TSESTree.Node>() + const MAX_STEPS = 1 << 10 + const visited = new Set<TSESTree.Node>() - for (let i = 0; i < 1 << 8; ++i) { - if (visitedNodes.has(queryKeyNode)) { + for (let i = 0; i < MAX_STEPS; ++i) { + if (visited.has(queryKeyNode)) return queryKeyNode + visited.add(queryKeyNode) switch (queryKeyNode.type) { - case AST_NODE_TYPES.TSAsExpression: + case AST_NODE_TYPES.TSAsExpression: + case AST_NODE_TYPES.TSTypeAssertion: + case AST_NODE_TYPES.TSNonNullExpression: + case AST_NODE_TYPES.ParenthesizedExpression: + case AST_NODE_TYPES.TSSatisfiesExpression: queryKeyNode = queryKeyNode.expression break …My goal in the example was to show that, while we could validate that all required args were passed to the query key factory, it doesn’t really "cut it". I tried to keep the example minimal even though it’s not very practical. A better example might look like this:
const createKey = (id) => { const mock = id > 0; return ["foo", mock]; // user forgot to also pass the `id` }; function useHook({ id }) { return useQuery({ queryKey: createKey({ id }), ... }); }Ensuring that
idexists in the returned array can get complicated in cases where a function has multiplereturnstatements or aliases the original argument.
But maybe I'm overthinking it and we should support it as a "best-effort" solution.
LGTM @fbieler 🙂
Newbie012(GitHub profile, opens in a new tab) approved these changes
More templates
- @tanstack/query-example-angular-auto-refetching
- @tanstack/query-example-angular-basic
- @tanstack/query-example-angular-basic-persister
- @tanstack/query-example-angular-devtools-panel
- @tanstack/query-example-angular-infinite-query-with-max-pages
- @tanstack/query-example-angular-optimistic-updates
- @tanstack/query-example-angular-pagination
- @tanstack/query-example-angular-query-options-from-a-service
- @tanstack/query-example-angular-router
- @tanstack/query-example-angular-rxjs
- @tanstack/query-example-angular-simple
- @tanstack/query-example-solid-astro
- @tanstack/query-example-solid-basic
- @tanstack/query-example-solid-basic-graphql-request
- @tanstack/query-example-solid-default-query-function
- @tanstack/query-example-solid-simple
- @tanstack/query-example-solid-start-streaming
- @tanstack/query-example-react-algolia
- @tanstack/query-example-react-auto-refetching
- @tanstack/query-example-react-basic
- @tanstack/query-example-react-basic-graphql-request
- @tanstack/query-example-chat
- @tanstack/query-example-react-default-query-function
- @tanstack/query-example-react-devtools-panel
- @tanstack/query-example-eslint-legacy
- @tanstack/query-example-react-infinite-query-with-max-pages
- @tanstack/query-example-react-load-more-infinite-scroll
- @tanstack/query-example-react-nextjs
- @tanstack/query-example-react-nextjs-app-prefetching
- @tanstack/query-example-nextjs-suspense-streaming
- @tanstack/query-example-react-offline
- @tanstack/query-example-react-optimistic-updates-cache
- @tanstack/query-example-react-optimistic-updates-ui
- @tanstack/query-example-react-pagination
- @tanstack/query-example-react-playground
- @tanstack/query-example-react-prefetching
- @tanstack/query-example-react-react-native
- @tanstack/query-example-react-router
- @tanstack/query-example-react-rick-morty
- @tanstack/query-example-react-shadow-dom
- @tanstack/query-example-react-simple
- @tanstack/query-example-react-star-wars
- @tanstack/query-example-react-suspense
- @tanstack/query-example-svelte-auto-refetching
- @tanstack/query-example-svelte-basic
- @tanstack/query-example-svelte-load-more-infinite-scroll
- @tanstack/query-example-svelte-optimistic-updates
- @tanstack/query-example-svelte-playground
- @tanstack/query-example-svelte-simple
- @tanstack/query-example-svelte-ssr
- @tanstack/query-example-svelte-star-wars
- @tanstack/query-example-vue-2.6-basic
- @tanstack/query-example-vue-2.7-basic
- @tanstack/query-example-vue-basic
- @tanstack/query-example-vue-dependent-queries
- @tanstack/query-example-vue-nuxt3
- @tanstack/query-example-vue-persister
- @tanstack/query-example-vue-simple
@tanstack/angular-query-experimental
npm i https://pkg.pr.new/@tanstack/angular-query-experimental@9687@tanstack/eslint-plugin-query
npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@9687@tanstack/query-async-storage-persister
npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@9687@tanstack/query-broadcast-client-experimental
npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@9687@tanstack/query-core
npm i https://pkg.pr.new/@tanstack/query-core@9687@tanstack/query-devtools
npm i https://pkg.pr.new/@tanstack/query-devtools@9687@tanstack/query-persist-client-core
npm i https://pkg.pr.new/@tanstack/query-persist-client-core@9687@tanstack/query-sync-storage-persister
npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@9687@tanstack/react-query
npm i https://pkg.pr.new/@tanstack/react-query@9687@tanstack/react-query-devtools
npm i https://pkg.pr.new/@tanstack/react-query-devtools@9687@tanstack/react-query-next-experimental
npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@9687@tanstack/react-query-persist-client
npm i https://pkg.pr.new/@tanstack/react-query-persist-client@9687@tanstack/solid-query
npm i https://pkg.pr.new/@tanstack/solid-query@9687@tanstack/solid-query-devtools
npm i https://pkg.pr.new/@tanstack/solid-query-devtools@9687@tanstack/solid-query-persist-client
npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@9687@tanstack/svelte-query
npm i https://pkg.pr.new/@tanstack/svelte-query@9687@tanstack/svelte-query-devtools
npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@9687@tanstack/svelte-query-persist-client
npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@9687@tanstack/vue-query
npm i https://pkg.pr.new/@tanstack/vue-query@9687@tanstack/vue-query-devtools
npm i https://pkg.pr.new/@tanstack/vue-query-devtools@9687commit:
e21267dCodecov Report#
:x: Patch coverage is
85.00000%with3 linesin your changes missing coverage. Please review. :white_check_mark: Project coverage is 83.03%. Comparing base (8e42926) to head (e21267d). :warning: Report is 4 commits behind head on main.Additional details and impacted files
@@ Coverage Diff @@ ## main #9687 +/- ## =========================================== + Coverage 46.38% 83.03% +36.65% =========================================== Files 214 19 -195 Lines 8488 560 -7928 Branches 1929 206 -1723 =========================================== - Hits 3937 465 -3472 + Misses 4108 73 -4035 + Partials 443 22 -421Components Coverage Δ @tanstack/angular-query-experimental ∅ <ø> (∅)@tanstack/eslint-plugin-query 83.03% <85.00%> (-0.21%):arrow_down: @tanstack/query-async-storage-persister ∅ <ø> (∅)@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)@tanstack/query-codemods ∅ <ø> (∅)@tanstack/query-core ∅ <ø> (∅)@tanstack/query-devtools ∅ <ø> (∅)@tanstack/query-persist-client-core ∅ <ø> (∅)@tanstack/query-sync-storage-persister ∅ <ø> (∅)@tanstack/query-test-utils ∅ <ø> (∅)@tanstack/react-query ∅ <ø> (∅)@tanstack/react-query-devtools ∅ <ø> (∅)@tanstack/react-query-next-experimental ∅ <ø> (∅)@tanstack/react-query-persist-client ∅ <ø> (∅)@tanstack/solid-query ∅ <ø> (∅)@tanstack/solid-query-devtools ∅ <ø> (∅)@tanstack/solid-query-persist-client ∅ <ø> (∅)@tanstack/svelte-query ∅ <ø> (∅)@tanstack/svelte-query-devtools ∅ <ø> (∅)@tanstack/svelte-query-persist-client ∅ <ø> (∅)@tanstack/vue-query ∅ <ø> (∅)@tanstack/vue-query-devtools ∅ <ø> (∅):rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
TkDodo merged this24a2266
TkDodo closed this
Sign in to join this conversation.
Walkthrough#
Replaces inline unwrapping in the exhaustive-deps rule with a centralized dereference helper and adds valid tests for query key factories and const-assertion scenarios so dereferenced/const-asserted variables are treated as stable query keys.
Changes#
packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.tsdereferenceVariablesAndTypeAssertions(...)which iteratively unwraps TSAs and resolves Identifiers with a recursion guard; main rule uses the resolved node for dependency analysis.packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.tsuseQuery, and two const-assertion cases (dereference and variable-assigned) recognized as stable..changeset/cold-falcons-warn.mdSequence Diagram(s)#
Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem#
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
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.
❤️ Share