Skip to content

eslint-plugin-query: exhaustive-deps error not triggered when dependency is nested inside then/catch #6853

Open
@DevHusariaSolutions

Description

@DevHusariaSolutions

Describe the bug

exhaustive-deps triggers only when we use some dependency in non-nested code, but while using then/catch - it cannot detect used dependency.

Your minimal, reproducible example

Steps to reproduce

image
If we nest it in then/catch callbacks, error is not showing.
I know we can use "t" outside whole useQuery hook, it's just for demo. Any other function which would be part of fetchable logic won't trigger error.

Expected behavior

Error should be triggered like in example when we use "t" dependency outside then/catch clauses:
image

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Windows, VSCode

Tanstack Query adapter

react-query

TanStack Query version

5.14.0

TypeScript version

5.1.3

Additional context

Version of eslint-plugin-query: 5.18.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions