1
0

chore: 强化代码质量与风格检查体系

ESLint 升级到 recommended-type-checked + stylistic-type-checked,
引入 perfectionist 导入排序和 import 插件导入验证。

Prettier 显式声明全部格式化参数,消除跨环境差异。
TypeScript 启用 noUnusedLocals 和 noPropertyAccessFromIndexSignature。
完善 ignore 列表,排除 .agents/、bun.lock、data/ 等。
引入 husky + lint-staged(pre-commit)+ commitlint(commit-msg)。
更新 DEVELOPMENT.md 代码质量章节。
修复所有新增规则检测到的类型和风格违规。
This commit is contained in:
2026-05-12 18:44:59 +08:00
parent ce8baae3d1
commit a5cf6065c2
83 changed files with 2654 additions and 1824 deletions

View File

@@ -1,4 +1,24 @@
export type RuntimeMode = "development" | "production" | "test";
export interface ApiErrorResponse {
error: string;
status: number;
}
export interface CheckFailure {
actual?: unknown;
expected?: unknown;
kind: "error" | "mismatch";
message: string;
path: string;
phase: string;
}
export interface CheckResult {
durationMs: null | number;
failure: CheckFailure | null;
matched: boolean;
statusDetail: null | string;
timestamp: string;
}
export interface HealthResponse {
ok: true;
@@ -6,68 +26,48 @@ export interface HealthResponse {
timestamp: string;
}
export interface ApiErrorResponse {
error: string;
status: number;
}
export interface SummaryResponse {
export interface HistoryResponse {
items: CheckResult[];
page: number;
pageSize: number;
total: number;
up: number;
down: number;
lastCheckTime: string | null;
}
export interface RecentSample {
durationMs: null | number;
timestamp: string;
durationMs: number | null;
up: boolean;
}
export interface TargetStatus {
id: number;
name: string;
type: string;
target: string;
group: string;
interval: string;
latestCheck: CheckResult | null;
stats: TargetStats;
recentSamples: RecentSample[];
export type RuntimeMode = "development" | "production" | "test";
export interface SummaryResponse {
down: number;
lastCheckTime: null | string;
total: number;
up: number;
}
export interface TargetStats {
totalChecks: number;
availability: number;
totalChecks: number;
}
export interface HistoryResponse {
items: CheckResult[];
total: number;
page: number;
pageSize: number;
}
export interface CheckResult {
timestamp: string;
matched: boolean;
durationMs: number | null;
statusDetail: string | null;
failure: CheckFailure | null;
}
export interface CheckFailure {
kind: "error" | "mismatch";
phase: string;
path: string;
expected?: unknown;
actual?: unknown;
message: string;
export interface TargetStatus {
group: string;
id: number;
interval: string;
latestCheck: CheckResult | null;
name: string;
recentSamples: RecentSample[];
stats: TargetStats;
target: string;
type: string;
}
export interface TrendPoint {
hour: string;
avgDurationMs: number | null;
availability: number;
avgDurationMs: null | number;
hour: string;
totalChecks: number;
}