chore(frontend): introduce prettier + eslint and prune unused code
- 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:
+146
-146
@@ -1,275 +1,275 @@
|
||||
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'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: "/login",
|
||||
name: "login",
|
||||
component: () => import("@/views/LoginView.vue"),
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: () => import('@/views/LoginView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.login.title",
|
||||
descriptionKey: "route.login.description",
|
||||
titleKey: 'route.login.title',
|
||||
descriptionKey: 'route.login.description',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/membership-blocked",
|
||||
name: "membership-blocked",
|
||||
redirect: "/workspace",
|
||||
path: '/membership-blocked',
|
||||
name: 'membership-blocked',
|
||||
redirect: '/workspace',
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/",
|
||||
component: () => import("@/layouts/AppShell.vue"),
|
||||
path: '/',
|
||||
component: () => import('@/layouts/AppShell.vue'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
redirect: "/workspace",
|
||||
path: '',
|
||||
redirect: '/workspace',
|
||||
},
|
||||
{
|
||||
path: "workspace",
|
||||
name: "workspace",
|
||||
component: () => import("@/views/WorkspaceView.vue"),
|
||||
path: 'workspace',
|
||||
name: 'workspace',
|
||||
component: () => import('@/views/WorkspaceView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.workspace.title",
|
||||
descriptionKey: "route.workspace.description",
|
||||
navKey: "/workspace",
|
||||
titleKey: 'route.workspace.title',
|
||||
descriptionKey: 'route.workspace.description',
|
||||
navKey: '/workspace',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "articles/templates",
|
||||
name: "articles-templates",
|
||||
component: () => import("@/views/TemplatesView.vue"),
|
||||
path: 'articles/templates',
|
||||
name: 'articles-templates',
|
||||
component: () => import('@/views/TemplatesView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.templates.title",
|
||||
descriptionKey: "route.templates.description",
|
||||
navKey: "/articles/templates",
|
||||
titleKey: 'route.templates.title',
|
||||
descriptionKey: 'route.templates.description',
|
||||
navKey: '/articles/templates',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "articles/wizard",
|
||||
name: "article-wizard",
|
||||
component: () => import("@/views/TemplateWizardView.vue"),
|
||||
path: 'articles/wizard',
|
||||
name: 'article-wizard',
|
||||
component: () => import('@/views/TemplateWizardView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.wizard.title",
|
||||
descriptionKey: "route.wizard.description",
|
||||
navKey: "/articles/templates",
|
||||
titleKey: 'route.wizard.title',
|
||||
descriptionKey: 'route.wizard.description',
|
||||
navKey: '/articles/templates',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "articles/:id/edit",
|
||||
name: "article-editor",
|
||||
component: () => import("@/views/ArticleEditorView.vue"),
|
||||
path: 'articles/:id/edit',
|
||||
name: 'article-editor',
|
||||
component: () => import('@/views/ArticleEditorView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.articleEditor.title",
|
||||
descriptionKey: "route.articleEditor.description",
|
||||
titleKey: 'route.articleEditor.title',
|
||||
descriptionKey: 'route.articleEditor.description',
|
||||
navKey: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "articles/custom",
|
||||
name: "articles-custom",
|
||||
component: () => import("@/views/CustomGenerateView.vue"),
|
||||
path: 'articles/custom',
|
||||
name: 'articles-custom',
|
||||
component: () => import('@/views/CustomGenerateView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.custom.title",
|
||||
descriptionKey: "route.custom.description",
|
||||
navKey: "/articles/custom",
|
||||
titleKey: 'route.custom.title',
|
||||
descriptionKey: 'route.custom.description',
|
||||
navKey: '/articles/custom',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "articles/free-create",
|
||||
name: "articles-free-create",
|
||||
component: () => import("@/views/FreeCreateView.vue"),
|
||||
path: 'articles/free-create',
|
||||
name: 'articles-free-create',
|
||||
component: () => import('@/views/FreeCreateView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.freeCreate.title",
|
||||
descriptionKey: "route.freeCreate.description",
|
||||
navKey: "/articles/free-create",
|
||||
titleKey: 'route.freeCreate.title',
|
||||
descriptionKey: 'route.freeCreate.description',
|
||||
navKey: '/articles/free-create',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "articles/imitations",
|
||||
name: "articles-imitations",
|
||||
component: () => import("@/views/ImitationView.vue"),
|
||||
path: 'articles/imitations',
|
||||
name: 'articles-imitations',
|
||||
component: () => import('@/views/ImitationView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.imitation.title",
|
||||
descriptionKey: "route.imitation.description",
|
||||
navKey: "/articles/imitations",
|
||||
titleKey: 'route.imitation.title',
|
||||
descriptionKey: 'route.imitation.description',
|
||||
navKey: '/articles/imitations',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "articles/imitations/create",
|
||||
name: "article-imitation-create",
|
||||
component: () => import("@/views/ImitationGenerateView.vue"),
|
||||
path: 'articles/imitations/create',
|
||||
name: 'article-imitation-create',
|
||||
component: () => import('@/views/ImitationGenerateView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.imitationCreate.title",
|
||||
descriptionKey: "route.imitationCreate.description",
|
||||
navKey: "/articles/imitations",
|
||||
titleKey: 'route.imitationCreate.title',
|
||||
descriptionKey: 'route.imitationCreate.description',
|
||||
navKey: '/articles/imitations',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "media",
|
||||
name: "media",
|
||||
component: () => import("@/views/MediaView.vue"),
|
||||
path: 'media',
|
||||
name: 'media',
|
||||
component: () => import('@/views/MediaView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.media.title",
|
||||
descriptionKey: "route.media.description",
|
||||
navKey: "/media",
|
||||
titleKey: 'route.media.title',
|
||||
descriptionKey: 'route.media.description',
|
||||
navKey: '/media',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "brands",
|
||||
name: "brands",
|
||||
component: () => import("@/views/BrandsView.vue"),
|
||||
path: 'brands',
|
||||
name: 'brands',
|
||||
component: () => import('@/views/BrandsView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.brands.title",
|
||||
descriptionKey: "route.brands.description",
|
||||
navKey: "/brands",
|
||||
titleKey: 'route.brands.title',
|
||||
descriptionKey: 'route.brands.description',
|
||||
navKey: '/brands',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "tracking",
|
||||
name: "tracking",
|
||||
component: () => import("@/views/TrackingView.vue"),
|
||||
path: 'tracking',
|
||||
name: 'tracking',
|
||||
component: () => import('@/views/TrackingView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.tracking.title",
|
||||
descriptionKey: "route.tracking.description",
|
||||
navKey: "/tracking",
|
||||
titleKey: 'route.tracking.title',
|
||||
descriptionKey: 'route.tracking.description',
|
||||
navKey: '/tracking',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "tracking/questions/:brandId/:questionId",
|
||||
name: "tracking-question-detail",
|
||||
component: () => import("@/views/TrackingQuestionDetailView.vue"),
|
||||
path: 'tracking/questions/:brandId/:questionId',
|
||||
name: 'tracking-question-detail',
|
||||
component: () => import('@/views/TrackingQuestionDetailView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.trackingQuestion.title",
|
||||
descriptionKey: "route.trackingQuestion.description",
|
||||
navKey: "/tracking",
|
||||
titleKey: 'route.trackingQuestion.title',
|
||||
descriptionKey: 'route.trackingQuestion.description',
|
||||
navKey: '/tracking',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "knowledge",
|
||||
name: "knowledge",
|
||||
component: () => import("@/views/KnowledgeView.vue"),
|
||||
path: 'knowledge',
|
||||
name: 'knowledge',
|
||||
component: () => import('@/views/KnowledgeView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.knowledge.title",
|
||||
descriptionKey: "route.knowledge.description",
|
||||
navKey: "/knowledge",
|
||||
titleKey: 'route.knowledge.title',
|
||||
descriptionKey: 'route.knowledge.description',
|
||||
navKey: '/knowledge',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "images",
|
||||
name: "images",
|
||||
component: () => import("@/views/ImagesView.vue"),
|
||||
path: 'images',
|
||||
name: 'images',
|
||||
component: () => import('@/views/ImagesView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.images.title",
|
||||
descriptionKey: "route.images.description",
|
||||
navKey: "/images",
|
||||
titleKey: 'route.images.title',
|
||||
descriptionKey: 'route.images.description',
|
||||
navKey: '/images',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "kol/manage",
|
||||
name: "kol-manage",
|
||||
component: () => import("@/views/KolManageView.vue"),
|
||||
path: 'kol/manage',
|
||||
name: 'kol-manage',
|
||||
component: () => import('@/views/KolManageView.vue'),
|
||||
meta: {
|
||||
titleKey: "kol.manage.title",
|
||||
navKey: "/kol/manage",
|
||||
titleKey: 'kol.manage.title',
|
||||
navKey: '/kol/manage',
|
||||
requiresKol: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "kol/dashboard",
|
||||
name: "kol-dashboard",
|
||||
component: () => import("@/views/KolDashboardView.vue"),
|
||||
path: 'kol/dashboard',
|
||||
name: 'kol-dashboard',
|
||||
component: () => import('@/views/KolDashboardView.vue'),
|
||||
meta: {
|
||||
titleKey: "kol.dashboard.title",
|
||||
navKey: "/kol/dashboard",
|
||||
titleKey: 'kol.dashboard.title',
|
||||
navKey: '/kol/dashboard',
|
||||
requiresKol: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "kol/profile",
|
||||
name: "kol-profile",
|
||||
component: () => import("@/views/KolProfileView.vue"),
|
||||
path: 'kol/profile',
|
||||
name: 'kol-profile',
|
||||
component: () => import('@/views/KolProfileView.vue'),
|
||||
meta: {
|
||||
titleKey: "kol.profile.title",
|
||||
navKey: "/kol/profile",
|
||||
titleKey: 'kol.profile.title',
|
||||
navKey: '/kol/profile',
|
||||
requiresKol: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "kol/marketplace",
|
||||
name: "kol-marketplace",
|
||||
component: () => import("@/views/KolMarketplaceView.vue"),
|
||||
path: 'kol/marketplace',
|
||||
name: 'kol-marketplace',
|
||||
component: () => import('@/views/KolMarketplaceView.vue'),
|
||||
meta: {
|
||||
titleKey: "kol.marketplace.title",
|
||||
navKey: "/kol/marketplace",
|
||||
titleKey: 'kol.marketplace.title',
|
||||
navKey: '/kol/marketplace',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "kol/packages/:id",
|
||||
name: "kol-package-detail",
|
||||
component: () => import("@/views/KolPackageDetailView.vue"),
|
||||
path: 'kol/packages/:id',
|
||||
name: 'kol-package-detail',
|
||||
component: () => import('@/views/KolPackageDetailView.vue'),
|
||||
meta: {
|
||||
titleKey: "kol.marketplace.title",
|
||||
navKey: "/kol/marketplace",
|
||||
titleKey: 'kol.marketplace.title',
|
||||
navKey: '/kol/marketplace',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "kol/generate/:subscriptionPromptId",
|
||||
name: "kol-generate",
|
||||
component: () => import("@/views/KolGenerateView.vue"),
|
||||
path: 'kol/generate/:subscriptionPromptId',
|
||||
name: 'kol-generate',
|
||||
component: () => import('@/views/KolGenerateView.vue'),
|
||||
meta: {
|
||||
titleKey: "kol.generate.title",
|
||||
navKey: "/articles/templates",
|
||||
titleKey: 'kol.generate.title',
|
||||
navKey: '/articles/templates',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "account/ai-points",
|
||||
name: "account-ai-points",
|
||||
component: () => import("@/views/AIPointUsageView.vue"),
|
||||
path: 'account/ai-points',
|
||||
name: 'account-ai-points',
|
||||
component: () => import('@/views/AIPointUsageView.vue'),
|
||||
meta: {
|
||||
titleKey: "route.aiPoints.title",
|
||||
descriptionKey: "route.aiPoints.description",
|
||||
navKey: "/account/ai-points",
|
||||
titleKey: 'route.aiPoints.title',
|
||||
descriptionKey: 'route.aiPoints.description',
|
||||
navKey: '/account/ai-points',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
})
|
||||
|
||||
router.beforeEach(async (to) => {
|
||||
const authStore = useAuthStore(pinia);
|
||||
const authStore = useAuthStore(pinia)
|
||||
|
||||
if (!authStore.initialized) {
|
||||
await authStore.bootstrap();
|
||||
await authStore.bootstrap()
|
||||
}
|
||||
|
||||
const requiresAuth = to.matched.some((record) => record.meta.requiresAuth);
|
||||
const requiresAuth = to.matched.some((record) => record.meta.requiresAuth)
|
||||
if (requiresAuth && !authStore.isAuthenticated) {
|
||||
return {
|
||||
name: "login",
|
||||
name: 'login',
|
||||
query: { redirect: to.fullPath },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (to.meta.requiresKol && !authStore.isActiveKol) {
|
||||
return { name: "workspace" };
|
||||
return { name: 'workspace' }
|
||||
}
|
||||
|
||||
if (to.name === "login" && authStore.isAuthenticated) {
|
||||
return { name: "workspace" };
|
||||
if (to.name === 'login' && authStore.isAuthenticated) {
|
||||
return { name: 'workspace' }
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
return true
|
||||
})
|
||||
|
||||
export { router };
|
||||
export { router }
|
||||
|
||||
Vendored
+10
-10
@@ -1,15 +1,15 @@
|
||||
import "vue-router";
|
||||
import 'vue-router'
|
||||
|
||||
declare module "vue-router" {
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
title?: string;
|
||||
description?: string;
|
||||
titleKey?: string;
|
||||
descriptionKey?: string;
|
||||
requiresAuth?: boolean;
|
||||
requiresKol?: boolean;
|
||||
navKey?: string | null;
|
||||
title?: string
|
||||
description?: string
|
||||
titleKey?: string
|
||||
descriptionKey?: string
|
||||
requiresAuth?: boolean
|
||||
requiresKol?: boolean
|
||||
navKey?: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
export {}
|
||||
|
||||
Reference in New Issue
Block a user