The `eslint-plugin-react-compiler` is an ESLint plugin designed to integrate with the experimental React Compiler (internally known as React Forget). Its primary function is to surface and display errors, warnings, and suggestions generated by the compiler directly within the developer's integrated development environment (IDE) or during continuous integration (CI) builds. Currently at version `19.1.0-rc.2`, it operates as a release candidate, indicating active development and potential for API instability. The plugin is a critical tool for developers experimenting with the React Compiler, providing immediate feedback on compilation issues and guiding them towards code patterns compatible with automatic memoization and optimization. Given its close tie to an experimental React feature, its release cadence is likely irregular and directly linked to the React Compiler's own development milestones, focusing on correctness and performance improvements. It differentiates itself by being the official mechanism to lint against compiler-specific issues, a function not covered by generic ESLint rules or other React-specific ESLint plugins.
npm install eslint-plugin-react-compilerVerified import paths — ran on the pinned version, not inferred.
This configuration snippet demonstrates how to set up ESLint to utilize `eslint-plugin-react-compiler` within a React project. It includes the plugin in the `plugins` array and extends its recommended ruleset, allowing ESLint to detect and report errors, warnings, and suggestions generated by the experimental React Compiler directly in your development environment.
Always consult the latest official React Compiler and plugin documentation before upgrading. Pin the exact version in `package.json` to prevent unexpected breaking changes during automated updates.
Ensure your project is correctly configured to use the experimental React Compiler. Refer to the official React documentation for the React Compiler setup instructions, which may involve specific Babel or bundler configurations.
Regularly review the plugin's documentation and release notes. Prioritize using the `recommended` configuration (`'plugin:react-compiler/recommended'`) to automatically keep up with best practices and rule changes, rather than hand-picking individual rules.
Run `npm install eslint-plugin-react-compiler eslint --save-dev` or `yarn add eslint-plugin-react-compiler eslint --dev` to install the plugin and ESLint.
Double-check the rule name and its allowed options against the official `eslint-plugin-react-compiler` documentation. Ensure the rule actually exists and the severity/options are valid.
Ensure the plugin is registered only once in your root ESLint configuration. If using layered configurations, verify that child configurations are not re-registering the plugin when it's already inherited from a parent config.