From 886ecb6c2eb8ba01412e40fd514d57125035e3a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mac=C2=B7ufutx?= Date: Tue, 10 Jun 2025 16:15:04 +0800 Subject: [PATCH] =?UTF-8?q?20250610=20build=E3=80=81lint=E3=80=81dev?= =?UTF-8?q?=E5=9D=87=E9=85=8D=E7=BD=AE=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 8 ++++---- tsconfig.app.json | 23 ++++++++++++++++------- tsconfig.node.json | 31 ++++++++++++++++++++++--------- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index f21822a..352a68c 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,9 @@ "vue-router": "^4.5.1" }, "devDependencies": { - "@types/axios": "^0.9.36", - "@typescript-eslint/eslint-plugin": "5.62.0", - "@typescript-eslint/parser": "5.62.0", + "@types/node": "^20.19.0", + "@typescript-eslint/eslint-plugin": "6.13.2", + "@typescript-eslint/parser": "6.13.2", "@vitejs/plugin-vue": "^4.2.3", "@vue/eslint-config-typescript": "12.0.0", "@vue/tsconfig": "^0.7.0", @@ -48,6 +48,6 @@ "typescript": "5.1.6", "vite": "^4.4.9", "vite-plugin-image-optimizer": "^1.1.8", - "vue-tsc": "^2.2.10" + "vue-tsc": "1.8.14" } } diff --git a/tsconfig.app.json b/tsconfig.app.json index 9a1021e..f817746 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -2,9 +2,14 @@ "extends": "@vue/tsconfig/tsconfig.dom.json", "compilerOptions": { "baseUrl": ".", + "lib": [ + "ES2022", + "DOM" + ], + // 关键:添加 DOM 类型库 "paths": { "@/*": [ - "src/*" + "./src/*" ] // 添加路径别名 }, @@ -14,22 +19,26 @@ "vite/client", "vue" ], + "incremental": true, // 添加这一行 // 新增 Vue 类型声明 "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, -// "erasableSyntaxOnly": true, // 移除这个不支持的选项 - "noFallthroughCasesInSwitch": true, -// "noUncheckedSideEffectImports": true + // "erasableSyntaxOnly": true, // 移除这个不支持的选项 + "noFallthroughCasesInSwitch": true + // "noUncheckedSideEffectImports": true }, "include": [ "src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", - "src/**/*.vue", // 必须包含 Vue 文件 - "vite.config.ts", // 包含 Vite 配置文件 - "src/main.ts" // 包含入口文件 + "src/**/*.vue", + // 必须包含 Vue 文件 + "vite.config.ts", + // 包含 Vite 配置文件 + "src/main.ts" + // 包含入口文件 ] } diff --git a/tsconfig.node.json b/tsconfig.node.json index abca77a..5eee59c 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -2,32 +2,45 @@ "compilerOptions": { "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", "target": "ES2022", - "lib": ["ES2023"], + "lib": [ + "ES2022", + "DOM", + ], + "paths": { + "@/*": [ + "./src/*" + ] + // 添加路径别名 + }, "module": "ESNext", "skipLibCheck": true, - /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, "verbatimModuleSyntax": true, "moduleDetection": "force", "noEmit": true, - + "esModuleInterop": true, + // 关键:允许 CommonJS 导入 /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "erasableSyntaxOnlsy": true, + // "erasableSyntaxOnlsy": true, "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true + "incremental": true + // "noUncheckedSideEffectImports": true }, -// "include": ["vite.config.ts"] + // "include": ["vite.config.ts"] "include": [ "src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", - "src/**/*.vue", // 必须包含 Vue 文件 - "vite.config.ts", // 包含 Vite 配置文件 - "src/main.ts" // 包含入口文件 + "src/**/*.vue", + // 必须包含 Vue 文件 + "vite.config.ts", + // 包含 Vite 配置文件 + "src/main.ts" + // 包含入口文件 ] }