fix: resolve TypeScript and ESLint errors across the codebase

- Fixed @typescript-eslint/no-unused-vars errors (31 instances)
- Fixed @typescript-eslint/no-explicit-any errors in backend (~22 instances)
- Fixed @typescript-eslint/no-explicit-any errors in frontend (~60 instances)
- Fixed prefer-const errors (5 instances)
- Fixed no-empty-object-type and rules-of-hooks errors
- Added proper type assertions for database operations
- Improved type safety in authentication and encryption modules
- Enhanced type definitions for API routes and SSH operations

All TypeScript compilation errors resolved. Application builds and runs successfully.
This commit is contained in:
ZacharyZcR
2025-10-09 23:05:55 +08:00
parent eb76f416bf
commit 8f102bf971
45 changed files with 494 additions and 217 deletions

View File

@@ -71,7 +71,15 @@ export function CredentialsManager({
const [showDeployDialog, setShowDeployDialog] = useState(false);
const [deployingCredential, setDeployingCredential] =
useState<Credential | null>(null);
const [availableHosts, setAvailableHosts] = useState<any[]>([]);
const [availableHosts, setAvailableHosts] = useState<
Array<{
id: number;
name: string;
ip: string;
port: number;
username: string;
}>
>([]);
const [selectedHostId, setSelectedHostId] = useState<string>("");
const [deployLoading, setDeployLoading] = useState(false);
const [hostSearchQuery, setHostSearchQuery] = useState("");
@@ -207,10 +215,13 @@ export function CredentialsManager({
);
await fetchCredentials();
window.dispatchEvent(new CustomEvent("credentials:changed"));
} catch (err: any) {
if (err.response?.data?.details) {
} catch (err: unknown) {
const error = err as {
response?: { data?: { error?: string; details?: string } };
};
if (error.response?.data?.details) {
toast.error(
`${err.response.data.error}\n${err.response.data.details}`,
`${error.response.data.error}\n${error.response.data.details}`,
);
} else {
toast.error(t("credentials.failedToDeleteCredential"));