@@ -6,8 +6,6 @@ An ESLint plugin for linting ESLint plugins. Rules written in CJS, ESM, and Type
6
6
7
7
- [ Installation] ( #installation )
8
8
- [ Usage] ( #usage )
9
- - [ ** .eslintrc.json** ] ( #eslintrcjson )
10
- - [ ` eslint.config.js ` (requires eslint\> =v8.23.0)] ( #eslintconfigjs-requires-eslintv8230 )
11
9
- [ Rules] ( #rules )
12
10
- [ Rules] ( #rules-1 )
13
11
- [ Tests] ( #tests )
@@ -42,25 +40,14 @@ Here's an example ESLint configuration that:
42
40
- Enables the ` recommended ` configuration
43
41
- Enables an optional/non-recommended rule
44
42
45
- Note: you might need to set ` sourceType ` to ` script ` (most users) (use ` module ` for ESM/TypeScript).
46
-
47
- ### <a name =' eslintrc ' ></a >** [ .eslintrc.json] ( https://eslint.org/docs/latest/use/configure/configuration-files ) **
48
-
49
- ``` json
50
- {
51
- "extends" : [" plugin:eslint-plugin/recommended" ],
52
- "rules" : {
53
- "eslint-plugin/require-meta-docs-description" : " error"
54
- }
55
- }
56
- ```
57
-
58
- ### <a name =' flat ' ></a >[ ` eslint.config.js ` ] ( https://eslint.org/docs/latest/use/configure/configuration-files-new ) (requires eslint>=v8.23.0)
43
+ Note: you might need to set ` sourceType ` to ` module ` or ` script ` depending on your codebase.
59
44
60
45
``` js
61
- const eslintPlugin = require (' eslint-plugin-eslint-plugin' );
62
- module .exports = [
63
- eslintPlugin .configs [' flat/recommended' ],
46
+ // eslint.config.js
47
+ import eslintPlugin from ' eslint-plugin-eslint-plugin' ;
48
+
49
+ export default [
50
+ eslintPlugin .configs .recommended ,
64
51
{
65
52
rules: {
66
53
' eslint-plugin/require-meta-docs-description' : ' error' ,
@@ -141,54 +128,29 @@ The list of recommended rules will only change in a major release of this plugin
141
128
142
129
### <a name =' Presetusage ' ></a >Preset usage
143
130
144
- Both flat and eslintrc configs are supported. For example, to enable the ` recommended ` preset, use:
145
-
146
- eslint.config.js
131
+ Example of applying the ` recommended ` config to all files.
147
132
148
133
``` js
149
- const eslintPlugin = require (' eslint-plugin-eslint-plugin' );
150
- module .exports = [eslintPlugin .configs [' flat/recommended' ]];
151
- ```
134
+ // eslint.config.js
135
+ import eslintPlugin from ' eslint-plugin-eslint-plugin' ;
152
136
153
- .eslintrc.json
154
-
155
- ``` json
156
- {
157
- "extends" : [" plugin:eslint-plugin/recommended" ]
158
- }
137
+ export default [eslintPlugin .configs .recommended ];
159
138
```
160
139
161
140
Or to apply linting only to the appropriate rule or test files:
162
141
163
- eslint.config.js
164
-
165
142
``` js
166
- const eslintPlugin = require (' eslint-plugin-eslint-plugin' );
167
- module .exports = [
143
+ // eslint.config.js
144
+ import eslintPlugin from ' eslint-plugin-eslint-plugin' ;
145
+
146
+ export default [
168
147
{
169
148
files: [' lib/rules/*.{js,ts}' ],
170
- ... eslintPlugin .configs [' flat/ rules-recommended' ],
149
+ ... eslintPlugin .configs [' rules-recommended' ],
171
150
},
172
151
{
173
152
files: [' tests/lib/rules/*.{js,ts}' ],
174
- ... eslintPlugin .configs [' flat/ tests-recommended' ],
153
+ ... eslintPlugin .configs [' tests-recommended' ],
175
154
},
176
155
];
177
156
```
178
-
179
- .eslintrc.js
180
-
181
- ``` json
182
- {
183
- "overrides" : [
184
- {
185
- "files" : [" lib/rules/*.{js,ts}" ],
186
- "extends" : [" plugin:eslint-plugin/rules-recommended" ]
187
- },
188
- {
189
- "files" : [" tests/lib/rules/*.{js,ts}" ],
190
- "extends" : [" plugin:eslint-plugin/tests-recommended" ]
191
- }
192
- ]
193
- }
194
- ```
0 commit comments