Closed nickrttn closed 1 month ago
The ESLint rule @tanstack/query/exhaustive-deps reports false positive missing dependencies when using optional chaining in the queryKey.
@tanstack/query/exhaustive-deps
queryKey
https://stackblitz.com/edit/stackblitz-starters-rqku3u?file=app%2Fuse-users.ts
npx eslint .
I would not expect an error to be shown when linting. I would expect the optional chaining to be valid.
Every time
react-query
5.45.1
5.6.2
No response
do you want to work on this @nickrttn ?
Sure! I can take a look
This got fixed with:
Describe the bug
The ESLint rule
@tanstack/query/exhaustive-deps
reports false positive missing dependencies when using optional chaining in thequeryKey
.Your minimal, reproducible example
https://stackblitz.com/edit/stackblitz-starters-rqku3u?file=app%2Fuse-users.ts
Steps to reproduce
npx eslint .
in the terminalExpected behavior
I would not expect an error to be shown when linting. I would expect the optional chaining to be valid.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
Tanstack Query adapter
react-query
TanStack Query version
5.45.1
TypeScript version
5.6.2
Additional context
No response