A composable ESLint plugin for React libraries and frameworks, provided as part of the @eslint-react monorepo. Current stable version is 4.2.3, with active development on v5 beta releases (latest beta v5.5.1-beta.0). Requires Node >=22.0.0, ESLint ^10.0.0, and TypeScript as a peer dependency. Ships TypeScript types. Differentiators: covers modern React patterns (hooks, custom hooks, JSX), provides extensive rule set including new rules like `static-components` and `globals`, and aims to be a drop-in replacement for `eslint-plugin-react` with additional composability.
npm install eslint-plugin-react-xVerified import paths — ran on the pinned version, not inferred.
Flat ESLint config using eslint-plugin-react-x with recommended rules and react-hooks plugin.
Remove any references to `react-x/component-hook-factories` from your ESLint config. This rule has been removed as the upstream equivalent was also removed.
Replace `initializedFromReact` with `APIFromReact` and `initializedFromReactNative` with `APIFromReactNative`. Also, `is.memo()`, `is.lazy()`, etc. are removed in favor of `*Call` variants.
Upgrade Node to v22+ and ESLint to v10+. Use older versions of the plugin if you cannot upgrade (e.g., v3.x for ESLint 8/9).
Use dynamic import (`import('eslint-plugin-react-x')`) or convert your project to ESM. Set `"type": "module"` in package.json.Install TypeScript as a devDependency. If no TypeScript files exist, consider setting `tsconfigRootDir` in ESLint config to avoid unnecessary type checking overhead.
Run `npm install eslint-plugin-react-x --save-dev` or ensure the plugin is in your root `node_modules`. Use `require.resolve` in ESLint config if needed.
Switch to ESM: add `"type": "module"` to your package.json and use `import` syntax in your ESLint config.
Use `eslintPluginReactX.configs.recommended.rules` instead of `eslintPluginReactX.configs.recommended.rules` if accessing manually, or spread the entire config.
Use default import as `import eslintPluginReactX from 'eslint-plugin-react-x'` (the plugin is the default export) rather than calling it as a function.