Skip to content
Source
Sign inSign up
TanStack/query

ESLint prefer-query-object-syntax rule dose not fix and raise error useInfiniteQuery #5562

Send to my agent
Closedsay8425(GitHub profile, opens in a new tab) opened this issue 4 comments

Describe the bug

@tanstack/query/prefer-query-object-syntax rule dose not look useInfiniteQuery to a error.

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/old-microservice-g6mfwh?file=%2Fpages%2Findex.js%3A36%2C1-37%2C1

Steps to reproduce

  1. install @tanstack/eslint-plugin-query
  2. configure @tanstack/query/prefer-query-object-syntax rule
  3. run eslint fix

Expected behavior

useInfiniteQuery should be error and can be fixed.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • macOS 13.4
  • Chrome 114

Tanstack Query adapter

None

TanStack Query version

v4.0.10

TypeScript version

v5.0.4

Additional context

I think adding useInfiniteQuery, useIsFetching, useIsMutating into QUERY_CALLS will fix this issue. Is that true, then I will fix it.

  1. TkDodo added labelspackage: eslint-plugin-query

  2. TkDodo added labelsenhancement

  3. yes, it's only implemented for useQuery. Not sure if we have plans to add anything else, because in v5, the rule is removed because the object syntax is the only valid syntax.

    If it's as staightforward as your analysis shows, please go ahead and make a PR with some tests to verify, and I'll happily merge it :)

    @Newbie012 FYI

  4. @TkDodo should I update the rule to catch useInfiniteQuery as well?

  5. @Newbie012 yes please

  6. @TkDodo since we removed prefer-query-object-syntax, should we close this issue?

  7. TkDodo closed this

Sign in to join this conversation.