Skip to content

feat(eslint): add type-checked configuration for eslint plugin #8966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Newbie012
Copy link
Collaborator

Created a new configuration for type-checked rules in the ESLint plugin. Added a flat/recommendedTypeChecked config that includes the no-void-query-fn rule which requires TypeScript type information. Added an example project demonstrating the type-checked ESLint setup and updated the documentation to explain how to use it.

Created a new configuration for type-checked rules in the ESLint plugin. Added a `flat/recommendedTypeChecked` config that includes the `no-void-query-fn` rule which requires TypeScript type information. Added an example project demonstrating the type-checked ESLint setup and updated the documentation to explain how to use it.
@Newbie012 Newbie012 requested a review from Copilot April 7, 2025 09:44
@github-actions github-actions bot added documentation Improvements or additions to documentation package: eslint-plugin-query labels Apr 7, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 10 out of 15 changed files in this pull request and generated no comments.

Files not reviewed (5)
  • examples/react/eslint-type-checked/.gitignore: Language not supported
  • examples/react/eslint-type-checked/index.html: Language not supported
  • examples/react/eslint-type-checked/package.json: Language not supported
  • examples/react/eslint-type-checked/tsconfig.json: Language not supported
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

packages/eslint-plugin-query/src/tests/no-void-query-fn.test.ts:11

  • [nitpick] The naming of 'ruleTesterTypeChecked' versus the later 'ruleTester' may be confusing. Consider using consistently descriptive names to clearly differentiate tests for type-checked and non-type-checked scenarios.
const ruleTesterTypeChecked = new RuleTester({

examples/react/eslint-type-checked/eslint.config.js:15

  • Verify that 'projectService' is the correct parser option to enable type-aware linting, as standard configurations often use the 'project' property. If this is a mistake, updating it may help ensure proper type-checking.
projectService: true,

Copy link

nx-cloud bot commented Apr 7, 2025

View your CI Pipeline Execution ↗ for commit 26f5908.

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 51s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-04-07 16:42:59 UTC

Copy link

pkg-pr-new bot commented Apr 7, 2025

More templates

@tanstack/angular-query-devtools-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@8966

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@8966

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@8966

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@8966

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@8966

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@8966

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@8966

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@8966

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@8966

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@8966

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@8966

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@8966

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@8966

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@8966

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@8966

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@8966

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@8966

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@8966

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@8966

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@8966

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@8966

commit: 26f5908

Copy link

github-actions bot commented Apr 7, 2025

Sizes for commit 26f5908:

Branch Bundle Size
Main
This PR

@Newbie012
Copy link
Collaborator Author

@TkDodo I think something is off with the current nx configuration. It seems like test:lib actually depends on build rather than compile. As you can see in the failing CI, some of the pacakges failed to test:lib since they weren't able to import from query-core (since it was only compiled rather than build)

@TkDodo
Copy link
Collaborator

TkDodo commented Apr 7, 2025

It seems like test:lib actually depends on build rather than compile

yes, we are aware and working on it.

@TkDodo
Copy link
Collaborator

TkDodo commented Apr 7, 2025

@Newbie012 I’ve temporarily set build as a dependency for test:lib to work around this problem.

Copy link

codecov bot commented Apr 7, 2025

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 44.30%. Comparing base (97c8d84) to head (26f5908).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8966   +/-   ##
=======================================
  Coverage   44.30%   44.30%           
=======================================
  Files         202      202           
  Lines        8058     8060    +2     
  Branches     1784     1776    -8     
=======================================
+ Hits         3570     3571    +1     
- Misses       4060     4061    +1     
  Partials      428      428           
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 88.08% <ø> (ø)
@tanstack/eslint-plugin-query 88.05% <33.33%> (-0.15%) ⬇️
@tanstack/query-async-storage-persister 43.85% <ø> (ø)
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods 0.00% <ø> (ø)
@tanstack/query-core 94.77% <ø> (ø)
@tanstack/query-devtools 3.61% <ø> (ø)
@tanstack/query-persist-client-core 57.73% <ø> (ø)
@tanstack/query-sync-storage-persister 84.61% <ø> (ø)
@tanstack/react-query 95.42% <ø> (ø)
@tanstack/react-query-devtools 10.00% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 78.48% <ø> (ø)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query 88.15% <ø> (ø)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (ø)
@tanstack/vue-query 71.01% <ø> (ø)
@tanstack/vue-query-devtools ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation package: eslint-plugin-query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants