File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Expand file tree Collapse file tree 4 files changed +23
-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');
1919const { FlatCompat } = require ( '@eslint/eslintrc' ) ;
2020const globals = require ( 'globals' ) ;
2121const markdown = require ( 'eslint-plugin-markdown' ) ;
22- const eslintPlugin = require ( 'eslint-plugin-eslint-plugin' ) ;
22+ const eslintPluginConfig = require ( 'eslint-plugin-eslint-plugin/configs' ) . all ;
2323
2424const compat = new FlatCompat ( {
2525 baseDirectory : __dirname ,
@@ -63,8 +63,7 @@ module.exports = [
6363 {
6464 // Apply eslint-plugin rules to our own rules/tests (but not docs).
6565 files : [ 'lib/**/*.js' , 'tests/**/*.js' ] ,
66- plugins : { 'eslint-plugin' : eslintPlugin } ,
67- ...eslintPlugin . configs . recommended ,
66+ ...eslintPluginConfig ,
6867 rules : {
6968 'eslint-plugin/report-message-format' : [ 'error' , '^[^a-z].*.$' ] ,
7069 'eslint-plugin/require-meta-docs-url' : [
@@ -82,6 +81,7 @@ module.exports = [
8281 } ,
8382 {
8483 files : [ '**/*.md' ] ,
84+ plugins : { markdown } ,
8585 processor : 'markdown/markdown' ,
8686 } ,
8787 {
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ module.exports.configs = Object.keys(configFilters).reduce(
4747 ( configs , configName ) => {
4848 return Object . assign ( configs , {
4949 [ configName ] : {
50- // plugins: ['eslint-plugin'],
50+ plugins : [ 'eslint-plugin' ] ,
5151 rules : Object . fromEntries (
5252 Object . keys ( allRules )
5353 . filter ( ( ruleName ) => configFilters [ configName ] ( allRules [ ruleName ] ) )
Original file line number Diff line number Diff line change 66 "main" : " ./lib/index.js" ,
77 "exports" : {
88 "." : " ./lib/index.js" ,
9+ "./configs" : " ./configs/index.js" ,
910 "./package.json" : " ./package.json"
1011 },
1112 "license" : " MIT" ,
You can’t perform that action at this time.
0 commit comments