const getQuery = () => ({
queryKey: ['foo'],
queryFn: () => Promise.resolve(5)
})
return useQuery(getQuery())
⬆️ ESLint: Objects syntax for useQuery is preferred(@tanstack/query/prefer-query-object-syntax)
what's more dangerous, it even auto fixes this to:
return useQuery({ queryKey: getQuery() })
which is wrong.
As a workaround, we have to create a new object and spread:
useQuery({ ...getQuery() })
The wrong auto-fix is a big problem I think because it will convert working code to non-working code :/