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;