mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-28 07:14:40 +08:00
fix: TS errors
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import eslintReact from "@eslint-react/eslint-plugin";
|
|
||||||
import eslintJS from "@eslint/js";
|
import eslintJS from "@eslint/js";
|
||||||
|
import eslintReact from "@eslint-react/eslint-plugin";
|
||||||
|
import { defineConfig } from "eslint/config";
|
||||||
import configPrettier from "eslint-config-prettier";
|
import configPrettier from "eslint-config-prettier";
|
||||||
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
||||||
import pluginImportX from "eslint-plugin-import-x";
|
import pluginImportX from "eslint-plugin-import-x";
|
||||||
@@ -7,7 +8,6 @@ import pluginPrettier from "eslint-plugin-prettier";
|
|||||||
import pluginReactHooks from "eslint-plugin-react-hooks";
|
import pluginReactHooks from "eslint-plugin-react-hooks";
|
||||||
import pluginReactRefresh from "eslint-plugin-react-refresh";
|
import pluginReactRefresh from "eslint-plugin-react-refresh";
|
||||||
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
||||||
import { defineConfig } from "eslint/config";
|
|
||||||
import globals from "globals";
|
import globals from "globals";
|
||||||
import tseslint from "typescript-eslint";
|
import tseslint from "typescript-eslint";
|
||||||
|
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ export const ProfileItem = (props: Props) => {
|
|||||||
|
|
||||||
// 订阅定时器更新事件
|
// 订阅定时器更新事件
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let refreshTimeout: ReturnType<typeof setTimeout> | undefined;
|
let refreshTimeout: number | undefined;
|
||||||
// 处理定时器更新事件 - 这个事件专门用于通知定时器变更
|
// 处理定时器更新事件 - 这个事件专门用于通知定时器变更
|
||||||
const handleTimerUpdate = (event: Event) => {
|
const handleTimerUpdate = (event: Event) => {
|
||||||
const source = event as CustomEvent<string> & { payload?: string };
|
const source = event as CustomEvent<string> & { payload?: string };
|
||||||
@@ -185,7 +185,7 @@ export const ProfileItem = (props: Props) => {
|
|||||||
// 只有当更新的是当前配置时才刷新显示
|
// 只有当更新的是当前配置时才刷新显示
|
||||||
if (updatedUid === itemData.uid && showNextUpdate) {
|
if (updatedUid === itemData.uid && showNextUpdate) {
|
||||||
console.log(`收到定时器更新事件: uid=${updatedUid}`);
|
console.log(`收到定时器更新事件: uid=${updatedUid}`);
|
||||||
if (refreshTimeout) {
|
if (refreshTimeout !== undefined) {
|
||||||
clearTimeout(refreshTimeout);
|
clearTimeout(refreshTimeout);
|
||||||
}
|
}
|
||||||
refreshTimeout = window.setTimeout(() => {
|
refreshTimeout = window.setTimeout(() => {
|
||||||
@@ -198,7 +198,7 @@ export const ProfileItem = (props: Props) => {
|
|||||||
window.addEventListener("verge://timer-updated", handleTimerUpdate);
|
window.addEventListener("verge://timer-updated", handleTimerUpdate);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (refreshTimeout) {
|
if (refreshTimeout !== undefined) {
|
||||||
clearTimeout(refreshTimeout);
|
clearTimeout(refreshTimeout);
|
||||||
}
|
}
|
||||||
// 清理事件监听
|
// 清理事件监听
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
const lines = uris.trim().split("\n");
|
const lines = uris.trim().split("\n");
|
||||||
let idx = 0;
|
let idx = 0;
|
||||||
const batchSize = 50;
|
const batchSize = 50;
|
||||||
let parseTimer: ReturnType<typeof setTimeout> | undefined;
|
let parseTimer: number | undefined;
|
||||||
|
|
||||||
const parseBatch = () => {
|
const parseBatch = () => {
|
||||||
const end = Math.min(idx + batchSize, lines.length);
|
const end = Math.min(idx + batchSize, lines.length);
|
||||||
@@ -175,7 +175,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
if (idx < lines.length) {
|
if (idx < lines.length) {
|
||||||
parseTimer = window.setTimeout(parseBatch, 0);
|
parseTimer = window.setTimeout(parseBatch, 0);
|
||||||
} else {
|
} else {
|
||||||
if (parseTimer) {
|
if (parseTimer !== undefined) {
|
||||||
clearTimeout(parseTimer);
|
clearTimeout(parseTimer);
|
||||||
parseTimer = undefined;
|
parseTimer = undefined;
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let idleId: number | undefined;
|
let idleId: number | undefined;
|
||||||
let timeoutId: ReturnType<typeof setTimeout> | undefined;
|
let timeoutId: number | undefined;
|
||||||
if (window.requestIdleCallback) {
|
if (window.requestIdleCallback) {
|
||||||
idleId = window.requestIdleCallback(serialize);
|
idleId = window.requestIdleCallback(serialize);
|
||||||
} else {
|
} else {
|
||||||
@@ -248,7 +248,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
if (idleId !== undefined && window.cancelIdleCallback) {
|
if (idleId !== undefined && window.cancelIdleCallback) {
|
||||||
window.cancelIdleCallback(idleId);
|
window.cancelIdleCallback(idleId);
|
||||||
}
|
}
|
||||||
if (timeoutId) {
|
if (timeoutId !== undefined) {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let idleId: number | undefined;
|
let idleId: number | undefined;
|
||||||
let timeoutId: ReturnType<typeof setTimeout> | undefined;
|
let timeoutId: number | undefined;
|
||||||
if (window.requestIdleCallback) {
|
if (window.requestIdleCallback) {
|
||||||
idleId = window.requestIdleCallback(serialize);
|
idleId = window.requestIdleCallback(serialize);
|
||||||
} else {
|
} else {
|
||||||
@@ -365,7 +365,7 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
if (idleId !== undefined && window.cancelIdleCallback) {
|
if (idleId !== undefined && window.cancelIdleCallback) {
|
||||||
window.cancelIdleCallback(idleId);
|
window.cancelIdleCallback(idleId);
|
||||||
}
|
}
|
||||||
if (timeoutId) {
|
if (timeoutId !== undefined) {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export const AppDataProvider = ({
|
|||||||
const refreshThrottle = 500;
|
const refreshThrottle = 500;
|
||||||
|
|
||||||
let isUnmounted = false;
|
let isUnmounted = false;
|
||||||
const scheduledTimeouts = new Set<ReturnType<typeof setTimeout>>();
|
const scheduledTimeouts = new Set<number>();
|
||||||
const cleanupFns: Array<() => void> = [];
|
const cleanupFns: Array<() => void> = [];
|
||||||
|
|
||||||
const registerCleanup = (fn: () => void) => {
|
const registerCleanup = (fn: () => void) => {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export const fetchLogsViaIPCPeriodically = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 初始化全局日志服务 (仅IPC模式)
|
// 初始化全局日志服务 (仅IPC模式)
|
||||||
let ipcPollingInterval: number | null = null;
|
let ipcPollingInterval: ReturnType<typeof setInterval> | null = null;
|
||||||
let isInitializing = false; // 添加初始化标志
|
let isInitializing = false; // 添加初始化标志
|
||||||
|
|
||||||
export const initGlobalLogService = (
|
export const initGlobalLogService = (
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import path from "node:path";
|
|||||||
|
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
import legacy from "@vitejs/plugin-legacy";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { defineConfig } from "vitest/config";
|
|
||||||
import monacoEditorPlugin, {
|
import monacoEditorPlugin, {
|
||||||
type IMonacoEditorOpts,
|
type IMonacoEditorOpts,
|
||||||
} from "vite-plugin-monaco-editor";
|
} from "vite-plugin-monaco-editor";
|
||||||
import svgr from "vite-plugin-svgr";
|
import svgr from "vite-plugin-svgr";
|
||||||
|
import { defineConfig } from "vitest/config";
|
||||||
const monacoEditorPluginDefault = (monacoEditorPlugin as any).default as (
|
const monacoEditorPluginDefault = (monacoEditorPlugin as any).default as (
|
||||||
options: IMonacoEditorOpts,
|
options: IMonacoEditorOpts,
|
||||||
) => any;
|
) => any;
|
||||||
|
|||||||
Reference in New Issue
Block a user