feat: lint add pnpm config
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
"eslint-plugin-n": "catalog:",
|
||||
"eslint-plugin-no-only-tests": "catalog:",
|
||||
"eslint-plugin-perfectionist": "catalog:",
|
||||
"eslint-plugin-pnpm": "catalog:",
|
||||
"eslint-plugin-prettier": "catalog:",
|
||||
"eslint-plugin-regexp": "catalog:",
|
||||
"eslint-plugin-unicorn": "catalog:",
|
||||
|
||||
@@ -8,6 +8,7 @@ export * from './jsdoc';
|
||||
export * from './jsonc';
|
||||
export * from './node';
|
||||
export * from './perfectionist';
|
||||
export * from './pnpm';
|
||||
export * from './prettier';
|
||||
export * from './regexp';
|
||||
export * from './test';
|
||||
|
||||
41
internal/lint-configs/eslint-config/src/configs/pnpm.ts
Normal file
41
internal/lint-configs/eslint-config/src/configs/pnpm.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function pnpm(): Promise<Linter.Config[]> {
|
||||
const [pluginPnpm, parserPnpm, parserJsonc] = await Promise.all([
|
||||
interopDefault(import('eslint-plugin-pnpm')),
|
||||
interopDefault(import('yaml-eslint-parser')),
|
||||
interopDefault(import('jsonc-eslint-parser')),
|
||||
] as const);
|
||||
|
||||
return [
|
||||
{
|
||||
files: ['package.json', '**/package.json'],
|
||||
languageOptions: {
|
||||
parser: parserJsonc,
|
||||
},
|
||||
plugins: {
|
||||
pnpm: pluginPnpm,
|
||||
},
|
||||
rules: {
|
||||
'pnpm/json-enforce-catalog': 'error',
|
||||
'pnpm/json-prefer-workspace-settings': 'error',
|
||||
'pnpm/json-valid-catalog': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['pnpm-workspace.yaml'],
|
||||
languageOptions: {
|
||||
parser: parserPnpm,
|
||||
},
|
||||
plugins: {
|
||||
pnpm: pluginPnpm,
|
||||
},
|
||||
rules: {
|
||||
'pnpm/yaml-no-duplicate-catalog-item': 'error',
|
||||
'pnpm/yaml-no-unused-catalog-item': 'error',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
jsonc,
|
||||
node,
|
||||
perfectionist,
|
||||
pnpm,
|
||||
prettier,
|
||||
regexp,
|
||||
test,
|
||||
@@ -50,6 +51,7 @@ async function defineConfig(config: FlatConfig[] = []) {
|
||||
command(),
|
||||
turbo(),
|
||||
yaml(),
|
||||
pnpm(),
|
||||
...customConfig,
|
||||
...config,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user