chore(frontend): introduce prettier + eslint and prune unused code
Backend CI / Backend (push) Has been cancelled
Frontend CI / Frontend (push) Failing after 1m39s

- Add Prettier 3 with prettier-plugin-organize-imports (sorts/removes unused imports)
- Add ESLint 10 flat config with typescript-eslint + eslint-plugin-vue + eslint-config-prettier
- Add root scripts: format, format:check, lint, lint:fix
- Reformat 257 files across admin-web, ops-web, desktop-client, packages
- Remove unused locals/exports flagged by --noUnusedLocals/--noUnusedParameters
- Fix duplicate localTabLabel key, surrogate-pair regex u-flag, NBSP literal in regex
- Skip server/ (Go) and apps/browser-extension/ (deprecated per ADR)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-01 20:39:09 +08:00
parent 21c7892ee4
commit 162abdc97c
258 changed files with 42261 additions and 37556 deletions
+50 -50
View File
@@ -1,91 +1,91 @@
import { createRouter, createWebHistory } from "vue-router";
import { createRouter, createWebHistory } from 'vue-router'
import { pinia } from "@/stores/pinia";
import { useAuthStore } from "@/stores/auth";
import { useAuthStore } from '@/stores/auth'
import { pinia } from '@/stores/pinia'
export const router = createRouter({
history: createWebHistory(),
routes: [
{
path: "/login",
name: "login",
component: () => import("@/views/LoginView.vue"),
meta: { title: "登录" },
path: '/login',
name: 'login',
component: () => import('@/views/LoginView.vue'),
meta: { title: '登录' },
},
{
path: "/",
component: () => import("@/layouts/AppShell.vue"),
path: '/',
component: () => import('@/layouts/AppShell.vue'),
meta: { requiresAuth: true },
children: [
{ path: "", redirect: "/admin-users" },
{ path: '', redirect: '/admin-users' },
{
path: "admin-users",
name: "admin-users",
component: () => import("@/views/AdminUsersView.vue"),
meta: { title: "用户管理" },
path: 'admin-users',
name: 'admin-users',
component: () => import('@/views/AdminUsersView.vue'),
meta: { title: '用户管理' },
},
{
path: "kol-subscriptions",
name: "kol-subscriptions",
component: () => import("@/views/KolSubscriptionsView.vue"),
meta: { title: "订阅包审批" },
path: 'kol-subscriptions',
name: 'kol-subscriptions',
component: () => import('@/views/KolSubscriptionsView.vue'),
meta: { title: '订阅包审批' },
},
{
path: "accounts",
name: "accounts",
component: () => import("@/views/AccountsView.vue"),
meta: { title: "操作员管理" },
path: 'accounts',
name: 'accounts',
component: () => import('@/views/AccountsView.vue'),
meta: { title: '操作员管理' },
},
{
path: "audits",
name: "audits",
component: () => import("@/views/AuditLogsView.vue"),
meta: { title: "审计日志" },
path: 'audits',
name: 'audits',
component: () => import('@/views/AuditLogsView.vue'),
meta: { title: '审计日志' },
},
{
path: "site-domain-mappings",
name: "site-domain-mappings",
component: () => import("@/views/SiteDomainMappingsView.vue"),
meta: { title: "站点映射" },
path: 'site-domain-mappings',
name: 'site-domain-mappings',
component: () => import('@/views/SiteDomainMappingsView.vue'),
meta: { title: '站点映射' },
},
{
path: "profile",
name: "profile",
component: () => import("@/views/ProfileView.vue"),
meta: { title: "个人资料" },
path: 'profile',
name: 'profile',
component: () => import('@/views/ProfileView.vue'),
meta: { title: '个人资料' },
},
],
},
{
path: "/:pathMatch(.*)*",
redirect: "/",
path: '/:pathMatch(.*)*',
redirect: '/',
},
],
});
})
router.beforeEach((to) => {
const auth = useAuthStore(pinia);
const auth = useAuthStore(pinia)
if (!auth.initialized) {
auth.hydrate();
auth.hydrate()
}
if (to.meta.requiresAuth && !auth.isAuthenticated) {
return {
name: "login",
query: to.fullPath !== "/" ? { redirect: to.fullPath } : undefined,
};
name: 'login',
query: to.fullPath !== '/' ? { redirect: to.fullPath } : undefined,
}
}
if (to.name === "login" && auth.isAuthenticated) {
return { name: "admin-users" };
if (to.name === 'login' && auth.isAuthenticated) {
return { name: 'admin-users' }
}
return true;
});
return true
})
router.afterEach((to) => {
if (typeof document !== "undefined") {
const t = (to.meta.title as string | undefined) ?? "运营后台";
document.title = `${t} · 省心推`;
if (typeof document !== 'undefined') {
const t = (to.meta.title as string | undefined) ?? '运营后台'
document.title = `${t} · 省心推`
}
});
})