File tree 4 files changed +22
-4
lines changed
4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @fileoverview the configs for `eslint.config.js`
3
+ * @link https://eslint.org/docs/latest/use/configure/configuration-files-new
4
+
5
+ */
6
+
7
+ 'use strict' ;
8
+
9
+ const { configs, rules } = require ( '../lib/index.js' ) ;
10
+ const configNames = Object . keys ( configs ) ;
11
+
12
+ configNames . forEach ( ( configName ) => {
13
+ // the only difference is the `plugins` property must be an object
14
+ // TODO: we might better copy the config instead of mutating it, in case it's used by somewhere else
15
+ configs [ configName ] . plugins = { 'eslint-plugin' : { rules } } ;
16
+ } ) ;
17
+
18
+ module . exports = configs ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ const js = require('@eslint/js');
19
19
const { FlatCompat } = require ( '@eslint/eslintrc' ) ;
20
20
const globals = require ( 'globals' ) ;
21
21
const markdown = require ( 'eslint-plugin-markdown' ) ;
22
- const eslintPlugin = require ( 'eslint-plugin-eslint-plugin' ) ;
22
+ const eslintPluginConfig = require ( 'eslint-plugin-eslint-plugin/configs' ) . all ;
23
23
24
24
const compat = new FlatCompat ( {
25
25
baseDirectory : __dirname ,
@@ -63,8 +63,7 @@ module.exports = [
63
63
{
64
64
// Apply eslint-plugin rules to our own rules/tests (but not docs).
65
65
files : [ 'lib/**/*.js' , 'tests/**/*.js' ] ,
66
- plugins : { 'eslint-plugin' : eslintPlugin } ,
67
- ...eslintPlugin . configs . recommended ,
66
+ ...eslintPluginConfig ,
68
67
rules : {
69
68
'eslint-plugin/report-message-format' : [ 'error' , '^[^a-z].*.$' ] ,
70
69
'eslint-plugin/require-meta-docs-url' : [
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ module.exports.configs = Object.keys(configFilters).reduce(
47
47
( configs , configName ) => {
48
48
return Object . assign ( configs , {
49
49
[ configName ] : {
50
- // plugins: ['eslint-plugin'],
50
+ plugins : [ 'eslint-plugin' ] ,
51
51
rules : Object . fromEntries (
52
52
Object . keys ( allRules )
53
53
. filter ( ( ruleName ) => configFilters [ configName ] ( allRules [ ruleName ] ) )
Original file line number Diff line number Diff line change 6
6
"main" : " ./lib/index.js" ,
7
7
"exports" : {
8
8
"." : " ./lib/index.js" ,
9
+ "./configs" : " ./configs/index.js" ,
9
10
"./package.json" : " ./package.json"
10
11
},
11
12
"license" : " MIT" ,
You can’t perform that action at this time.
0 commit comments