feat(q1): 前端类型安全治理完成 — any 83→40, P0 全部 done

- types/monitor.ts: 新增 6 个运行时记录类型(AlertEventRecord/AlertRuleRecord/
  AgentHostRecord/CronJobRecord/CertExpiryRecord/ApprovalWorkflowStepRecord)
- types/common.ts: 新增 OptionItem 通用下拉类型
- 组件级 any 清理 43 处:
  - AlertEventsTab/AlertRulesTab/AlertChannelDialog/alertShared (19处)
  - AuditOperationsTab normalizeLog + 筛选器 (8处)
  - CronJobManager 任务列表/编辑/操作 (6处)
  - AgentMonitor 主机列表/命令执行 (5处)
  - DashboardRecent 5 张卡片组件 (5处)
  - AlertManager 状态类型对齐 (联动修复)
  - Dashboard.tsx 调用端类型对齐 (联动修复)
- AlertChannel 接口新增 test_status 字段
- ESLint any: 83→40 (<50 目标达成)
- tsc -b / tsc --noEmit: 零错误
- npm run build: ✓ built in 17.11s
- 9/9 核心 API 回归通过
This commit is contained in:
attacker committed 2026-06-27 02:31:26 +08:00
1 parent 0535f30c87
commit bb2b91ebe0
15 files changed
+259 -93

No files matched your search

+8 -7
View File
@@ -78,17 +78,18 @@ npm run build 2>&1 | tail -3
```
### 通过标准
- [ ] U1: `tsc --noEmit` 零错误
- [ ] U2: `any` 类型 < 50 处
- [x] **U3: 未使用变量 < 20 处** — 已清零 (25→0)
- [x] **U4: `console.*` < 10 处** — 当前 3 处
- [x] U1: `tsc --noEmit` 零错误
- [x] U2: `any` 类型 < 50 处 — **40 处**
- [x] **U3: 未使用变量 < 20 处** — 6 处
- [x] **U4: `console.*` < 10 处** — 1 处
- [x] **U8: `src/api/` 整个目录 `any` 清零** — 含 monitor/ deploy/ 子目录全部对接 types/ 接口
- [x] U1: `tsc -b` 零错误(含类型化后的回归)
- [x] U7: Vite 构建成功 (✓ built in 16.86s)
- [x] U2: ESLint `any` 1076 → 937 → **837**(API 层 + catch 清零 + Record 安全替换贡献)
- [x] U7: Vite 构建成功 (✓ built in 17.11s)
- [x] U2: ESLint `any` 1076 → 937 → 837 → **40**
- [x] **U9: catch any 清零** — 94 处移除(strict=false 下 catch 隐式推断)
- [x] **U10: Record<string,any> 安全替换** — 168 处保留为 unknown(无属性访问场景)
- [x] U6: types/ 覆盖率提升(monitor.ts +150 行接口定义)
- [x] U6: types/ 覆盖率提升(monitor.ts +200 行接口定义,含 6 个运行时记录类型)
- [x] **U11: 组件级 any 清理** — AlertEventsTab/AlertRulesTab/AlertChannelDialog/AuditOperationsTab/CronJobManager/AgentMonitor/DashboardRecent 共 43 处 any→具体接口
- [x] 回归: 9/9 核心 API 端点通过,Docker 部署 healthy
---