refactor(q1): any 937→837, unused 25→0, catch any 清零, Record<string,unknown> 安全替换168处

- unused-vars 全清零: 删除未用 import + 前缀 _
- catch (e: any) 94处移除显式标注 (strict=false 隐式推断)
- Record<string,any>→Record<string,unknown> 安全替换168处 (无属性访问场景)
- tsc -b 零错误, npm run build 通过
- 9/9 API 回归测试通过
This commit is contained in:
attacker committed 2026-06-26 05:59:59 +08:00
1 parent 4ae215f4c9
commit 37c657987b
62 files changed
+133 -141

No files matched your search

@@ -69,7 +69,7 @@ export function AgentAlerts() {
await agentApi.resolveAlert(id);
toast.success('告警已恢复');
loadData();
} catch (err: any) {
} catch (err) {
toast.error(err?.message || '操作失败');
}
};
@@ -92,7 +92,7 @@ export function AgentAlerts() {
await agentApi.deleteRule(id);
toast.success('规则已删除');
loadData();
} catch (err: any) {
} catch (err) {
toast.error(err?.message || '删除失败');
}
};
@@ -101,7 +101,7 @@ export function AgentAlerts() {
try {
await agentApi.updateRule(rule.id, { ...rule, enabled: !rule.enabled });
loadData();
} catch (err: any) {
} catch (err) {
toast.error(err?.message || '操作失败');
}
};
@@ -111,7 +111,7 @@ export function AgentMonitor() {
result: res?.data?.output || res?.message || '无输出',
error: res?.data?.error,
});
} catch (err: any) {
} catch (err) {
setCmdResult({ status: 'failed', result: err?.message || '执行失败' });
} finally {
setCmdSubmitting(false);
@@ -73,7 +73,7 @@ export function AgentRuleDialog({ open, onOpenChange, editingRule, onSuccess }:
}
setSaving(true);
try {
const payload: Record<string, any> = {
const payload: Record<string, unknown> = {
name: ruleForm.name.trim(),
metric: ruleForm.metric,
operator: ruleForm.operator,
@@ -94,7 +94,7 @@ export function AgentRuleDialog({ open, onOpenChange, editingRule, onSuccess }:
}
onOpenChange(false);
onSuccess();
} catch (err: any) {
} catch (err) {
toast.error(err?.message || '保存失败');
} finally {
setSaving(false);
@@ -177,7 +177,7 @@ export function AgentWizard({ open, onOpenChange, server, onInstalled, onFailed
onInstalled?.(server.id);
onOpenChange(false);
}
} catch (e: any) {
} catch (e) {
const msg = e?.message || '安装失败';
toast.error(`${server.hostname} ${msg}`);
onFailed?.(server.id, msg);