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,60 +1,63 @@
<script setup lang="ts">
import { computed } from "vue";
import { computed } from 'vue'
const props = withDefaults(defineProps<{
current: number;
pageSize: number;
total: number;
maxVisiblePages?: number;
}>(), {
maxVisiblePages: 5,
});
const props = withDefaults(
defineProps<{
current: number
pageSize: number
total: number
maxVisiblePages?: number
}>(),
{
maxVisiblePages: 5,
},
)
const emit = defineEmits<{
(event: "change", page: number): void;
}>();
(event: 'change', page: number): void
}>()
type PageToken = number | "ellipsis";
type PageToken = number | 'ellipsis'
const totalPages = computed(() => Math.max(1, Math.ceil(props.total / props.pageSize)));
const totalPages = computed(() => Math.max(1, Math.ceil(props.total / props.pageSize)))
const tokens = computed<PageToken[]>(() => {
if (totalPages.value <= props.maxVisiblePages) {
return Array.from({ length: totalPages.value }, (_value, index) => index + 1);
return Array.from({ length: totalPages.value }, (_value, index) => index + 1)
}
const pages: PageToken[] = [1];
let start = Math.max(2, props.current - 1);
let end = Math.min(totalPages.value - 1, props.current + 1);
const pages: PageToken[] = [1]
let start = Math.max(2, props.current - 1)
let end = Math.min(totalPages.value - 1, props.current + 1)
while (end - start < 2 && start > 2) {
start -= 1;
start -= 1
}
while (end - start < 2 && end < totalPages.value - 1) {
end += 1;
end += 1
}
if (start > 2) {
pages.push("ellipsis");
pages.push('ellipsis')
}
for (let page = start; page <= end; page += 1) {
pages.push(page);
pages.push(page)
}
if (end < totalPages.value - 1) {
pages.push("ellipsis");
pages.push('ellipsis')
}
pages.push(totalPages.value);
return pages;
});
pages.push(totalPages.value)
return pages
})
function goTo(page: number) {
if (page === props.current || page < 1 || page > totalPages.value) {
return;
return
}
emit("change", page);
emit('change', page)
}
</script>
@@ -65,7 +68,10 @@ function goTo(page: number) {
</button>
<div class="pagination__pages">
<template v-for="token in tokens" :key="`${token}-${typeof token === 'number' ? token : Math.random()}`">
<template
v-for="token in tokens"
:key="`${token}-${typeof token === 'number' ? token : Math.random()}`"
>
<span v-if="token === 'ellipsis'" class="pagination__ellipsis"></span>
<button
v-else
@@ -78,7 +84,11 @@ function goTo(page: number) {
</template>
</div>
<button class="pagination__nav" :disabled="props.current >= totalPages" @click="goTo(props.current + 1)">
<button
class="pagination__nav"
:disabled="props.current >= totalPages"
@click="goTo(props.current + 1)"
>
下一页
</button>
</nav>
@@ -112,7 +122,11 @@ function goTo(page: number) {
cursor: pointer;
font-size: 12px;
font-weight: 600;
transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
transition:
background-color 0.2s ease,
border-color 0.2s ease,
color 0.2s ease,
opacity 0.2s ease;
}
.pagination__nav:hover:not(:disabled),