chore: 接入 ESLint 并修复存量错误

This commit is contained in:
2026-08-27 21:48:32 +08:00
parent d33bc11014
commit 45e6663568
5 changed files with 2598 additions and 30 deletions
+32
View File
@@ -0,0 +1,32 @@
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import tseslint from 'typescript-eslint'
export default [
{
ignores: [
'dist/**',
'node_modules/**',
'test-results/**',
'playwright-report/**',
'env.d.ts',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
...pluginVue.configs['flat/essential'],
{
files: ['**/*.vue'],
languageOptions: {
parserOptions: { parser: tseslint.parser },
},
},
{
rules: {
// 页面级组件与路由表同名(Study/Review/Login…),命名约定见 AGENTS.md
'vue/multi-word-component-names': 'off',
// 渐进收敛:存量代码仍有 any,新代码约束见 AGENTS.md
'@typescript-eslint/no-explicit-any': 'warn',
},
},
]
+2555 -28
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -10,6 +10,8 @@
"build:production": "vite build --mode production", "build:production": "vite build --mode production",
"build": "vite build --mode production", "build": "vite build --mode production",
"preview": "vite preview", "preview": "vite preview",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"build-only": "vite build", "build-only": "vite build",
"type-check": "vue-tsc --build --force", "type-check": "vue-tsc --build --force",
"test": "vitest run", "test": "vitest run",
@@ -28,6 +30,7 @@
"vue-router": "^4.4.5" "vue-router": "^4.4.5"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.39.5",
"@playwright/test": "^1.60.0", "@playwright/test": "^1.60.0",
"@tsconfig/node20": "^20.1.4", "@tsconfig/node20": "^20.1.4",
"@types/jsdom": "^28.0.3", "@types/jsdom": "^28.0.3",
@@ -35,9 +38,13 @@
"@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue": "^5.1.4",
"@vue/test-utils": "^2.4.10", "@vue/test-utils": "^2.4.10",
"@vue/tsconfig": "^0.5.1", "@vue/tsconfig": "^0.5.1",
"eslint": "^9.39.5",
"eslint-plugin-vue": "^9.33.0",
"globals": "^17.11.0",
"jsdom": "^24.1.3", "jsdom": "^24.1.3",
"tsx": "^4.23.0", "tsx": "^4.23.0",
"typescript": "~5.6.0", "typescript": "~5.6.0",
"typescript-eslint": "^8.68.0",
"vite": "^5.4.10", "vite": "^5.4.10",
"vitest": "^2.1.9", "vitest": "^2.1.9",
"vue-tsc": "^2.1.6" "vue-tsc": "^2.1.6"
+1 -1
View File
@@ -7,7 +7,7 @@ import App from './App.vue'
import router from "@/router" import router from "@/router"
import 'normalize.css' import 'normalize.css'
var app = createApp(App) const app = createApp(App)
app.use(ElementPlus) app.use(ElementPlus)
app.use(router) app.use(router)
app.mount('#app') app.mount('#app')
+3 -1
View File
@@ -103,7 +103,9 @@ router.beforeEach((to) => {
if (taskNum) { if (taskNum) {
return `/start-task/${encodeURIComponent(taskNum)}?resume=true`; return `/start-task/${encodeURIComponent(taskNum)}?resume=true`;
} }
} catch {} } catch {
// activeSession 内容异常时不恢复会话
}
} }
} }
return true; return true;