Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into dev
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vben/eslint-config",
|
||||
"version": "5.0.0",
|
||||
"version": "5.5.9",
|
||||
"private": true,
|
||||
"homepage": "https://github.com/vbenjs/vue-vben-admin",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
@@ -43,14 +43,17 @@
|
||||
"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:",
|
||||
"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:"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@ export async function ignores(): Promise<Linter.Config[]> {
|
||||
'**/*.woff',
|
||||
'**/public/**',
|
||||
'**/china.json',
|
||||
'**/.github',
|
||||
'**/lefthook.yml',
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -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';
|
||||
@@ -15,3 +16,4 @@ export * from './turbo';
|
||||
export * from './typescript';
|
||||
export * from './unicorn';
|
||||
export * from './vue';
|
||||
export * from './yaml';
|
||||
|
||||
@@ -48,6 +48,7 @@ export async function jsonc(): Promise<Linter.Config[]> {
|
||||
},
|
||||
sortTsconfig(),
|
||||
sortPackageJson(),
|
||||
sortCspellJson(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -130,6 +131,21 @@ function sortPackageJson(): Linter.Config {
|
||||
};
|
||||
}
|
||||
|
||||
function sortCspellJson(): Linter.Config {
|
||||
return {
|
||||
files: ['**/cspell.json', '**/.cspell.json'],
|
||||
rules: {
|
||||
'jsonc/sort-array-values': [
|
||||
'error',
|
||||
{
|
||||
order: { type: 'asc' },
|
||||
pathPattern: '^words$|^ignorePaths$',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function sortTsconfig(): Linter.Config {
|
||||
return {
|
||||
files: [
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
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: '.*',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
jsonc,
|
||||
node,
|
||||
perfectionist,
|
||||
pnpm,
|
||||
prettier,
|
||||
regexp,
|
||||
test,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
typescript,
|
||||
unicorn,
|
||||
vue,
|
||||
yaml,
|
||||
} from './configs';
|
||||
import { customConfig } from './custom-config';
|
||||
|
||||
@@ -48,6 +50,8 @@ async function defineConfig(config: FlatConfig[] = []) {
|
||||
regexp(),
|
||||
command(),
|
||||
turbo(),
|
||||
yaml(),
|
||||
pnpm(),
|
||||
...customConfig,
|
||||
...config,
|
||||
];
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@vben/tsconfig/node.json",
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "bundler"
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vben/prettier-config",
|
||||
"version": "5.0.0",
|
||||
"version": "5.5.9",
|
||||
"private": true,
|
||||
"homepage": "https://github.com/vbenjs/vue-vben-admin",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
|
||||
@@ -75,6 +75,7 @@ export default {
|
||||
'import-notation': null,
|
||||
'media-feature-range-notation': null,
|
||||
'named-grid-areas-no-invalid': null,
|
||||
'nesting-selector-no-missing-scoping-root': null,
|
||||
'no-descending-specificity': null,
|
||||
'no-empty-source': null,
|
||||
'order/order': [
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@vben/tsconfig/node.json",
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "bundler"
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"composite": false,
|
||||
"lib": ["ESNext"],
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "bundler",
|
||||
"types": ["node"],
|
||||
"noImplicitAny": true
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DefineConfig } from '../typing';
|
||||
import type { DefineConfig, VbenViteConfig } from '../typing';
|
||||
|
||||
import { existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
@@ -12,7 +12,7 @@ export * from './library';
|
||||
function defineConfig(
|
||||
userConfigPromise?: DefineConfig,
|
||||
type: 'application' | 'auto' | 'library' = 'auto',
|
||||
) {
|
||||
): VbenViteConfig {
|
||||
let projectType = type;
|
||||
|
||||
// 根据包是否存在 index.html,自动判断类型
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import type { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
|
||||
import type { ConfigEnv, PluginOption, UserConfig } from 'vite';
|
||||
import type {
|
||||
ConfigEnv,
|
||||
PluginOption,
|
||||
UserConfig,
|
||||
UserConfigFnPromise,
|
||||
} from 'vite';
|
||||
import type { PluginOptions } from 'vite-plugin-dts';
|
||||
import type { Options as PwaPluginOptions } from 'vite-plugin-pwa';
|
||||
|
||||
@@ -327,6 +332,8 @@ type DefineLibraryOptions = (config?: ConfigEnv) => Promise<{
|
||||
*/
|
||||
type DefineConfig = DefineApplicationOptions | DefineLibraryOptions;
|
||||
|
||||
type VbenViteConfig = Promise<UserConfig> | UserConfig | UserConfigFnPromise;
|
||||
|
||||
export type {
|
||||
ApplicationPluginOptions,
|
||||
ArchiverPluginOptions,
|
||||
@@ -340,4 +347,5 @@ export type {
|
||||
LibraryPluginOptions,
|
||||
NitroMockPluginOptions,
|
||||
PrintPluginOptions,
|
||||
VbenViteConfig,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user