Skip to content

Commit 7e6e8f5

Browse files
committed
feat: update pnpm plugin
1 parent 9ced2a5 commit 7e6e8f5

File tree

3 files changed

+62
-35
lines changed

3 files changed

+62
-35
lines changed

pnpm-lock.yaml

+31-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ catalogs:
6363
eslint-plugin-n: ^17.16.2
6464
eslint-plugin-no-only-tests: ^3.3.0
6565
eslint-plugin-perfectionist: ^4.10.1
66-
eslint-plugin-pnpm: ^0.2.0
66+
eslint-plugin-pnpm: ^0.3.0
6767
eslint-plugin-regexp: ^2.7.0
6868
eslint-plugin-toml: ^0.12.0
6969
eslint-plugin-unicorn: ^57.0.0

src/configs/pnpm.ts

+30-6
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,47 @@ import type { TypedFlatConfigItem } from '../types'
33
import { interopDefault } from '../utils'
44

55
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+
616
return [
717
{
818
files: [
919
'package.json',
1020
'**/package.json',
1121
],
1222
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,
1439
},
15-
name: 'antfu/pnpm/rules',
40+
name: 'antfu/pnpm/pnpm-workspace-yaml',
1641
plugins: {
17-
pnpm: await interopDefault(import('eslint-plugin-pnpm')),
42+
pnpm: pluginPnpm,
1843
},
1944
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',
2347
},
2448
},
2549
]

0 commit comments

Comments
 (0)