-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Description
Describe the bug
When using the following config for exhaustive-deps:
"@tanstack/query/exhaustive-deps": ["error", {"allowlist": {"variables": ["ignored"]} }]This code produces an error:
export const incorrect = () => {
const ignored = {
run: () => new Promise()
}
useQuery({
queryKey: ["test"],
queryFn: () => ignored
.run() // 💥
});
};However, if we change the formatting, the error disappears:
export const correct = () => {
const ignored = {
run: () => new Promise()
}
useQuery({
queryKey: ["test"],
queryFn: () => ignored.run() // ✅
});
};Your minimal, reproducible example
https://github.com/antoine-cottineau/tanstack-query-eslint-plugin-bug/tree/main
Steps to reproduce
- run
yarn install - run
yarn lint
An error is found in the incorrect function but not in the correct one, even if the only difference is formatting.
Expected behavior
No error should be reported, whatever the formatting.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
- OS: MacOS
- Browser: Brave
- Version: 1.88.134
Tanstack Query adapter
react-query
TanStack Query version
v5.95.2
TypeScript version
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels