Skip to content

Commit 4ed4dfd

Browse files
committed
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.
1 parent b15d025 commit 4ed4dfd

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

packages/napcat-rpc/src/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export function createDeepProxy<T = unknown> (options: DeepProxyOptions): T {
3131
refId: rootRefId,
3232
// callbackTimeout 可供未来扩展使用
3333
} = options;
34-
void options.callbackTimeout;
3534

3635
const callbackRegistry = new SimpleCallbackRegistry();
3736

packages/napcat-webui-backend/src/assets/sw_template.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-undef */
12
/**
23
* NapCat WebUI Service Worker
34
*
@@ -157,6 +158,7 @@ self.addEventListener('activate', (event) => {
157158
console.log('[SW] Deleting old cache:', cacheName);
158159
return caches.delete(cacheName);
159160
}
161+
return undefined;
160162
})
161163
);
162164
// 立即接管所有客户端

packages/napcat-webui-frontend/src/components/onebot/api/debug.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const OneBotApiDebug = forwardRef<OneBotApiDebugRef, OneBotApiDebugProps>((props
169169
setActiveTab('request');
170170
setRequestBody(value);
171171
// 直接用 override 发送,避免 setState 异步导致拿到旧值
172-
void sendRequest(value);
172+
sendRequest(value);
173173
},
174174
focusRequestEditor: () => {
175175
setActiveTab('request');

0 commit comments

Comments
 (0)