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

@@ -85,7 +85,7 @@ export default function WorkloadViewPage() {
kubernetesApi.getPods(clusterCode).catch(() => []),
]);
// yamlRes is raw YAML text — try to parse as JSON (K8s API accepts JSON as YAML superset)
let parsed: Record<string, any> = null;
let parsed: Record<string, unknown> = null;
if (yamlRes && typeof yamlRes === 'string') {
try { parsed = JSON.parse(yamlRes); } catch { parsed = { _raw: yamlRes }; }
} else if (yamlRes && typeof yamlRes === 'object') {
@@ -131,7 +131,7 @@ export default function WorkloadViewPage() {
}
toast({ title: '重启指令已下发', description: `${kind} 滚动重启已触发` });
setTimeout(loadData, 1000);
} catch (e: any) {
} catch (e) {
toast({ title: '重启失败', description: e?.message || String(e), variant: 'destructive' });
} finally { setActionLoading(false); }
};
@@ -143,7 +143,7 @@ export default function WorkloadViewPage() {
toast({ title: '扩缩容成功', description: `StatefulSet 副本数已更新为 ${scaleValue}` });
setScaleModal(false);
setTimeout(loadData, 1000);
} catch (e: any) {
} catch (e) {
toast({ title: '扩缩容失败', description: e?.message || String(e), variant: 'destructive' });
} finally { setActionLoading(false); }
};
@@ -151,8 +151,8 @@ export default function WorkloadViewPage() {
// Parse status from manifest
const spec = manifest?.spec || {};
const status = manifest?.status || {};
const containers: Record<string, any>[] = spec?.template?.spec?.containers || [];
const initContainers: Record<string, any>[] = spec?.template?.spec?.initContainers || [];
const containers: Record<string, unknown>[] = spec?.template?.spec?.containers || [];
const initContainers: Record<string, unknown>[] = spec?.template?.spec?.initContainers || [];
// For StatefulSet
const replicas = spec.replicas ?? 1;
@@ -177,7 +177,7 @@ export default function WorkloadViewPage() {
const strategyType = updateStrategy.type || (isSts ? 'RollingUpdate' : 'RollingUpdate');
// VolumeClaimTemplates (StatefulSet only)
const vcts: Record<string, any>[] = spec.volumeClaimTemplates || [];
const vcts: Record<string, unknown>[] = spec.volumeClaimTemplates || [];
// Selector
const selectorLabels = spec.selector?.matchLabels || {};