{"id":19908,"library":"eslint-plugin-react-x","title":"eslint-plugin-react-x","description":"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.","status":"active","version":"4.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/Rel1cx/eslint-react","tags":["javascript","react","eslint","eslint-react","eslint-plugin","eslint-plugin-react-x","typescript"],"install":[{"cmd":"npm install eslint-plugin-react-x","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-react-x","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-react-x","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin runs within ESLint ^10.0.0.","package":"eslint","optional":false},{"reason":"Peer dependency; used for type-aware rules and type checking.","package":"typescript","optional":false}],"imports":[{"note":"ESM-only; CJS require is not supported. Use dynamic import if needed.","wrong":"const eslintPluginReactX = require('eslint-plugin-react-x')","symbol":"default","correct":"import eslintPluginReactX from 'eslint-plugin-react-x'"},{"note":"Named export available; recommended for selective rule access in configs.","wrong":"const { rules } = require('eslint-plugin-react-x')","symbol":"rules","correct":"import { rules } from 'eslint-plugin-react-x'"},{"note":"Configs include 'recommended', 'all', and framework-specific presets.","wrong":"const configs = require('eslint-plugin-react-x').configs","symbol":"configs","correct":"import { configs } from 'eslint-plugin-react-x'"},{"note":"Type-only export; should be imported with `import type` to avoid runtime issues in TypeScript projects.","wrong":"import { TSType } from 'eslint-plugin-react-x'","symbol":"TSType","correct":"import type { TSType } from 'eslint-plugin-react-x'"},{"note":"RuleContext is a type but also exported as a value for runtime checks in custom rules. Use `import type` only if purely for type usage.","wrong":"import type { RuleContext } from 'eslint-plugin-react-x'","symbol":"RuleContext","correct":"import { RuleContext } from 'eslint-plugin-react-x'"}],"quickstart":{"code":"// eslint.config.js\nimport eslintPluginReactX from 'eslint-plugin-react-x';\nimport eslintPluginReactHooks from 'eslint-plugin-react-hooks';\n\nexport default [\n  {\n    files: ['**/*.{ts,tsx}'],\n    plugins: {\n      'react-x': eslintPluginReactX,\n      'react-hooks': eslintPluginReactHooks,\n    },\n    rules: {\n      ...eslintPluginReactX.configs.recommended.rules,\n      'react-x/no-set-state': 'error',\n      'react-x/no-string-refs': 'error',\n      'react-x/jsx-no-duplicate-props': 'error',\n      'react-hooks/rules-of-hooks': 'error',\n      'react-hooks/exhaustive-deps': 'warn',\n    },\n  },\n];","lang":"javascript","description":"Flat ESLint config using eslint-plugin-react-x with recommended rules and react-hooks plugin."},"warnings":[{"fix":"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.","message":"Removal of `component-hook-factories` rule","severity":"breaking","affected_versions":">=5.5.0-beta.0"},{"fix":"Replace `initializedFromReact` with `APIFromReact` and `initializedFromReactNative` with `APIFromReactNative`. Also, `is.memo()`, `is.lazy()`, etc. are removed in favor of `*Call` variants.","message":"Kit API Simplification: `initializedFromReact` and `initializedFromReactNative` renamed","severity":"deprecated","affected_versions":">=5.0.2-beta.0"},{"fix":"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).","message":"Requires Node >=22.0.0 and ESLint ^10.0.0","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Use dynamic import (`import('eslint-plugin-react-x')`) or convert your project to ESM. Set `\"type\": \"module\"` in package.json.","message":"CJS require() does not work; ESM-only package","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Install TypeScript as a devDependency. If no TypeScript files exist, consider setting `tsconfigRootDir` in ESLint config to avoid unnecessary type checking overhead.","message":"Peer dependency on TypeScript — even if not using TypeScript, plugin may attempt type resolution","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"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.","cause":"Plugin is not installed or ESLint cannot resolve it in a monorepo or non-standard node_modules.","error":"ESLint: Failed to load plugin 'react-x' ... Cannot find module 'eslint-plugin-react-x'"},{"fix":"Switch to ESM: add `\"type\": \"module\"` to your package.json and use `import` syntax in your ESLint config.","cause":"Using CommonJS `require()` to load the ESM-only plugin.","error":"Parsing error: The keyword 'export' is reserved"},{"fix":"Use `eslintPluginReactX.configs.recommended.rules` instead of `eslintPluginReactX.configs.recommended.rules` if accessing manually, or spread the entire config.","cause":"Incorrectly referencing config.rules without spreading the config object from the plugin.","error":"Cannot read properties of undefined (reading 'rules')"},{"fix":"Use default import as `import eslintPluginReactX from 'eslint-plugin-react-x'` (the plugin is the default export) rather than calling it as a function.","cause":"Using default import incorrectly when plugin is not a function but an object.","error":"TypeError: (0 , eslintPluginReactX.default) is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}