Registry / testing / eslint-plugin-react-compiler

eslint-plugin-react-compiler

JSON →
library19.1.0-rc.2jsnpmunverified

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-compiler
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-REAC
E
eslint-plugin-react-compiler
testingjavascriptv19.1.0-rc.2
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 registration
plugins: ['react-compiler']
const ReactCompiler = require('eslint-plugin-react-compiler'); // Incorrect usage in .eslintrc.js
ESLint plugins are registered as strings within the `plugins` array in your ESLint configuration file (e.g., `.eslintrc.js`), not imported as modules into application code.
Recommended configuration
extends: ['plugin:react-compiler/recommended']
extends: ['react-compiler'] // Missing 'plugin:' prefix
To utilize the plugin's predefined recommended ruleset, use the `plugin:` prefix followed by the plugin name and `/recommended` in the `extends` array.
Individual rule configuration
rules: { 'react-compiler/no-expression-as-prop': 'error' }
rules: { 'no-expression-as-prop': 'error' } // Missing plugin name prefix
When configuring individual rules from a plugin, you must prefix the rule name with the plugin identifier (e.g., `react-compiler/`) to ensure it's correctly applied.

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.

module.exports = { root: true, env: { browser: true, es2020: true, node: true }, parserOptions: { ecmaVersion: 'latest', sourceType: 'module', ecmaFeatures: { jsx: true } }, settings: { react: { version: 'detect' // Automatically detect React version } }, extends: [ 'eslint:recommended', 'plugin:react/recommended', 'plugin:react/jsx-runtime', 'plugin:react-compiler/recommended' // Enable recommended rules from the compiler plugin ], plugins: [ 'react', 'react-compiler' // Register the plugin ], rules: { // Example: Override or add specific rules if needed // 'react-compiler/no-render-prop-expression': 'warn' } };
Debug
Known issues
breakingThis plugin is currently at a Release Candidate (RC) stage (`19.1.0-rc.2`). This implies that its API, rules, and configuration options are subject to frequent changes without strict adherence to semantic versioning. Breaking changes are to be expected between minor and even patch versions.
fix
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.
affects: >=19.1.0-rc.0
gotchaThe functionality of this ESLint plugin is directly tied to the experimental React Compiler. Incorrect or incomplete setup of the React Compiler itself in your project may lead to the ESLint plugin not reporting errors accurately or at all.
fix
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.
affects: >=19.1.0-rc.0
gotchaRule names and configurations within `eslint-plugin-react-compiler` are still in active development and may change or be removed as the React Compiler evolves. Relying on specific rule names or options without checking the latest documentation can lead to invalid ESLint configurations.
fix
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.
affects: >=19.1.0-rc.0
Errors
Common errors & fixes
Error: Failed to load plugin 'react-compiler' declared in '.eslintrc.js': Cannot find module 'eslint-plugin-react-compiler'
The `eslint-plugin-react-compiler` package is not installed or not accessible in the current project environment.
fix
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.
ESLint: Configuration for rule 'react-compiler/some-non-existent-rule' is invalid: Value 'error' is not allowed.
An ESLint rule specific to `eslint-plugin-react-compiler` has been configured incorrectly, either by referencing a non-existent rule or by using invalid options for an existing rule.
fix
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.
ESLint: 'react-compiler' was conflicted between ...
The `eslint-plugin-react-compiler` is being loaded multiple times from different locations or configurations, leading to conflicts.
fix
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.
Upgrade
Version history
19.1.0-rc.2latest on npm
Audit
Dependencies
eslintrequiredRequired peer dependency to run any ESLint plugin.
Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-react-compiler — npm install eslint-plugin-react-compiler · libregistry