react/compiler/packages/eslint-plugin-react-compiler
2025-01-22 16:59:50 +01:00
..
__tests__ [compiler] Surface unused opt out directives in eslint 2024-08-16 18:12:05 -04:00
scripts [compiler] Switch to esbuild (#31963) 2025-01-02 16:59:56 -05:00
src Support eslint 8+ flat plugin syntax out of the box for eslint-plugin-react-compiler (#32120) 2025-01-18 17:41:34 -05:00
babel.config.js Compiler: unfork prettier config (#30205) 2024-07-18 17:00:24 -04:00
package.json [compiler] Switch to esbuild (#31963) 2025-01-02 16:59:56 -05:00
README.md docs(eslint-plugin-react-compiler): fix typo (#32149) 2025-01-22 16:59:50 +01:00
tsconfig.json Remove comments in builds 2024-04-02 10:32:24 -04:00

eslint-plugin-react-compiler

ESLint plugin surfacing problematic React code found by the React compiler.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-react-compiler:

npm install eslint-plugin-react-compiler --save-dev

Usage

Flat config

Edit your eslint 8+ config (for example eslint.config.mjs) with the recommended configuration:

+ import reactCompiler from "eslint-plugin-react-compiler"
import react from "eslint-plugin-react"

export default [
    // Your existing config
    { ...pluginReact.configs.flat.recommended, settings: { react: { version: "detect" } } },
+   reactCompiler.configs.recommended    
]

Legacy config (.eslintrc)

Add react-compiler to the plugins section of your configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "react-compiler"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "react-compiler/react-compiler": "error"
    }
}

Rules

TODO: Run eslint-doc-generator to generate the rules list.