feat: comprehensive oxlint cleanup - remove unused code
🧹 Cleanup Summary: - Fixed 83 oxlint warnings across 50+ files - Removed unused imports, variables, and functions - Maintained all functional code and error handling - Improved bundle size and code maintainability 📝 Key Changes: - Cleaned unused React hooks (useState, useEffect, useClashInfo) - Removed unused Material-UI imports (useTheme, styled components) - Deleted unused interfaces and type definitions - Fixed spread operator usage and boolean casting - Simplified catch parameters where appropriate 🎯 Files Modified: - React components: home.tsx, settings, profiles, etc. - Custom hooks: use-*.ts files - Utility functions and type definitions - Configuration files ✅ Result: 0 oxlint warnings (from 83 warnings) 🔧 All functionality preserved 📦 Reduced bundle size through dead code elimination
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import axios, { AxiosInstance } from "axios";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { getClashInfo } from "./cmds";
|
||||
|
||||
let instancePromise: Promise<AxiosInstance> = null!;
|
||||
|
||||
@@ -90,7 +90,7 @@ export async function patchClashConfig(payload: Partial<IConfigData>) {
|
||||
return invoke<void>("patch_clash_config", { payload });
|
||||
}
|
||||
|
||||
export async function patchClashMode(payload: String) {
|
||||
export async function patchClashMode(payload: string) {
|
||||
return invoke<void>("patch_clash_mode", { payload });
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ export async function getProxyProviders() {
|
||||
const providers = response.providers as Record<string, IProxyProviderItem>;
|
||||
|
||||
return Object.fromEntries(
|
||||
Object.entries(providers).filter(([key, item]) => {
|
||||
Object.entries(providers).filter(([, item]) => {
|
||||
const type = item.vehicleType.toLowerCase();
|
||||
return type === "http" || type === "file";
|
||||
}),
|
||||
@@ -266,7 +266,7 @@ export async function getRuleProviders() {
|
||||
>;
|
||||
|
||||
return Object.fromEntries(
|
||||
Object.entries(providers).filter(([key, item]) => {
|
||||
Object.entries(providers).filter(([, item]) => {
|
||||
const type = item.vehicleType.toLowerCase();
|
||||
return type === "http" || type === "file";
|
||||
}),
|
||||
@@ -380,7 +380,7 @@ export async function getSystemMonitorOverviewSafe() {
|
||||
// console.warn("[Monitor][Service] 数据验证失败,使用清理后的数据");
|
||||
return systemMonitorValidator.sanitize(result);
|
||||
}
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// console.error("[Monitor][Service] API调用失败:", error);
|
||||
// 返回安全的默认值
|
||||
const { systemMonitorValidator } = await import("@/utils/data-validator");
|
||||
@@ -550,7 +550,7 @@ export async function cmdGetProxyDelay(
|
||||
// 返回一个有效的结果对象,但标记为超时
|
||||
return { delay: 1e6 };
|
||||
}
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// 返回一个有效的结果对象,但标记为错误
|
||||
return { delay: 1e6 };
|
||||
}
|
||||
@@ -646,7 +646,7 @@ export async function restoreWebDavBackup(filename: string) {
|
||||
export async function saveWebdavConfig(
|
||||
url: string,
|
||||
username: string,
|
||||
password: String,
|
||||
password: string,
|
||||
) {
|
||||
return invoke<void>("save_webdav_config", {
|
||||
url,
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
stopLogsStreaming,
|
||||
clearLogs as clearLogsIPC,
|
||||
} from "@/services/ipc-log-service";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
// 最大日志数量
|
||||
const MAX_LOG_NUM = 1000;
|
||||
|
||||
@@ -40,9 +40,7 @@ export const stopLogsStreaming = async () => {
|
||||
};
|
||||
|
||||
// Fetch logs using IPC command (now from streaming cache)
|
||||
export const fetchLogsViaIPC = async (
|
||||
logLevel: LogLevel = "info",
|
||||
): Promise<ILogItem[]> => {
|
||||
export const fetchLogsViaIPC = async (): Promise<ILogItem[]> => {
|
||||
try {
|
||||
// Server-side filtering handles the level via /logs?level={level}
|
||||
// We just fetch all cached logs regardless of the logLevel parameter
|
||||
|
||||
Reference in New Issue
Block a user