Skip to content

fix(eslint-plugin-query): recognize query client methods - #11513

Open
DogPawHat wants to merge 3 commits into
TanStack:mainfrom
DogPawHat:migrate-deprecated-query-client-tests
Open

DogPawHat wants to merge 3 commits into
TanStack:mainfrom
DogPawHat:migrate-deprecated-query-client-tests

Conversation

@DogPawHat

@DogPawHat DogPawHat commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

🎯 Changes

  • Update prefer-query-options for query and infiniteQuery
  • Refresh infinite-query type tests and lint rule coverage

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 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

    • The prefer-query-options ESLint rule now recognizes queryClient.query and queryClient.infiniteQuery calls and flags inline query options appropriately.
  • Tests

    • Updated validation coverage for current Query Client APIs across supported frameworks.
    • Refined type checks for infinite queries and page parameter handling.
    • Improved coverage for prefetched query caching and garbage-collection timing.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6ee96b2e-1c22-454e-ad32-54408dc1c150

📥 Commits

Reviewing files that changed from the base of the PR and between 9827188 and 2217395.

📒 Files selected for processing (1)
  • packages/query-core/src/__tests__/queryClient.test.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The PR updates prefer-query-options for query and infiniteQuery, updates related ESLint and type tests, removes deprecated method assertions, and strengthens one query cache test.

Changes

QueryClient tooling alignment

Layer / File(s) Summary
Recognize current QueryClient methods
packages/eslint-plugin-query/src/rules/..., packages/eslint-plugin-query/src/__tests__/prefer-query-options.test.ts, .changeset/tough-queries-listen.md
The rule and tests now cover query and infiniteQuery calls.
Update query function return tests
packages/eslint-plugin-query/src/__tests__/no-void-query-fn.test.ts
The tests replace deprecated QueryClient methods with query and infiniteQuery cases.
Align infinite-query type tests
packages/angular-query-experimental/..., packages/preact-query/..., packages/react-query/..., packages/solid-query/..., packages/svelte-query/...
The type tests remove deprecated method assertions and verify queryClient.infiniteQuery page-parameter typing.
Strengthen prefetched query cache test
packages/query-core/src/__tests__/queryClient.test.tsx
The test now verifies resolved cached data before garbage collection advances.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: tkdodo

Merge Risk: ⚪ Minimal · up to 22173

The changes align ESLint and type-test coverage with current QueryClient methods, with no unresolved production risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: updating the ESLint plugin to recognize query client methods.
Description check ✅ Passed The description includes all required sections, explains the changes, completes the checklist, and records the changeset for the published-code impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 6…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

Comment @coderabbitai help to get the list of available commands.

@DogPawHat
DogPawHat force-pushed the migrate-deprecated-query-client-tests branch from c5d6919 to 62ebee2 Compare September 16, 2026 16:32
'ensureQueryData',
'ensureInfiniteQueryData',
]
const queryClientOptionMethods = ['query', 'infiniteQuery']

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just widen the list, queryOptions are still preferred even for the deprecated options. Deleting the tests is fine

@DogPawHat
DogPawHat marked this pull request as ready for review September 17, 2026 12:03
- Update prefer-query-options for `query` and `infiniteQuery`
- Refresh infinite-query type tests and lint rule coverage
@DogPawHat
DogPawHat force-pushed the migrate-deprecated-query-client-tests branch from 9e6a651 to 9827188 Compare September 17, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants