-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
exhaustive-deps doesn't understand function call for query key #7077
Comments
we have tests for this, so please show a reproduction: query/packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.ts Lines 142 to 156 in 7b7cc2f
|
Here's a reproduction: https://stackblitz.com/edit/vitejs-vite-hutlfq?file=src%2Fhooks.ts |
thanks for the reproduction. it really seems to be a bug around This yields no lint error:
but this does:
@Newbie012 could you have a look at this? |
That was quick! Thank you very much! |
Describe the bug
We want to offer comfort hooks to query and invalidate calls. Of course, they need to use the same query key, so we extracted it like this:
In practice, this works perfectly. However, the eslint-plugin
exhaustive-deps
doesn't understand thatid
is contained in the query key.Your minimal, reproducible example
n/a
Steps to reproduce
see above
Expected behavior
I expect the hook to understand that
id
is used in the query key factory, but it's not.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
react-query
TanStack Query version
@tanstack/eslint-plugin-query@5.20.1
TypeScript version
5.3.3
Additional context
No response
The text was updated successfully, but these errors were encountered: