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
@@ -1,79 +1,79 @@
<script setup lang="ts">
import { computed } from "vue";
import { RouterLink, RouterView, useRoute } from "vue-router";
import {
AppstoreOutlined,
SendOutlined,
LinkOutlined,
RobotOutlined,
LogoutOutlined,
RobotOutlined,
SendOutlined,
SettingOutlined,
} from "@ant-design/icons-vue";
} from '@ant-design/icons-vue'
import { computed } from 'vue'
import { RouterLink, RouterView, useRoute } from 'vue-router'
import { useDesktopRuntime } from "../composables/useDesktopRuntime";
import { useDesktopSession } from "../composables/useDesktopSession";
import { desktopMonitoringMediaCatalog, desktopPublishMediaCatalog } from "../lib/media-catalog";
import { useDesktopRuntime } from '../composables/useDesktopRuntime'
import { useDesktopSession } from '../composables/useDesktopSession'
import { desktopMonitoringMediaCatalog, desktopPublishMediaCatalog } from '../lib/media-catalog'
const route = useRoute();
const { snapshot, error, refreshAccounts } = useDesktopRuntime();
const { session, logout } = useDesktopSession();
const route = useRoute()
const { snapshot, error, refreshAccounts } = useDesktopRuntime()
const { session, logout } = useDesktopSession()
const accountAwareRoutes = new Set(["/media-platforms", "/ai-platforms"]);
const accountAwareRoutes = new Set(['/media-platforms', '/ai-platforms'])
function handleNavClick(target: string) {
if (accountAwareRoutes.has(target)) {
void refreshAccounts();
void refreshAccounts()
}
}
const navItems = computed(() => {
const data = snapshot.value;
const accounts = data?.accounts ?? [];
const publishIDs = new Set(desktopPublishMediaCatalog.map((item) => item.id));
const monitoringIDs = new Set(desktopMonitoringMediaCatalog.map((item) => item.id));
const data = snapshot.value
const accounts = data?.accounts ?? []
const publishIDs = new Set(desktopPublishMediaCatalog.map((item) => item.id))
const monitoringIDs = new Set(desktopMonitoringMediaCatalog.map((item) => item.id))
return [
{
to: "/",
title: "控制台",
description: "运行总览、活动流和总体健康度",
to: '/',
title: '控制台',
description: '运行总览、活动流和总体健康度',
count: data?.summary.issuesOpen ?? 0,
icon: AppstoreOutlined,
},
{
to: "/publish-management",
title: "发布管理",
description: "查看待发布队列、历史发送结果,并对文章再次发送",
to: '/publish-management',
title: '发布管理',
description: '查看待发布队列、历史发送结果,并对文章再次发送',
count: data?.summary.queuedTasks ?? 0,
icon: SendOutlined,
},
{
to: "/media-platforms",
title: "媒体账号",
description: "发布媒体授权、多个账号绑定管理",
to: '/media-platforms',
title: '媒体账号',
description: '发布媒体授权、多个账号绑定管理',
count: accounts.filter((item) => publishIDs.has(item.platform)).length,
icon: LinkOutlined,
},
{
to: "/ai-platforms",
title: "AI 平台",
description: "AI 平台一平台一绑定,按卡片查看状态与归属",
to: '/ai-platforms',
title: 'AI 平台',
description: 'AI 平台一平台一绑定,按卡片查看状态与归属',
count: accounts.filter((item) => monitoringIDs.has(item.platform)).length,
icon: RobotOutlined,
},
];
});
]
})
const operatorName = computed(() => session.value?.user?.name ?? "未命名操作员");
const operatorEmail = computed(() => session.value?.user?.email ?? "");
const liveClientLabel = computed(() => snapshot.value?.clients[0]?.deviceName ?? null);
const operatorName = computed(() => session.value?.user?.name ?? '未命名操作员')
const operatorEmail = computed(() => session.value?.user?.email ?? '')
const liveClientLabel = computed(() => snapshot.value?.clients[0]?.deviceName ?? null)
const clientLabel = computed(
() => liveClientLabel.value ?? session.value?.desktopClient?.device_name ?? "当前设备尚未注册 client",
);
() =>
liveClientLabel.value ?? session.value?.desktopClient?.device_name ?? '当前设备尚未注册 client',
)
function openSettingsWindow() {
void window.desktopBridge.app.openSettingsWindow();
void window.desktopBridge.app.openSettingsWindow()
}
</script>
@@ -95,19 +95,19 @@ function openSettingsWindow() {
<nav class="nav">
<RouterLink
v-for="item in navItems"
:key="item.to"
:to="item.to"
class="nav-link"
:class="{ active: route.path === item.to }"
@click="handleNavClick(item.to)"
>
<div class="nav-copy">
<component :is="item.icon" class="nav-icon" />
<strong>{{ item.title }}</strong>
</div>
<span class="nav-count">{{ item.count }}</span>
</RouterLink>
</nav>
:key="item.to"
:to="item.to"
class="nav-link"
:class="{ active: route.path === item.to }"
@click="handleNavClick(item.to)"
>
<div class="nav-copy">
<component :is="item.icon" class="nav-icon" />
<strong>{{ item.title }}</strong>
</div>
<span class="nav-count">{{ item.count }}</span>
</RouterLink>
</nav>
<footer class="sidebar-footer">
<section class="user-profile-panel">
@@ -132,7 +132,11 @@ function openSettingsWindow() {
</button>
</a-tooltip>
<a-tooltip title="退出登录" placement="top">
<button type="button" class="footer-icon-btn footer-icon-btn--danger" @click="logout">
<button
type="button"
class="footer-icon-btn footer-icon-btn--danger"
@click="logout"
>
<LogoutOutlined />
</button>
</a-tooltip>
@@ -142,7 +146,7 @@ function openSettingsWindow() {
<div class="footer-bottom-row">
<span class="version-label">Version</span>
<strong class="version-value">{{ snapshot?.app.version ?? "0.1.0" }}</strong>
<strong class="version-value">{{ snapshot?.app.version ?? '0.1.0' }}</strong>
</div>
<p v-if="error" class="error-text">{{ error }}</p>
</footer>
@@ -177,13 +181,13 @@ function openSettingsWindow() {
-webkit-app-region: drag;
}
:global(html[data-platform="darwin"]) .window-drag-bar {
:global(html[data-platform='darwin']) .window-drag-bar {
left: 80px;
right: 0;
height: 28px;
}
.app-shell :where(button, a, input, select, textarea, [role="button"], [role="link"]) {
.app-shell :where(button, a, input, select, textarea, [role='button'], [role='link']) {
-webkit-app-region: no-drag;
}
@@ -344,13 +348,17 @@ h1 {
border-radius: 16px;
background: #ffffff;
border: 1px solid #e2e8f0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.01);
box-shadow:
0 1px 3px rgba(0, 0, 0, 0.02),
0 2px 4px -2px rgba(0, 0, 0, 0.01);
transition: all 0.2s ease;
}
.user-profile-panel:hover {
border-color: #cbd5e1;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
box-shadow:
0 4px 6px -1px rgba(0, 0, 0, 0.03),
0 2px 4px -2px rgba(0, 0, 0, 0.02);
}
.user-info-row {
@@ -371,7 +379,7 @@ h1 {
align-items: center;
justify-content: center;
flex-shrink: 0;
box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
.user-details {