@@ -6,8 +6,6 @@ An ESLint plugin for linting ESLint plugins. Rules written in CJS, ESM, and Type
66
77- [ Installation] ( #installation )
88- [ Usage] ( #usage )
9- - [ ** .eslintrc.json** ] ( #eslintrcjson )
10- - [ ` eslint.config.js ` (requires eslint\> =v8.23.0)] ( #eslintconfigjs-requires-eslintv8230 )
119- [ Rules] ( #rules )
1210 - [ Rules] ( #rules-1 )
1311 - [ Tests] ( #tests )
@@ -42,25 +40,14 @@ Here's an example ESLint configuration that:
4240- Enables the ` recommended ` configuration
4341- Enables an optional/non-recommended rule
4442
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.
5944
6045``` 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 ,
6451 {
6552 rules: {
6653 ' 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
141128
142129### <a name =' Presetusage ' ></a >Preset usage
143130
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.
147132
148133``` 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' ;
152136
153- .eslintrc.json
154-
155- ``` json
156- {
157- "extends" : [" plugin:eslint-plugin/recommended" ]
158- }
137+ export default [eslintPlugin .configs .recommended ];
159138```
160139
161140Or to apply linting only to the appropriate rule or test files:
162141
163- eslint.config.js
164-
165142``` 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 [
168147 {
169148 files: [' lib/rules/*.{js,ts}' ],
170- ... eslintPlugin .configs [' flat/ rules-recommended' ],
149+ ... eslintPlugin .configs [' rules-recommended' ],
171150 },
172151 {
173152 files: [' tests/lib/rules/*.{js,ts}' ],
174- ... eslintPlugin .configs [' flat/ tests-recommended' ],
153+ ... eslintPlugin .configs [' tests-recommended' ],
175154 },
176155];
177156```
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