refactor: minor lint and consistency fixes
Apply a collection of small code cleanups across the repo for consistency and lint-safety. Changes include: - Use strict equality (===) where appropriate (GetEmojiLikes, about page checks). - Replace Array.map used for side effects with Array.forEach (GetMsg). - Rename unused catch parameters to underscore-prefixed names to avoid lint warnings (multiple backend/middleware files). - Replace void with undefined in an actions.call invocation (builtin plugin index). - Remove an unused loadedCount variable when reading .env (napcat-shell). - Rename promise resolver parameter to `resolve` for clarity in tests and keep setTimeout usage (rpc.test.ts). - Strengthen external shims types by changing generic parameter names to _T and update inversify ServiceIdentifier generic param (external-shims.d.ts). - Simplify post-build script imports and comment out an external-type mapping block; fix a regex character class bug (post-build.mjs). - Prefix several unused test stub variables with underscore to indicate intentional unused status (test-dist.ts). - Minor JSX formatting/indentation fixes in password_login component and UI text indentation in system_info. - Misc: SSE/config and plugin config handlers adjusted to consistent catch parameter naming; update mirror/download error catch variable name. These edits are non-functional refactors focused on code style, lint compliance and small robustness/clarity improvements.
This commit is contained in:
1 parent
974528fe7e
commit
b15d02535e
19 files changed
+49
-65
No files matched your search
@@ -246,7 +246,7 @@ export const GetPluginConfigHandler: RequestHandler = async (req, res) => {
|
||||
if (plugin.runtime.module?.plugin_get_config && plugin.runtime.context) {
|
||||
try {
|
||||
config = await plugin.runtime.module?.plugin_get_config(plugin.runtime.context);
|
||||
} catch (e) { }
|
||||
} catch (_e) { }
|
||||
} else {
|
||||
// Default behavior: read from default config path
|
||||
try {
|
||||
@@ -254,7 +254,7 @@ export const GetPluginConfigHandler: RequestHandler = async (req, res) => {
|
||||
if (fs.existsSync(configPath)) {
|
||||
config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
||||
}
|
||||
} catch (e) { }
|
||||
} catch (_e) { }
|
||||
}
|
||||
|
||||
// 获取静态 schema
|
||||
@@ -312,7 +312,7 @@ export const PluginConfigSSEHandler: RequestHandler = (req, res): void => {
|
||||
if (initialConfigStr) {
|
||||
try {
|
||||
currentConfig = JSON.parse(initialConfigStr);
|
||||
} catch (e) { }
|
||||
} catch (_e) { }
|
||||
}
|
||||
|
||||
// 发送 SSE 消息的辅助函数
|
||||
@@ -387,7 +387,7 @@ export const PluginConfigSSEHandler: RequestHandler = (req, res): void => {
|
||||
if (session?.cleanup) {
|
||||
try {
|
||||
session.cleanup();
|
||||
} catch (e) { }
|
||||
} catch (_e) { }
|
||||
}
|
||||
activeConfigSessions.delete(sessionId);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user