mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-08 07:31:09 +08:00
feat: lint add yaml config
This commit is contained in:
@@ -49,8 +49,10 @@
|
||||
"eslint-plugin-unused-imports": "catalog:",
|
||||
"eslint-plugin-vitest": "catalog:",
|
||||
"eslint-plugin-vue": "catalog:",
|
||||
"eslint-plugin-yml": "catalog:",
|
||||
"globals": "catalog:",
|
||||
"jsonc-eslint-parser": "catalog:",
|
||||
"vue-eslint-parser": "catalog:"
|
||||
"vue-eslint-parser": "catalog:",
|
||||
"yaml-eslint-parser": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ export async function ignores(): Promise<Linter.Config[]> {
|
||||
'**/*.sh',
|
||||
'**/*.ttf',
|
||||
'**/*.woff',
|
||||
'**/.github',
|
||||
'**/lefthook.yml',
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -15,3 +15,4 @@ export * from './turbo';
|
||||
export * from './typescript';
|
||||
export * from './unicorn';
|
||||
export * from './vue';
|
||||
export * from './yaml';
|
||||
|
||||
87
internal/lint-configs/eslint-config/src/configs/yaml.ts
Normal file
87
internal/lint-configs/eslint-config/src/configs/yaml.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
export async function yaml(): Promise<Linter.Config[]> {
|
||||
const [pluginYaml, parserYaml] = await Promise.all([
|
||||
interopDefault(import('eslint-plugin-yml')),
|
||||
interopDefault(import('yaml-eslint-parser')),
|
||||
] as const);
|
||||
|
||||
return [
|
||||
{
|
||||
files: ['**/*.y?(a)ml'],
|
||||
plugins: {
|
||||
yaml: pluginYaml as any,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: parserYaml,
|
||||
},
|
||||
rules: {
|
||||
'style/spaced-comment': 'off',
|
||||
|
||||
'yaml/block-mapping': 'error',
|
||||
'yaml/block-sequence': 'error',
|
||||
'yaml/no-empty-key': 'error',
|
||||
'yaml/no-empty-sequence-entry': 'error',
|
||||
'yaml/no-irregular-whitespace': 'error',
|
||||
'yaml/plain-scalar': 'error',
|
||||
|
||||
'yaml/vue-custom-block/no-parsing-error': 'error',
|
||||
|
||||
'yaml/block-mapping-question-indicator-newline': 'error',
|
||||
'yaml/block-sequence-hyphen-indicator-newline': 'error',
|
||||
'yaml/flow-mapping-curly-newline': 'error',
|
||||
'yaml/flow-mapping-curly-spacing': 'error',
|
||||
'yaml/flow-sequence-bracket-newline': 'error',
|
||||
'yaml/flow-sequence-bracket-spacing': 'error',
|
||||
'yaml/indent': ['error', 2],
|
||||
'yaml/key-spacing': 'error',
|
||||
'yaml/no-tab-indent': 'error',
|
||||
'yaml/quotes': [
|
||||
'error',
|
||||
{
|
||||
avoidEscape: true,
|
||||
prefer: 'single',
|
||||
},
|
||||
],
|
||||
'yaml/spaced-comment': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['pnpm-workspace.yaml'],
|
||||
rules: {
|
||||
'yaml/sort-keys': [
|
||||
'error',
|
||||
{
|
||||
order: [
|
||||
'packages',
|
||||
'overrides',
|
||||
'patchedDependencies',
|
||||
'hoistPattern',
|
||||
'catalog',
|
||||
'catalogs',
|
||||
|
||||
'allowedDeprecatedVersions',
|
||||
'allowNonAppliedPatches',
|
||||
'configDependencies',
|
||||
'ignoredBuiltDependencies',
|
||||
'ignoredOptionalDependencies',
|
||||
'neverBuiltDependencies',
|
||||
'onlyBuiltDependencies',
|
||||
'onlyBuiltDependenciesFile',
|
||||
'packageExtensions',
|
||||
'peerDependencyRules',
|
||||
'supportedArchitectures',
|
||||
],
|
||||
pathPattern: '^$',
|
||||
},
|
||||
{
|
||||
order: { type: 'asc' },
|
||||
pathPattern: '.*',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
typescript,
|
||||
unicorn,
|
||||
vue,
|
||||
yaml,
|
||||
} from './configs';
|
||||
import { customConfig } from './custom-config';
|
||||
|
||||
@@ -48,6 +49,7 @@ async function defineConfig(config: FlatConfig[] = []) {
|
||||
regexp(),
|
||||
command(),
|
||||
turbo(),
|
||||
yaml(),
|
||||
...customConfig,
|
||||
...config,
|
||||
];
|
||||
|
||||
30
pnpm-lock.yaml
generated
30
pnpm-lock.yaml
generated
@@ -273,6 +273,9 @@ catalogs:
|
||||
eslint-plugin-vue:
|
||||
specifier: ^10.6.2
|
||||
version: 10.6.2
|
||||
eslint-plugin-yml:
|
||||
specifier: ^1.19.0
|
||||
version: 1.19.0
|
||||
execa:
|
||||
specifier: ^9.6.0
|
||||
version: 9.6.1
|
||||
@@ -513,6 +516,9 @@ catalogs:
|
||||
watermark-js-plus:
|
||||
specifier: ^1.6.2
|
||||
version: 1.6.3
|
||||
yaml-eslint-parser:
|
||||
specifier: ^1.3.1
|
||||
version: 1.3.1
|
||||
zod:
|
||||
specifier: ^3.25.67
|
||||
version: 3.25.76
|
||||
@@ -1038,6 +1044,9 @@ importers:
|
||||
eslint-plugin-vue:
|
||||
specifier: 'catalog:'
|
||||
version: 10.6.2(@typescript-eslint/parser@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.1(jiti@2.6.1))(vue-eslint-parser@10.2.0(eslint@9.39.1(jiti@2.6.1)))
|
||||
eslint-plugin-yml:
|
||||
specifier: 'catalog:'
|
||||
version: 1.19.0(eslint@9.39.1(jiti@2.6.1))
|
||||
globals:
|
||||
specifier: 'catalog:'
|
||||
version: 16.5.0
|
||||
@@ -1047,6 +1056,9 @@ importers:
|
||||
vue-eslint-parser:
|
||||
specifier: 'catalog:'
|
||||
version: 10.2.0(eslint@9.39.1(jiti@2.6.1))
|
||||
yaml-eslint-parser:
|
||||
specifier: 'catalog:'
|
||||
version: 1.3.1
|
||||
|
||||
internal/lint-configs/prettier-config:
|
||||
dependencies:
|
||||
@@ -6479,6 +6491,12 @@ packages:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
|
||||
eslint-plugin-yml@1.19.0:
|
||||
resolution: {integrity: sha512-S+4GbcCWksFKAvFJtf0vpdiCkZZvDJCV4Zsi9ahmYkYOYcf+LRqqzvzkb/ST7vTYV6sFwXOvawzYyL/jFT2nQA==}
|
||||
engines: {node: ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: '>=6.0.0'
|
||||
|
||||
eslint-scope@8.4.0:
|
||||
resolution: {integrity: sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
@@ -15879,6 +15897,18 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@typescript-eslint/parser': 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)
|
||||
|
||||
eslint-plugin-yml@1.19.0(eslint@9.39.1(jiti@2.6.1)):
|
||||
dependencies:
|
||||
debug: 4.4.3
|
||||
diff-sequences: 27.5.1
|
||||
escape-string-regexp: 4.0.0
|
||||
eslint: 9.39.1(jiti@2.6.1)
|
||||
eslint-compat-utils: 0.6.5(eslint@9.39.1(jiti@2.6.1))
|
||||
natural-compare: 1.4.0
|
||||
yaml-eslint-parser: 1.3.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-scope@8.4.0:
|
||||
dependencies:
|
||||
esrecurse: 4.3.0
|
||||
|
||||
@@ -90,6 +90,7 @@ catalog:
|
||||
dotenv: ^16.6.1
|
||||
echarts: ^6.0.0
|
||||
element-plus: ^2.10.2
|
||||
es-toolkit: ^1.41.0
|
||||
eslint: ^9.39.1
|
||||
eslint-config-turbo: ^2.6.1
|
||||
eslint-plugin-command: ^3.3.1
|
||||
@@ -106,6 +107,7 @@ catalog:
|
||||
eslint-plugin-unused-imports: ^4.3.0
|
||||
eslint-plugin-vitest: ^0.5.4
|
||||
eslint-plugin-vue: ^10.6.2
|
||||
eslint-plugin-yml: ^1.19.0
|
||||
execa: ^9.6.0
|
||||
find-up: ^7.0.0
|
||||
get-port: ^7.1.0
|
||||
@@ -192,6 +194,6 @@ catalog:
|
||||
vxe-pc-ui: ^4.10.22
|
||||
vxe-table: ^4.17.14
|
||||
watermark-js-plus: ^1.6.2
|
||||
yaml-eslint-parser: ^1.3.1
|
||||
zod: ^3.25.67
|
||||
zod-defaults: 0.1.3
|
||||
es-toolkit: ^1.41.0
|
||||
|
||||
Reference in New Issue
Block a user