-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Description
After upgrading from 4.15.1 to 4.24.8, I have seen two false-positives for the exhaustive-deps rule in our product. I've narrowed it down and created failing test cases
new Error('')in thequeryFnerrors with:
'The following dependencies are missing in your queryKey: Error'
failing test-case to reproduce:
{
name: 'should not treat new Error as missing dependency',
code: normalizeIndent`
useQuery({
queryKey: ['foo'],
queryFn: () => Promise.reject(new Error('1')),
})
`,
},
- it fails to work if there is an inline
constassertion:
failing test-case to reproduce
{
name: 'should see id when there is a const assertion',
code: normalizeIndent`
const useX = (id: number) => {
return useQuery({
queryKey: ['foo', id] as const,
queryFn: async () => id,
})
}
`,
},
it errors with:
'The following dependencies are missing in your queryKey: id'`
note that it works fine if you remove as const.
@Newbie012 fyi