@@ -3,23 +3,47 @@ import type { TypedFlatConfigItem } from '../types'
3
3
import { interopDefault } from '../utils'
4
4
5
5
export async function pnpm ( ) : Promise < TypedFlatConfigItem [ ] > {
6
+ const [
7
+ pluginPnpm ,
8
+ yamlParser ,
9
+ jsoncParser ,
10
+ ] = await Promise . all ( [
11
+ interopDefault ( import ( 'eslint-plugin-pnpm' ) ) ,
12
+ interopDefault ( import ( 'yaml-eslint-parser' ) ) ,
13
+ interopDefault ( import ( 'jsonc-eslint-parser' ) ) ,
14
+ ] )
15
+
6
16
return [
7
17
{
8
18
files : [
9
19
'package.json' ,
10
20
'**/package.json' ,
11
21
] ,
12
22
languageOptions : {
13
- parser : await interopDefault ( import ( 'jsonc-eslint-parser' ) ) ,
23
+ parser : jsoncParser ,
24
+ } ,
25
+ name : 'antfu/pnpm/package-json' ,
26
+ plugins : {
27
+ pnpm : pluginPnpm ,
28
+ } ,
29
+ rules : {
30
+ 'pnpm/json-enforce-catalog' : 'error' ,
31
+ 'pnpm/json-prefer-workspace-settings' : 'error' ,
32
+ 'pnpm/json-valid-catalog' : 'error' ,
33
+ } ,
34
+ } ,
35
+ {
36
+ files : [ 'pnpm-workspace.yaml' ] ,
37
+ languageOptions : {
38
+ parser : yamlParser ,
14
39
} ,
15
- name : 'antfu/pnpm/rules ' ,
40
+ name : 'antfu/pnpm/pnpm-workspace-yaml ' ,
16
41
plugins : {
17
- pnpm : await interopDefault ( import ( 'eslint-plugin-pnpm' ) ) ,
42
+ pnpm : pluginPnpm ,
18
43
} ,
19
44
rules : {
20
- 'pnpm/enforce-catalog' : 'error' ,
21
- 'pnpm/prefer-workspace-settings' : 'error' ,
22
- 'pnpm/valid-catalog' : 'error' ,
45
+ 'pnpm/yaml-no-duplicate-catalog-item' : 'error' ,
46
+ 'pnpm/yaml-no-unused-catalog-item' : 'error' ,
23
47
} ,
24
48
} ,
25
49
]
0 commit comments