mirror of
https://github.com/facebook/react.git
synced 2026-02-23 12:13:04 +00:00
Cleans up feature flags that do not have an active experiment and which we don't currently plan to ship, one commit per flag. Notable removals: * Automatic (inferred) effect dependencies / Fire: abandoned due to early feedback. Shipped useEffectEvent which addresses some of the use-cases. * Inline JSX transform (experimented, not a consistent win) * Context selectors (experimented, not a sufficient/consistent win given the benefit the compiler already provides) * Instruction Reordering (will try a different approach) To decide which features to remove, I looked at Meta's internal repos as well as eslint-pugin-react-hooks to see which flags were never overridden anywhere. That gave a longer list of flags, from which I then removed some features that I know are used in OSS.
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.