Skip to content

Commit 4bb2272

Browse files
committed
docs: improve README.md
1 parent 257bf77 commit 4bb2272

File tree

3 files changed

+126
-134
lines changed

3 files changed

+126
-134
lines changed

README.md

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,45 +56,37 @@ npm install --save-dev @eslint-react/eslint-plugin
5656

5757
### Setup
5858

59-
Add `@eslint-react` to the plugins section of your `.eslintrc.js` configuration file.
59+
Add the plugin to your `eslint.config.js`:
6060

6161
```js
62-
module.exports = {
63-
// ...
64-
parser: "@typescript-eslint/parser",
65-
extends: ["plugin:@eslint-react/recommended-legacy"],
66-
plugins: ["@eslint-react"],
67-
// ...
68-
};
62+
// @ts-check
63+
64+
import eslint from "@eslint/js";
65+
import tseslint from "typescript-eslint";
66+
import eslintReact from "@eslint-react/eslint-plugin";
67+
68+
export default tseslint.config(
69+
eslint.configs.recommended,
70+
...tseslint.configs.recommended,
71+
{
72+
files: ["src/**/*.{ts,tsx}"],
73+
...eslintReact.configs.recommended,
74+
},
75+
);
6976
```
7077

7178
[Full Installation Guide ↗](https://eslint-react.xyz/docs/installation)
7279

7380
## Presets
7481

75-
### LegacyConfig presets
76-
77-
> [!IMPORTANT]\
78-
> These presets are for ESLint `LegacyConfig` (`.eslintrc.*`) only
79-
80-
- **recommended-legacy** (`plugin:@eslint-react/recommended-legacy`)\
81-
Enable rules that are recommended by ESLint React.
82-
- **recommended-type-checked-legacy** (`plugin:@eslint-react/recommended-type-checked-legacy`)\
83-
Enable rules that are recommended by ESLint React with additional rules that require type information.
84-
- **all-legacy** (`plugin:@eslint-react/all-legacy`)\
85-
Enable all rules in this plugin except for debug rules.
86-
- **off-legacy** (`plugin:@eslint-react/off-legacy`)\
87-
Disable all rules in this plugin except for debug rules.
88-
89-
### FlatConfig presets
90-
91-
> [!IMPORTANT]\
92-
> These presets are for ESLint `FlatConfig` (`eslint.config.js`) only
93-
9482
- **recommended**\
9583
Enable rules that are recommended by ESLint React.
9684
- **recommended-type-checked**\
9785
Enable rules that are recommended by ESLint React with additional rules that require type information.
86+
- **dom**\
87+
Enable rules that are specific to React DOM.
88+
- **off-dom**\
89+
Disable rules that are specific to React DOM.
9890
- **all**\
9991
Enable all rules in this plugin except for debug rules.
10092
- **off**\

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"array.prototype.toreversed": "npm:@nolyfill/array.prototype.toreversed@latest",
115115
"array.prototype.tosorted": "npm:@nolyfill/array.prototype.tosorted@latest",
116116
"es-iterator-helpers": "npm:@nolyfill/es-iterator-helpers@latest",
117-
"eslint": ">=9.1.0",
117+
"eslint": "9.1.0",
118118
"function-bind": "npm:@nolyfill/function-bind@latest",
119119
"has": "npm:@nolyfill/has@latest",
120120
"hasown": "npm:@nolyfill/hasown@latest",

0 commit comments

Comments
 (0)