File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
compiler/packages/eslint-plugin-react-compiler Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,24 @@ npm install eslint-plugin-react-compiler --save-dev
1818
1919## Usage
2020
21- Add ` react-compiler ` to the plugins section of your ` .eslintrc ` configuration file. You can omit the ` eslint-plugin- ` prefix:
21+ ### Flat config
22+
23+ Edit your eslint 8+ config (for example ` eslint.config.mjs ` ) with the recommended configuration:
24+
25+ ``` diff
26+ + import reactCompiler from "eslint-plugin-react-compiler"
27+ import react from "eslint-plugin-react"
28+
29+ export default [
30+ // Your existing config
31+ { ...pluginReact.configs.flat.recommended, settings: { react: { version: "detect" } } },
32+ + reactCompiler.config.recommended
33+ ]
34+ ```
35+
36+ ### Legacy config (` .eslintrc ` )
37+
38+ Add ` react-compiler ` to the plugins section of your configuration file. You can omit the ` eslint-plugin- ` prefix:
2239
2340``` json
2441{
Original file line number Diff line number Diff line change @@ -11,4 +11,18 @@ module.exports = {
1111 rules : {
1212 'react-compiler' : ReactCompilerRule ,
1313 } ,
14+ configs : {
15+ recommended : {
16+ plugins : {
17+ 'react-compiler' : {
18+ rules : {
19+ 'react-compiler' : ReactCompilerRule ,
20+ } ,
21+ } ,
22+ } ,
23+ rules : {
24+ 'react-compiler/react-compiler' : 'error' ,
25+ } ,
26+ } ,
27+ } ,
1428} ;
You can’t perform that action at this time.
0 commit comments