Skip to content

Commit

Permalink
Merge branch 'main' into feat/prioritize-view-attribute-process-function
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg authored Jan 19, 2025
2 parents 23c18b9 + 18eaf51 commit 2d205b9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
19 changes: 18 additions & 1 deletion compiler/packages/eslint-plugin-react-compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,24 @@ npm install eslint-plugin-react-compiler --save-dev

## Usage

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

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

```diff
+ 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.config.recommended
]
```

### Legacy config (`.eslintrc`)

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

```json
{
Expand Down
14 changes: 14 additions & 0 deletions compiler/packages/eslint-plugin-react-compiler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,18 @@ module.exports = {
rules: {
'react-compiler': ReactCompilerRule,
},
configs: {
recommended: {
plugins: {
'react-compiler': {
rules: {
'react-compiler': ReactCompilerRule,
},
},
},
rules: {
'react-compiler/react-compiler': 'error',
},
},
},
};

0 comments on commit 2d205b9

Please sign in to comment.