diff --git a/eslint.config.js b/eslint.config.js index 9bd6543c..050cd5d1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -4,7 +4,7 @@ const eslintPluginEslintComments = require('@eslint-community/eslint-plugin-esli 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'); +const eslintPluginPrettierRecommended = require('./recommended'); module.exports = [ eslintConfigs.recommended, @@ -21,11 +21,7 @@ module.exports = [ eslintPluginMdx.flat, eslintPluginMdx.flatCodeBlocks, eslintConfigPrettier, - // No built-in flat recommended config yet - { - plugins: { prettier: eslintPluginPrettier }, - rules: eslintPluginPrettier.configs.recommended.rules, - }, + eslintPluginPrettierRecommended, { rules: { 'eslint-plugin/report-message-format': ['error', '^[^a-z].*\\.$'], diff --git a/package.json b/package.json index 2d92bc23..ec1b5ac8 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,8 @@ "files": [ "eslint-plugin-prettier.d.ts", "eslint-plugin-prettier.js", + "recommended.d.ts", + "recommended.js", "worker.js" ], "keywords": [ diff --git a/recommended.d.ts b/recommended.d.ts new file mode 100644 index 00000000..9ebc81d7 --- /dev/null +++ b/recommended.d.ts @@ -0,0 +1,5 @@ +import { Linter } from 'eslint'; + +declare const recommendedConfig: Linter.FlatConfig; + +export = recommendedConfig; diff --git a/recommended.js b/recommended.js new file mode 100644 index 00000000..9d5d418e --- /dev/null +++ b/recommended.js @@ -0,0 +1,15 @@ +const eslintPluginPrettier = require('./eslint-plugin-prettier'); + +// This diverges from the legacy format recommended config, as it does not +// extend from the `eslint-config-prettier` ruleset. When using the flat config +// the consumer should add eslint-config-prettier to their own root config. +module.exports = { + plugins: { + prettier: eslintPluginPrettier, + }, + rules: { + 'prettier/prettier': 'error', + 'arrow-body-style': 'off', + 'prefer-arrow-callback': 'off', + }, +};