From 4390ce031b4ab17cbc8781ba7b2916802a17d752 Mon Sep 17 00:00:00 2001 From: D056966 Date: Tue, 16 Sep 2025 14:02:25 +0200 Subject: [PATCH] feat: add shared config `all` --- README.md | 14 ++++++++++++-- src/index.ts | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5afba87..bc2981d 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,19 @@ npm install --save-dev eslint eslint-plugin-prefer-arrow-functions ### Flat -For ESLint 9 and above. +For ESLint 9 and above, use the shared config `all` in `eslint.config.mjs`: -`eslint.config.mjs`: +```js +import pluginJs from '@eslint/js'; +import preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions'; + +export default [ + pluginJs.configs.all, + preferArrowFunctions.configs.all, +]; +``` + +Or configure the rule(s) on your own: ```js import pluginJs from '@eslint/js'; diff --git a/src/index.ts b/src/index.ts index e7430d3..ff9eb3c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,4 +17,14 @@ const plugin: TSESLint.FlatConfig.Plugin = { rules, }; +export const configs: TSESLint.FlatConfig.SharedConfigs = { + all: { + plugins: { 'prefer-arrow-functions': plugin }, + rules: { + 'prefer-arrow-functions/prefer-arrow-functions': 'warn', + }, + }, +}; +plugin.configs = configs; + export default plugin;