From fb9e3fab88fc0fd408269dda2f8854b7dd55a3ae Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Sun, 28 Sep 2025 20:49:28 +0200 Subject: [PATCH 1/3] feat: support standard flat file format --- eslint-plugin-prettier.d.ts | 8 +++++++- eslint-plugin-prettier.js | 22 ++++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/eslint-plugin-prettier.d.ts b/eslint-plugin-prettier.d.ts index eafdb4a1..72ba13c8 100644 --- a/eslint-plugin-prettier.d.ts +++ b/eslint-plugin-prettier.d.ts @@ -1,5 +1,11 @@ import { ESLint } from 'eslint'; -declare const eslintPluginPrettier: ESLint.Plugin; +declare const eslintPluginPrettier: ESLint.Plugin & { + configs: { + recommended: import('eslint').Linter.Config< + import('eslint').Linter.RulesRecord + >[]; + }; +}; export = eslintPluginPrettier; diff --git a/eslint-plugin-prettier.js b/eslint-plugin-prettier.js index 0ef19af9..8c56e0b8 100644 --- a/eslint-plugin-prettier.js +++ b/eslint-plugin-prettier.js @@ -131,15 +131,21 @@ function reportDifference(context, difference) { const eslintPluginPrettier = { meta: { name, version }, configs: { - recommended: { - extends: ['prettier'], - plugins: ['prettier'], - rules: { - 'prettier/prettier': 'error', - 'arrow-body-style': 'off', - 'prefer-arrow-callback': 'off', + recommended: [ + { + name: 'prettier/recommended', + plugins: { + get prettier() { + return eslintPluginPrettier; + }, + }, + rules: { + 'prettier/prettier': 'error', + 'arrow-body-style': 'off', + 'prefer-arrow-callback': 'off', + }, }, - }, + ], }, rules: { prettier: { From 28a631e52dd5a110a6d62eb5d68a44a5d965b1e3 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Sun, 28 Sep 2025 20:56:56 +0200 Subject: [PATCH 2/3] docs: update docs to match standard flat format --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6bc12623..f0353062 100644 --- a/README.md +++ b/README.md @@ -80,17 +80,18 @@ This will: ## Configuration (new: `eslint.config.js`) -For [flat configuration](https://eslint.org/docs/latest/use/configure/configuration-files-new), this plugin ships with an `eslint-plugin-prettier/recommended` config that sets up both `eslint-plugin-prettier` and [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) in one go. +For [flat configuration](https://eslint.org/docs/latest/use/configure/configuration-files-new), this plugin ships with a `recommended` config that sets up both `eslint-plugin-prettier` and [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) in one go. -Import `eslint-plugin-prettier/recommended` and add it as the _last_ item in the configuration array in your `eslint.config.js` file so that `eslint-config-prettier` has the opportunity to override other configs: +Import `eslint-plugin-prettier` and use `...prettier.configs.recommended` as the _last_ item in your `defineConfig` so that `eslint-config-prettier` has the opportunity to override other configs: ```js -const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended'); +import prettier from 'eslint-plugin-prettier'; +import { defineConfig } from 'eslint/config'; -module.exports = [ +export default defineConfig( // Any other config imports go at the top - eslintPluginPrettierRecommended, -]; + ...prettier.configs.recommended, +); ``` This will: From 5ddbd8e320427d0e8961c5a82a0026761d1cfdee Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Sun, 28 Sep 2025 21:07:00 +0200 Subject: [PATCH 3/3] feat: create changeset --- .changeset/eleven-foxes-bet.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/eleven-foxes-bet.md diff --git a/.changeset/eleven-foxes-bet.md b/.changeset/eleven-foxes-bet.md new file mode 100644 index 00000000..b0c0cdb1 --- /dev/null +++ b/.changeset/eleven-foxes-bet.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-prettier": minor +--- + +Add support for the standard flat file format.