react/compiler/packages/eslint-plugin-react-compiler
mofeiZ 5398b71158
[compiler] detect and throw on untransformed required features (#32512)
Traverse program after running compiler transform to find untransformed
references to compiler features (e.g. `inferEffectDeps`, `fire`).

Hard error to fail the babel pipeline when the compiler fails to
transform these features to give predictable runtime semantics.
Untransformed calls to functions like `fire` will throw at runtime
anyways, so let's fail the build to catch these earlier.

Note that with this fails the build *regardless of panicThreshold*
2025-03-14 11:44:49 -04:00
..
__tests__ [compiler] detect and throw on untransformed required features (#32512) 2025-03-14 11:44:49 -04:00
src [ez] Run Prettier on eslint-plugin-react-compiler/src/types (#32590) 2025-03-12 19:12:22 -04:00
babel.config.js Compiler: unfork prettier config (#30205) 2024-07-18 17:00:24 -04:00
package.json [compiler] Dedupe @babel/types (#32581) 2025-03-12 17:02:10 -04:00
README.md docs(eslint-plugin-react-compiler): fix typo (#32149) 2025-01-22 16:59:50 +01:00
tsconfig.json [compiler] Migrate compiler packages to tsup (#32550) 2025-03-07 16:41:55 -05:00
tsup.config.ts [compiler] Migrate compiler packages to tsup (#32550) 2025-03-07 16:41:55 -05: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.