From 4ed4dfd450b1c355ddedd4b111dafde2b961408b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Thu, 5 Mar 2026 18:57:30 +0800 Subject: [PATCH] Remove no-op voids and add explicit SW return Remove a pointless `void options.callbackTimeout;` no-op in napcat-rpc client. In the service worker template, add `/* eslint-disable no-undef */` and an explicit `return undefined;` in the cache cleanup callback to make the return value explicit and satisfy linters. In the OneBot debug UI, call `sendRequest(value)` without the leading `void` so the returned promise is not intentionally ignored. --- packages/napcat-rpc/src/client.ts | 1 - packages/napcat-webui-backend/src/assets/sw_template.js | 2 ++ .../napcat-webui-frontend/src/components/onebot/api/debug.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/napcat-rpc/src/client.ts b/packages/napcat-rpc/src/client.ts index 96a1548d..9cb22e58 100644 --- a/packages/napcat-rpc/src/client.ts +++ b/packages/napcat-rpc/src/client.ts @@ -31,7 +31,6 @@ export function createDeepProxy (options: DeepProxyOptions): T { refId: rootRefId, // callbackTimeout 可供未来扩展使用 } = options; - void options.callbackTimeout; const callbackRegistry = new SimpleCallbackRegistry(); diff --git a/packages/napcat-webui-backend/src/assets/sw_template.js b/packages/napcat-webui-backend/src/assets/sw_template.js index 247cff76..6ed0124a 100644 --- a/packages/napcat-webui-backend/src/assets/sw_template.js +++ b/packages/napcat-webui-backend/src/assets/sw_template.js @@ -1,3 +1,4 @@ +/* eslint-disable no-undef */ /** * NapCat WebUI Service Worker * @@ -157,6 +158,7 @@ self.addEventListener('activate', (event) => { console.log('[SW] Deleting old cache:', cacheName); return caches.delete(cacheName); } + return undefined; }) ); // 立即接管所有客户端 diff --git a/packages/napcat-webui-frontend/src/components/onebot/api/debug.tsx b/packages/napcat-webui-frontend/src/components/onebot/api/debug.tsx index ec89081b..2605d48f 100644 --- a/packages/napcat-webui-frontend/src/components/onebot/api/debug.tsx +++ b/packages/napcat-webui-frontend/src/components/onebot/api/debug.tsx @@ -169,7 +169,7 @@ const OneBotApiDebug = forwardRef((props setActiveTab('request'); setRequestBody(value); // 直接用 override 发送,避免 setState 异步导致拿到旧值 - void sendRequest(value); + sendRequest(value); }, focusRequestEditor: () => { setActiveTab('request');