-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use flat config for the project's eslint configuration (#615)
* chore: use flat config for the project's eslint configuration This shall let us dogfood the recommended eslint config when we add it * chore: skip perf step in node 14 as eslint plugin isn't compatible with v14
- Loading branch information
Showing
6 changed files
with
154 additions
and
86 deletions.
There are no files selected for viewing
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,52 @@ | ||
const { configs: eslintConfigs } = require('@eslint/js'); | ||
const eslintPluginN = require('eslint-plugin-n'); | ||
const eslintPluginEslintComments = require('@eslint-community/eslint-plugin-eslint-comments'); | ||
const eslintPluginEslintPluginRecommended = require('eslint-plugin-eslint-plugin/configs/recommended'); | ||
const eslintPluginMdx = require('eslint-plugin-mdx'); | ||
const eslintConfigPrettier = require('eslint-config-prettier'); | ||
const eslintPluginPrettier = require('./eslint-plugin-prettier'); | ||
|
||
module.exports = [ | ||
eslintConfigs.recommended, | ||
eslintPluginN.configs['flat/recommended'], | ||
// eslint-community/eslint-comments does not expose a reusable flat config, | ||
// so create one from its legacy config | ||
{ | ||
plugins: { | ||
'@eslint-community/eslint-comments': eslintPluginEslintComments, | ||
}, | ||
rules: eslintPluginEslintComments.configs.recommended.rules, | ||
}, | ||
eslintPluginEslintPluginRecommended, | ||
eslintPluginMdx.flat, | ||
eslintPluginMdx.flatCodeBlocks, | ||
eslintConfigPrettier, | ||
// No built-in flat recommended config yet | ||
{ | ||
plugins: { prettier: eslintPluginPrettier }, | ||
rules: eslintPluginPrettier.configs.recommended.rules, | ||
}, | ||
{ | ||
rules: { | ||
'eslint-plugin/report-message-format': ['error', '^[^a-z].*\\.$'], | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.md'], | ||
rules: { 'prettier/prettier': ['error', { parser: 'markdown' }] }, | ||
}, | ||
{ | ||
files: ['**/*.mdx'], | ||
rules: { 'prettier/prettier': ['error', { parser: 'mdx' }] }, | ||
}, | ||
// Global ignores | ||
// If a config block only contains an `ignores` key, then the globs are | ||
// ignored globally | ||
{ | ||
ignores: [ | ||
'CHANGELOG.md', | ||
'.github/ISSUE_TEMPLATE.md', | ||
'test/fixtures/**/*', | ||
], | ||
}, | ||
]; |
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
Oops, something went wrong.