Registry / testing / eslint-plugin-react-query

eslint-plugin-react-query

JSON →
library1.3.0jsnpmunverified

Community ESLint plugin enforcing best practices for React Query (TanStack Query) v3+. Current version 1.3.0, released February 2022, with slow release cadence. Adds rules for useQuery object syntax, missing queryKey, and mutationKey. Differentiator: lightweight, dedicated linting for React Query patterns, complementary to the official plugin. Alternative to @tanstack/eslint-plugin-query which is more maintained.

npm install eslint-plugin-react-query
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-REAC
E
eslint-plugin-react-query
testingjavascriptv1.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin
import plugin from 'eslint-plugin-react-query'
const plugin = require('eslint-plugin-react-query')
ESM export is default, but CommonJS require also works.
rules
import { rules } from 'eslint-plugin-react-query'
Rules object contains all rule definitions, used for programmatic access.
configs
import { configs } from 'eslint-plugin-react-query'
const configs = require('eslint-plugin-react-query').configs
Access recommended config via configs.recommended.

Set up ESLint with react-query plugin rules including object syntax enforcement.

// .eslintrc.js module.exports = { plugins: ['react-query'], extends: ['plugin:react-query/recommended'], rules: { 'react-query/prefer-query-object-syntax': 'warn', }, }; // Example code that triggers rule: // useQuery('key', fetchSomething) // no object syntax -> warning // useQuery({ queryKey: 'key', queryFn: fetchSomething }) // ok
Debug
Known issues
breakingPlugin is not actively maintained; for TanStack Query v4+, consider using @tanstack/eslint-plugin-query.
fix
Switch to @tanstack/eslint-plugin-query for official support.
affects: >=1.0.0
deprecatedprefer-query-object-syntax rule is fixable but may conflict with other patterns.
fix
Use object syntax for useQuery to avoid warnings.
affects: >=1.2.0
gotchaRules only cover useQuery and useMutation; useInfiniteQuery and other hooks are not validated.
fix
Manually enforce keys for other hooks or use other lint rules.
affects: >=1.0.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-react-query".
Plugin not installed or missing from package.json devDependencies.
fix
Run: npm install --save-dev eslint-plugin-react-query
Definition for rule 'react-query/rule-name' was not found.
Typo in rule name or rule not yet implemented.
fix
Check supported rules in README: mutation-key, prefer-query-object-syntax, query-key.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies
eslintrequiredPeer dependency; ESLint >=7.30 required.
Agent activity
13 hits · last 30 days
node
10
Amazon
1
Resources
eslint-plugin-react-query — npm install eslint-plugin-react-query · libregistry