refactor: fix eslint no-useless-assignment preserve-caught-error (#6276)

This commit is contained in:
Sline 2026-02-08 13:19:41 +08:00 committed by GitHub
parent cad1c983e1
commit 7730cd1c5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 17 deletions

View File

@ -107,10 +107,7 @@ export function TrafficGraph({ ref }: { ref?: Ref<TrafficRef> }) {
countY(y),
]);
let x = points[0][0];
let y = points[0][1];
context.moveTo(x, y);
context.moveTo(points[0][0], points[0][1]);
for (let i = 1; i < points.length; i++) {
const p1 = points[i];
@ -120,8 +117,6 @@ export function TrafficGraph({ ref }: { ref?: Ref<TrafficRef> }) {
const y1 = (p1[1] + p2[1]) / 2;
context.quadraticCurveTo(p1[0], p1[1], x1, y1);
x = x1;
y = y1;
}
};

View File

@ -141,7 +141,7 @@ export const ProxiesEditorViewer = (props: Props) => {
const handleParseAsync = (cb: (proxies: IProxyConfig[]) => void) => {
const proxies: IProxyConfig[] = [];
const names: string[] = [];
let uris = "";
let uris: string;
try {
uris = atob(proxyUri);
} catch {

View File

@ -221,9 +221,6 @@ class DelayManager {
// 先将状态设置为测试中
this.setDelay(name, group, -2);
let delay = -1;
let elapsed = 0;
const startTime = Date.now();
try {
@ -247,18 +244,20 @@ class DelayManager {
await new Promise((resolve) => setTimeout(resolve, 500 - elapsedTime));
}
delay = result.delay;
elapsed = elapsedTime;
const delay = result.delay;
const elapsed = elapsedTime;
debugLog(`[DelayManager] 延迟测试完成,代理: ${name}, 结果: ${delay}ms`);
return this.setDelay(name, group, delay, { elapsed });
} catch (error) {
// 确保至少显示500ms的加载动画
await new Promise((resolve) => setTimeout(resolve, 500));
console.error(`[DelayManager] 延迟测试出错,代理: ${name}`, error);
delay = 1e6; // error
elapsed = Date.now() - startTime;
}
const delay = 1e6; // error
const elapsed = Date.now() - startTime;
return this.setDelay(name, group, delay, { elapsed });
return this.setDelay(name, group, delay, { elapsed });
}
}
async checkListDelay(

View File

@ -118,6 +118,7 @@ export const loadLanguage = async (language: string) => {
if (!fallbackLoader) {
throw new Error(
`Fallback language "${FALLBACK_LANGUAGE}" resources are missing.`,
{ cause: error },
);
}
const fallback = await fallbackLoader();

View File

@ -120,7 +120,7 @@ export function URI_VLESS(line: string): IProxyVlessConfig {
}
let httpupgrade = false;
let network: NetworkType = "tcp";
let network: NetworkType;
if (params.headerType === "http") {
network = "http";