oxlint-plugin-query

raw JSON →
0.1.1 verified Fri May 01 auth: no javascript

Oxlint plugin providing TanStack Query v5 lint rules, ported to Oxlint's JS plugin API and compatible with ESLint flat config. Current stable version is 0.1.1, released monthly. It offers six rules (exhaustive-deps, no-rest-destructuring, stable-query-client, no-unstable-deps, infinite-query-property-order, mutation-property-order) to catch common TanStack Query anti-patterns earlier. Unlike tslint-plugin-react-query or eslint-plugin-query, it works natively with Oxlint (>=1.0.0) for fast linting, but also exports an ESLint compat plugin for flat config users. Requires Node >=18.

error Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'oxlint-plugin-query'
cause Node cannot resolve the package to an ES module when using bare specifier import in Oxlint or elsewhere.
fix
Replace bare import with a relative path from node_modules: './node_modules/oxlint-plugin-query/dist/index.js' or use --module-resolution=node if supported.
error OxlintError: Plugin at './node_modules/oxlint-plugin-query/dist/index.js' is not a valid JS plugin
cause The plugin file is corrupted or permissions issue, or the Oxlint version is below 1.0.0.
fix
Check that the file exists, is readable, and you are using Oxlint >=1.0.0. Reinstall the package.
error ESLint: Failed to load plugin 'query': Cannot find module 'oxlint-plugin-query'
cause Using legacy eslintrc config which does not support the default ESM export from this package.
fix
Migrate to ESLint flat config (eslint.config.mjs) and import as shown in quickstart.
error TypeError: plugin.configs is undefined
cause Trying to use .configs on a named import rather than the default export.
fix
Use import plugin from 'oxlint-plugin-query/dist/index.js' then access plugin.configs.recommended.
gotcha Plugin must be loaded via absolute path or relative path in `jsPlugins`. Oxlint does not resolve bare package names like 'oxlint-plugin-query'.
fix Use `./node_modules/oxlint-plugin-query/dist/index.js` or equivalent absolute path.
gotcha The rule prefix 'oxlint-plugin-query/' is required in .oxlintrc.json rules. Omitting the prefix causes the rule to be ignored.
fix Always prefix rule names with 'oxlint-plugin-query/' (e.g., 'oxlint-plugin-query/exhaustive-deps').
gotcha Compatibility with ESLint flat config only: the plugin does not support legacy eslintrc format.
fix Use eslint.config.mjs with flat config and import the default export directly.
deprecated The package is in early release (0.x). API may change in minor versions without major bump.
fix Pin exact version or test upgrades in CI.
npm install oxlint-plugin-query
yarn add oxlint-plugin-query
pnpm add oxlint-plugin-query

Shows Oxlint and ESLint configuration for activating the plugin with recommended rules.

// 1. Install: npm add -D oxlint-plugin-query
// 2. Create .oxlintrc.json:
{
  "jsPlugins": ["./node_modules/oxlint-plugin-query/dist/index.js"],
  "rules": {
    "oxlint-plugin-query/exhaustive-deps": "error",
    "oxlint-plugin-query/stable-query-client": "error",
    "oxlint-plugin-query/no-rest-destructuring": "warn"
  }
}
// 3. Run oxlint (>=1.0.0).

// ESLint flat config alternative:
// eslint.config.mjs
import queryPlugin from 'oxlint-plugin-query/dist/index.js';

export default [
  {
    plugins: { query: queryPlugin },
    rules: queryPlugin.configs.recommended.rules,
  },
];