-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
eslint.config.js
(#347)
- Loading branch information
1 parent
a3d8898
commit 6f6b1f4
Showing
12 changed files
with
205 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
'use strict'; | ||
|
||
/** @type {import('eslint-doc-generator').GenerateOptions} */ | ||
module.exports = { | ||
ignoreConfig: ['all', 'rules', 'rules-recommended', 'tests', 'tests-recommended'], | ||
ignoreConfig: [ | ||
'all', | ||
'rules', | ||
'rules-recommended', | ||
'tests', | ||
'tests-recommended', | ||
], | ||
ruleDocSectionInclude: ['Rule Details'], | ||
ruleListSplit: 'meta.docs.category', | ||
urlConfigs: 'https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets', | ||
urlConfigs: | ||
'https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets', | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @fileoverview the `all` config for `eslint.config.js` | ||
* @author 唯然<weiran.zsd@outlook.com> | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const mod = require('../lib/index.js'); | ||
|
||
module.exports = { | ||
plugins: { 'eslint-plugin': mod }, | ||
rules: mod.configs.all.rules, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @fileoverview the `recommended` config for `eslint.config.js` | ||
* @author 唯然<weiran.zsd@outlook.com> | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const mod = require('../lib/index.js'); | ||
|
||
module.exports = { | ||
plugins: { 'eslint-plugin': mod }, | ||
rules: mod.configs.recommended.rules, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @fileoverview the `rules-recommended` config for `eslint.config.js` | ||
* @author 唯然<weiran.zsd@outlook.com> | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const mod = require('../lib/index.js'); | ||
|
||
module.exports = { | ||
plugins: { 'eslint-plugin': mod }, | ||
rules: mod.configs['rules-recommended'].rules, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @fileoverview the `rules` config for `eslint.config.js` | ||
* @author 唯然<weiran.zsd@outlook.com> | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const mod = require('../lib/index.js'); | ||
|
||
module.exports = { | ||
plugins: { 'eslint-plugin': mod }, | ||
rules: mod.configs.rules.rules, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @fileoverview the `tests-recommended` config for `eslint.config.js` | ||
* @author 唯然<weiran.zsd@outlook.com> | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const mod = require('../lib/index.js'); | ||
|
||
module.exports = { | ||
plugins: { 'eslint-plugin': mod }, | ||
rules: mod.configs['tests-recommended'].rules, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @fileoverview the `tests` config for `eslint.config.js` | ||
* @author 唯然<weiran.zsd@outlook.com> | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const mod = require('../lib/index.js'); | ||
|
||
module.exports = { | ||
plugins: { 'eslint-plugin': mod }, | ||
rules: mod.configs.tests.rules, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
'use strict'; | ||
|
||
const js = require('@eslint/js'); | ||
const { FlatCompat } = require('@eslint/eslintrc'); | ||
const globals = require('globals'); | ||
const markdown = require('eslint-plugin-markdown'); | ||
const eslintPluginConfig = require('eslint-plugin-eslint-plugin/configs/all'); | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
}); | ||
|
||
module.exports = [ | ||
...compat.extends( | ||
'not-an-aardvark/node', | ||
'plugin:eslint-comments/recommended', | ||
'plugin:node/recommended', | ||
'plugin:prettier/recommended', | ||
'plugin:unicorn/recommended' | ||
), | ||
{ | ||
languageOptions: { sourceType: 'commonjs' }, | ||
rules: { | ||
'comma-dangle': [ | ||
'error', | ||
{ | ||
arrays: 'always-multiline', | ||
objects: 'always-multiline', | ||
functions: 'never', // disallow trailing commas in function(es2017) | ||
}, | ||
], | ||
'require-jsdoc': 'error', | ||
|
||
'eslint-comments/no-unused-disable': 'error', | ||
'eslint-comments/require-description': 'error', | ||
|
||
'unicorn/consistent-function-scoping': 'off', | ||
'unicorn/no-array-callback-reference': 'off', | ||
'unicorn/no-array-for-each': 'off', | ||
'unicorn/no-array-reduce': 'off', | ||
'unicorn/no-null': 'off', | ||
'unicorn/prefer-module': 'off', | ||
'unicorn/prefer-node-protocol': 'off', // TODO: enable once we drop support for Node 14.17. | ||
'unicorn/prevent-abbreviations': 'off', | ||
}, | ||
}, | ||
{ | ||
// Apply eslint-plugin rules to our own rules/tests (but not docs). | ||
files: ['lib/**/*.js', 'tests/**/*.js'], | ||
plugins: eslintPluginConfig.plugins, | ||
rules: { | ||
...eslintPluginConfig.rules, | ||
'eslint-plugin/report-message-format': ['error', '^[^a-z].*.$'], | ||
'eslint-plugin/require-meta-docs-url': [ | ||
'error', | ||
{ | ||
pattern: | ||
'https://github.com/eslint-community/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/{{name}}.md', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['tests/**/*.js'], | ||
languageOptions: { globals: globals.mocha }, | ||
}, | ||
{ | ||
files: ['**/*.md'], | ||
plugins: { markdown }, | ||
processor: 'markdown/markdown', | ||
}, | ||
{ | ||
// Markdown JS code samples in documentation: | ||
files: ['**/*.md/*.js'], | ||
plugins: { markdown }, | ||
linterOptions: { noInlineConfig: true }, | ||
rules: { | ||
'no-undef': 'off', | ||
'no-unused-vars': 'off', | ||
strict: 'off', | ||
|
||
'eslint-comments/require-description': 'off', | ||
|
||
'unicorn/filename-case': 'off', | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters