TanStack / query

🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
https://tanstack.com/query
MIT License
42.72k stars 2.93k forks source link

[lint]: `no-rest-destructuring` does not report on `useSuspsenseQuery` #8231

Closed SimenB closed 3 weeks ago

SimenB commented 1 month ago

Describe the bug

Presumably just because it's missing from https://github.com/TanStack/query/blob/c61ff1e2f8036afa3f60ed434866e95175a3421c/packages/eslint-plugin-query/src/rules/no-rest-destructuring/no-rest-destructuring.rule.ts#L10

Your minimal, reproducible example

I don't think this is needed - obviously just missing the function from the code? If I'm wrong, happy to put together a repro

Steps to reproduce

function Component() {
  const {data, ...rest} = useSuspenseQuery(getOptions());
}

Expected behavior

The ESLint rule should trigger

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

N/A

Tanstack Query adapter

react-query

TanStack Query version

5.59.16

TypeScript version

5.6.3

Additional context

No response

saul-atomrigs commented 1 month ago

I'm also wondering why only those three hooks 🤔

TkDodo commented 3 weeks ago

yeah we’d need to add the others too. Would you like to contribute this?

TkDodo commented 3 weeks ago

the full list should be:

const queryHooks = ['useQuery', 'useQueries', 'useInfiniteQuery', 'useSuspenseQuery', 'useSuspenseQueries', 'useSuspenseInfiniteQuery']
gyumong commented 3 weeks ago

Can I work on this?

TkDodo commented 3 weeks ago

Yes please