-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use flat config for the project's eslint configuration
This shall let us dogfood the recommended eslint config when we add it
- Loading branch information
Showing
5 changed files
with
151 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
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 mdx = 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, | ||
mdx.flat, | ||
mdx.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 any ignores key, then the globs are | ||
// considerd as globally ignored | ||
{ | ||
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.