Skip to content

Commit 77335ef

Browse files
feat: add shared config all
1 parent 07ac1b2 commit 77335ef

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@ npm install --save-dev eslint eslint-plugin-prefer-arrow-functions
1313

1414
### Flat
1515

16-
For ESLint 9 and above.
16+
For ESLint 9 and above, use the shared config `all` in `eslint.config.mjs`:
1717

18-
`eslint.config.mjs`:
18+
```js
19+
import pluginJs from '@eslint/js';
20+
import preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions';
21+
22+
export default [
23+
pluginJs.configs.all,
24+
preferArrowFunctions.configs.all,
25+
];
26+
```
27+
28+
Or configure the rule(s) on your own:
1929

2030
```js
2131
import pluginJs from '@eslint/js';

src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,14 @@ const plugin: TSESLint.FlatConfig.Plugin = {
1717
rules,
1818
};
1919

20+
export const configs: TSESLint.FlatConfig.SharedConfigs = {
21+
all: {
22+
plugins: { 'prefer-arrow-functions': plugin },
23+
rules: {
24+
'prefer-arrow-functions/prefer-arrow-functions': 'warn',
25+
},
26+
},
27+
};
28+
plugin.configs = configs;
29+
2030
export default plugin;

0 commit comments

Comments
 (0)