Skip to content

eslint-plugin-query incorrectly thinks TS generic is dependency #4459

@mckelveygreg

Description

@mckelveygreg

Describe the bug

Love that you are putting out an eslint plugin!! It already found several issues in our codebase.

However, we have a custom hook where a generic can be passed along in order to type the response of an api call. The linter is incorrectly thinking that the TS generic should be a dependency.

error  The following dependencies are missing in your queryKey: Result  @tanstack/query/exhaustive-deps

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-wgscv2?file=src/useGenericHook.ts

Steps to reproduce

  1. Open up terminal in stackblitz
  2. Run yarn lint
  3. Check out error in console from file useGenericHook.ts

Expected behavior

I expect that types shouldn't be a dependency for a query key

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS Mac ventura M1
  • node 18.12.0

react-query version

v4.14.3

TypeScript version

4.8.4

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions