Skip to content

Commit 2d205b9

Browse files
authored
Merge branch 'main' into feat/prioritize-view-attribute-process-function
2 parents 23c18b9 + 18eaf51 commit 2d205b9

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

compiler/packages/eslint-plugin-react-compiler/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff 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
{

compiler/packages/eslint-plugin-react-compiler/src/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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
};

0 commit comments

Comments
 (0)