Closed
Description
Describe the bug
After upgrade to v4.26.2 eslint considers some internal variables inside queryFn as dependencies.
export function useApi() {
return useQuery({
queryKey: ["api"], // Error: The following dependencies are missing in your queryKey: data[0].name
queryFn: async () => {
const response = await fetch(
`https://jsonplaceholder.typicode.com/users`
);
const data = await response.json();
return data[0].name;
},
});
}
Your minimal, reproducible example
Steps to reproduce
- Open codesandbox exaple
- See the error
Expected behavior
No error for scoped variables
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
eslint: 8.35.0
@tanstack/react-query: 4.26.1
@tanstack/eslint-plugin-query: 4.26.2
TanStack Query version
4.26.1
TypeScript version
4.9.5