|
| 1 | +const { configs: eslintConfigs } = require('@eslint/js'); |
| 2 | +const eslintPluginN = require('eslint-plugin-n'); |
| 3 | +const eslintPluginEslintComments = require('@eslint-community/eslint-plugin-eslint-comments'); |
| 4 | +const eslintPluginEslintPluginRecommended = require('eslint-plugin-eslint-plugin/configs/recommended'); |
| 5 | +const eslintPluginMdx = require('eslint-plugin-mdx'); |
| 6 | +const eslintConfigPrettier = require('eslint-config-prettier'); |
| 7 | +const eslintPluginPrettier = require('./eslint-plugin-prettier'); |
| 8 | + |
| 9 | +module.exports = [ |
| 10 | + eslintConfigs.recommended, |
| 11 | + eslintPluginN.configs['flat/recommended'], |
| 12 | + // eslint-community/eslint-comments does not expose a reusable flat config, |
| 13 | + // so create one from its legacy config |
| 14 | + { |
| 15 | + plugins: { |
| 16 | + '@eslint-community/eslint-comments': eslintPluginEslintComments, |
| 17 | + }, |
| 18 | + rules: eslintPluginEslintComments.configs.recommended.rules, |
| 19 | + }, |
| 20 | + eslintPluginEslintPluginRecommended, |
| 21 | + eslintPluginMdx.flat, |
| 22 | + eslintPluginMdx.flatCodeBlocks, |
| 23 | + eslintConfigPrettier, |
| 24 | + // No built-in flat recommended config yet |
| 25 | + { |
| 26 | + plugins: { prettier: eslintPluginPrettier }, |
| 27 | + rules: eslintPluginPrettier.configs.recommended.rules, |
| 28 | + }, |
| 29 | + { |
| 30 | + rules: { |
| 31 | + 'eslint-plugin/report-message-format': ['error', '^[^a-z].*\\.$'], |
| 32 | + }, |
| 33 | + }, |
| 34 | + { |
| 35 | + files: ['**/*.md'], |
| 36 | + rules: { 'prettier/prettier': ['error', { parser: 'markdown' }] }, |
| 37 | + }, |
| 38 | + { |
| 39 | + files: ['**/*.mdx'], |
| 40 | + rules: { 'prettier/prettier': ['error', { parser: 'mdx' }] }, |
| 41 | + }, |
| 42 | + // Global ignores |
| 43 | + // If a config block only contains an `ignores` key, then the globs are |
| 44 | + // ignored globally |
| 45 | + { |
| 46 | + ignores: [ |
| 47 | + 'CHANGELOG.md', |
| 48 | + '.github/ISSUE_TEMPLATE.md', |
| 49 | + 'test/fixtures/**/*', |
| 50 | + ], |
| 51 | + }, |
| 52 | +]; |
0 commit comments