From 108d1bac5c03cc8b7632e5fff81c2cf4a8aab0c0 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sun, 19 Jul 2026 16:25:46 +0800 Subject: [PATCH] fix: fix build warning and linter error --- frontend/eslint.config.ts | 17 +++++++++++++++++ .../src/components/collection/OwnedItem.vue | 2 +- frontend/src/router/index.ts | 2 +- frontend/src/views/Collection.vue | 4 ++-- frontend/vite.config.ts | 12 ++++++++++++ 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/frontend/eslint.config.ts b/frontend/eslint.config.ts index 0713270..885ab36 100644 --- a/frontend/eslint.config.ts +++ b/frontend/eslint.config.ts @@ -20,4 +20,21 @@ export default defineConfigWithVueTs( vueTsConfigs.recommended, ...pluginOxlint.buildFromOxlintConfigFile('.oxlintrc.json'), + + // 该前端由旧前端迁移而来,不得已使用 any,因此关闭此规则 + { + name: 'app/legacy-no-explicit-any', + rules: { + '@typescript-eslint/no-explicit-any': 'off', + }, + }, + + // views/ 目录下为路由页面级组件,非通用组件,不会与 HTML 原生元素冲突,因此关闭多词组件名检查 + { + name: 'app/views-single-word', + files: ['src/views/**/*.vue'], + rules: { + 'vue/multi-word-component-names': 'off', + }, + }, ) diff --git a/frontend/src/components/collection/OwnedItem.vue b/frontend/src/components/collection/OwnedItem.vue index bdff1a6..bc27cba 100644 --- a/frontend/src/components/collection/OwnedItem.vue +++ b/frontend/src/components/collection/OwnedItem.vue @@ -53,7 +53,7 @@ const cancelUpdateItem = () => {

{{ name }}

- +
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 4eaf4a2..b1a6b48 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -33,7 +33,7 @@ const router = createRouter({ routes: routes, }); -router.beforeEach((to, from) => { +router.beforeEach((to, _from) => { // Only check for those flagged. const token = useTokenStore(); if (to.meta.requireLoggedInCheck) { diff --git a/frontend/src/views/Collection.vue b/frontend/src/views/Collection.vue index be4fe5d..9691e98 100644 --- a/frontend/src/views/Collection.vue +++ b/frontend/src/views/Collection.vue @@ -212,7 +212,7 @@ const deleteSharingItem = async (username: string) => { -
+
@@ -243,7 +243,7 @@ const deleteSharingItem = async (username: string) => {
-
+
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index d35b356..b3655cc 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -15,6 +15,18 @@ export default defineConfig({ '@': fileURLToPath(new URL('./src', import.meta.url)) }, }, + + css: { + preprocessorOptions: { + scss: { + // 静默来自 Bulma 0.9.1 的 Sass 弃用警告(import / global-builtin / color-functions / slash-div / if-function) + // Bulma 0.9.1(发布于 2021 年)与新版 Dart Sass 不兼容。 + // 我的 pnpm-lock.yaml 和 node_modules 中的 Dart Sass 是 Vite 8 自带的新版本,而 Bulma 0.9.1 使用了大量已被 deprecate 的 Sass 老语法。 + // 我不想做任何升级,因此强制压制这些错误,还编译日志一个干净。 + silenceDeprecations: ['import', 'global-builtin', 'color-functions', 'slash-div', 'if-function'], + }, + }, + }, // 项目基础路径(对应 Nginx 路由到的 /web 前缀) base: '/web/',