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:
1 parent
4ae215f4c9
commit
37c657987b
62 files changed
+133
-141
No files matched your search
@@ -1,7 +1,7 @@
|
||||
// 告警中心主组件 // Logan.Li
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
AlertTriangle, AlertCircle, CheckCircle, Zap, Search, RefreshCw,
|
||||
AlertTriangle, CheckCircle, Search, RefreshCw,
|
||||
Eye, Check, VolumeX, Plus, Rocket,
|
||||
} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
@@ -3,7 +3,6 @@ import React, { useState, useEffect } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import {
|
||||
Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter,
|
||||
} from '@/components/ui/dialog';
|
||||
|
||||
@@ -142,7 +142,7 @@ export const PrometheusDashboard: React.FC<Props> = ({ dsUrl }) => {
|
||||
const data: Record<string, any> = await prometheusProxyApi.connect(u);
|
||||
setConnected(true); setTargets(data.targets||0);
|
||||
loadAll(u);
|
||||
} catch (e: any) { setConnected(false); setError((e as Record<string, any>).message||'连接失败'); }
|
||||
} catch (e) { setConnected(false); setError((e as Record<string, any>).message||'连接失败'); }
|
||||
finally { setLoading(false); }
|
||||
};
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export const ZabbixDashboard: React.FC<Props> = ({ dsUrl, dsUsername, dsPassword
|
||||
setHosts(data.hosts || []);
|
||||
setVersion(data.version || '');
|
||||
setConnected(true);
|
||||
} catch (e: any) { setConnected(false); setError((e as Record<string, any>).message || '连接失败'); }
|
||||
} catch (e) { setConnected(false); setError((e as Record<string, any>).message || '连接失败'); }
|
||||
finally { setLoading(false); }
|
||||
};
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ export default function ZabbixDatasourceManager() {
|
||||
}
|
||||
setDialogOpen(false);
|
||||
fetchList();
|
||||
} catch (err: any) {
|
||||
} catch (err) {
|
||||
toast.error(err?.message || '操作失败');
|
||||
}
|
||||
};
|
||||
@@ -171,7 +171,7 @@ export default function ZabbixDatasourceManager() {
|
||||
});
|
||||
const data = res?.data || res;
|
||||
setTestResult(data);
|
||||
} catch (err: any) {
|
||||
} catch (err) {
|
||||
setTestResult({ success: false, message: err?.message || '测试失败' });
|
||||
} finally {
|
||||
setTesting(false);
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
ArrowRight,
|
||||
ChevronRight,
|
||||
ChevronDown,
|
||||
Activity,
|
||||
Zap,
|
||||
AlertCircle,
|
||||
CheckCircle,
|
||||
@@ -16,7 +15,6 @@ import {
|
||||
TrendingUp,
|
||||
RefreshCw,
|
||||
Eye,
|
||||
Layers,
|
||||
GitBranch,
|
||||
Code,
|
||||
Box,
|
||||
|
||||
Reference in new issue
Block a user