📄 tanstack/query/latest/docs/eslint/eslint-plugin-query

File: eslint-plugin-query.md | Updated: 11/15/2025

Source: https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query



TanStack

Query v5v5

Search...

+ K

Auto

Log In

TanStack StartRC

Docs Examples GitHub Contributors

TanStack Router

Docs Examples GitHub Contributors

TanStack Query

Docs Examples GitHub Contributors

TanStack Table

Docs Examples Github Contributors

TanStack Formnew

Docs Examples Github Contributors

TanStack DBbeta

Docs Github Contributors

TanStack Virtual

Docs Examples Github Contributors

TanStack Paceralpha

Docs Examples Github Contributors

TanStack Storealpha

Docs Examples Github Contributors

TanStack Devtoolsalpha

Docs Github Contributors

More Libraries

Maintainers Partners Support Learn StatsBETA Discord Merch Blog GitHub Ethos Brand Guide

Documentation

Framework

React logo

React

Version

Latest

Search...

+ K

Menu

Getting Started

Guides & Concepts

API Reference

ESLint

Examples

Plugins

Framework

React logo

React

Version

Latest

Menu

Getting Started

Guides & Concepts

API Reference

ESLint

Examples

Plugins

On this page

ESLint Plugin Query

Copy Markdown

TanStack Query comes with its own ESLint plugin. This plugin is used to enforce best practices and to help you avoid common mistakes.

Installation
------------

The plugin is a separate package that you need to install:

bash

npm i -D @tanstack/eslint-plugin-query


npm i -D @tanstack/eslint-plugin-query

or

bash

pnpm add -D @tanstack/eslint-plugin-query


pnpm add -D @tanstack/eslint-plugin-query

or

bash

yarn add -D @tanstack/eslint-plugin-query


yarn add -D @tanstack/eslint-plugin-query

or

bash

bun add -D @tanstack/eslint-plugin-query


bun add -D @tanstack/eslint-plugin-query

Flat Config (eslint.config.js)
------------------------------
### Recommended setup

To enable all of the recommended rules for our plugin, add the following config:

js

import pluginQuery from '@tanstack/eslint-plugin-query'

export default [\
  ...pluginQuery.configs['flat/recommended'],\
  // Any other config...\
]


import pluginQuery from '@tanstack/eslint-plugin-query'

export default [\
  ...pluginQuery.configs['flat/recommended'],\
  // Any other config...\
]

### Custom setup

Alternatively, you can load the plugin and configure only the rules you want to use:

js

import pluginQuery from '@tanstack/eslint-plugin-query'

export default [\
  {\
    plugins: {\
      '@tanstack/query': pluginQuery,\
    },\
    rules: {\
      '@tanstack/query/exhaustive-deps': 'error',\
    },\
  },\
  // Any other config...\
]


import pluginQuery from '@tanstack/eslint-plugin-query'

export default [\
  {\
    plugins: {\
      '@tanstack/query': pluginQuery,\
    },\
    rules: {\
      '@tanstack/query/exhaustive-deps': 'error',\
    },\
  },\
  // Any other config...\
]

Legacy Config (.eslintrc)
-------------------------
### Recommended setup

To enable all of the recommended rules for our plugin, add plugin:@tanstack/query/recommended in extends:

json

{
  "extends": ["plugin:@tanstack/query/recommended"]
}


{
  "extends": ["plugin:@tanstack/query/recommended"]
}

### Custom setup

Alternatively, add @tanstack/query to the plugins section, and configure the rules you want to use:

json

{
  "plugins": ["@tanstack/query"],
  "rules": {
    "@tanstack/query/exhaustive-deps": "error"
  }
}


{
  "plugins": ["@tanstack/query"],
  "rules": {
    "@tanstack/query/exhaustive-deps": "error"
  }
}

Rules
-----

Edit on GitHub

hydration

Exhaustive Deps

Partners Become a Partner

Code RabbitCode Rabbit CloudflareCloudflare AG GridAG Grid NetlifyNetlify NeonNeon WorkOSWorkOS ClerkClerk ConvexConvex ElectricElectric SentrySentry PrismaPrisma StrapiStrapi UnkeyUnkey

[###### Want to Skip the Docs?

Query.gg - The Official React Query Course
\

“If you’re serious about *really* understanding React Query, there’s no better way than with query.gg”—Tanner Linsley

Learn More](https://query.gg/?s=tanstack)

scarf analytics