From 7c05fe29d87f3fa6e3fc4cdf171ba7c6fb7f9c8e Mon Sep 17 00:00:00 2001 From: chufan Date: Mon, 30 Sep 2024 08:51:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(@142vip/eslint-config):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D`lint`=E5=91=BD=E4=BB=A4=E6=89=A7=E8=A1=8C=E8=BF=87?= =?UTF-8?q?=E6=85=A2=E9=97=AE=E9=A2=98=EF=BC=8C=E5=88=A0=E9=99=A4`eslint-p?= =?UTF-8?q?lugin-format`=E6=8F=92=E4=BB=B6=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/eslint-config/package.json | 3 +-- packages/eslint-config/src/eslint.config.ts | 29 +++++++++------------ pnpm-lock.yaml | 24 ++++++++++------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 732de2b..d5fdf11 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -34,8 +34,7 @@ }, "dependencies": { "@antfu/eslint-config": "^2.27.3", - "eslint": "8.55.0", - "eslint-plugin-format": "^0.1.2" + "eslint": "8.55.0" }, "publishConfig": { "access": "public", diff --git a/packages/eslint-config/src/eslint.config.ts b/packages/eslint-config/src/eslint.config.ts index 1a3d472..4a5846c 100644 --- a/packages/eslint-config/src/eslint.config.ts +++ b/packages/eslint-config/src/eslint.config.ts @@ -7,17 +7,18 @@ import { antfu } from '@antfu/eslint-config' /** * 默认的Eslint配置 */ -export const defaultEslintConfig = { +export const defaultEslintConfig: EslintConfigOptions = { gitignore: true, typescript: true, vue: true, jsonc: true, yaml: true, - formatters: { - css: true, - html: true, - markdown: 'prettier', - }, + // formatters: { + // css: true, + // html: true, + // markdown: 'prettier', + // }, + markdown: true, } /** @@ -38,18 +39,14 @@ type EslintConfigOptions = OptionsConfig & TypedFlatConfigItem * 参考:https://github.com/antfu/eslint-config * @param options */ -export function defineVipEslintConfig( +export async function defineVipEslintConfig( options: EslintConfigOptions = {}, -): any { - return antfu({ +): Promise { + return antfu(defaultEslintConfig, { ...options, - ...defaultEslintConfig, - ignores: [ - ...options.ignores ?? [], - ], rules: { ...baseEslintRules, - ...options.rules ?? {}, - }, - } as EslintConfigOptions) + ...(options.rules ?? {}), + } as any, + }) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 33ba0d1..e60ab6f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -178,9 +178,6 @@ importers: eslint: specifier: 8.55.0 version: 8.55.0 - eslint-plugin-format: - specifier: ^0.1.2 - version: 0.1.2(eslint@8.55.0) packages/fairy-cli: dependencies: @@ -10099,11 +10096,14 @@ snapshots: transitivePeerDependencies: - '@algolia/client-search' - '@dprint/formatter@0.3.0': {} + '@dprint/formatter@0.3.0': + optional: true - '@dprint/markdown@0.17.8': {} + '@dprint/markdown@0.17.8': + optional: true - '@dprint/toml@0.6.2': {} + '@dprint/toml@0.6.2': + optional: true '@element-plus/icons-vue@2.3.1(vue@3.5.8(typescript@5.6.2))': dependencies: @@ -14031,6 +14031,7 @@ snapshots: dependencies: eslint: 8.55.0 prettier-linter-helpers: 1.0.0 + optional: true eslint-import-resolver-node@0.3.9: dependencies: @@ -14044,7 +14045,8 @@ snapshots: dependencies: eslint: 8.55.0 - eslint-parser-plain@0.1.0: {} + eslint-parser-plain@0.1.0: + optional: true eslint-plugin-antfu@2.7.0(eslint@8.55.0): dependencies: @@ -14073,6 +14075,7 @@ snapshots: eslint-parser-plain: 0.1.0 prettier: 3.3.3 synckit: 0.9.1 + optional: true eslint-plugin-import-x@4.3.0(eslint@8.55.0)(typescript@5.6.2): dependencies: @@ -14466,7 +14469,8 @@ snapshots: fast-deep-equal@3.1.3: {} - fast-diff@1.3.0: {} + fast-diff@1.3.0: + optional: true fast-glob@3.3.2: dependencies: @@ -17158,8 +17162,10 @@ snapshots: prettier-linter-helpers@1.0.0: dependencies: fast-diff: 1.3.0 + optional: true - prettier@3.3.3: {} + prettier@3.3.3: + optional: true pretty-bytes@5.6.0: {}