chore(lint): enable stricter error rules

This commit is contained in:
Peter Steinberger
2026-06-01 01:12:00 +01:00
parent 0bfba7e26d
commit 27dde7a4d6
458 changed files with 3159 additions and 936 deletions

View File

@@ -112,7 +112,6 @@ export function resolveFeishuGroupSession(params: {
})
: buildFeishuConversationId({ chatId, scope: "group_sender", senderOpenId });
break;
case "group":
default:
peerId = chatId;
break;

View File

@@ -918,7 +918,7 @@ export async function handleFeishuMessage(params: {
replyToMessageId: replyTargetMessageId,
replyInThread: isGroup ? (groupSession?.replyInThread ?? false) : false,
accountId: account.accountId,
}).catch((err) => {
}).catch((err: unknown) => {
log(`feishu[${account.accountId}]: failed to send ACP init error reply: ${String(err)}`);
});
return;

View File

@@ -37,7 +37,6 @@ export function buildFeishuConversationId(params: {
return `${chatId}:topic:${topicId}`;
}
return senderOpenId ? `${chatId}:sender:${senderOpenId}` : chatId;
case "group":
default:
return chatId;
}

View File

@@ -272,7 +272,7 @@ function registerEventHandlers(
const error = runtime?.error ?? console.error;
const runFeishuHandler = async (params: { task: () => Promise<void>; errorMessage: string }) => {
if (fireAndForget) {
void params.task().catch((err) => {
void params.task().catch((err: unknown) => {
error(`${params.errorMessage}: ${String(err)}`);
});
return;
@@ -417,7 +417,7 @@ function registerEventHandlers(
accountId,
});
if (fireAndForget) {
promise.catch((err) => {
promise.catch((err: unknown) => {
error(`feishu[${accountId}]: error handling card action: ${String(err)}`);
});
} else {

View File

@@ -138,7 +138,7 @@ export function createFeishuBotMenuHandler(params: {
}
return await handleLegacyMenu();
})
.catch(async (err) => {
.catch(async (err: unknown) => {
if (isFeishuRetryableSyntheticEventError(err)) {
await forgetProcessedFeishuMessage(syntheticMessageId, accountId, log);
} else {
@@ -150,7 +150,7 @@ export function createFeishuBotMenuHandler(params: {
releaseFeishuMessageProcessing(syntheticMessageId, accountId);
});
if (fireAndForget) {
promise.catch((err) => {
promise.catch((err: unknown) => {
error(`feishu[${accountId}]: error handling bot menu event: ${String(err)}`);
});
return;

View File

@@ -35,7 +35,7 @@ export function createFeishuDriveCommentNoticeHandler(params: {
const getBotOpenId = params.getBotOpenId ?? ((id) => botOpenIds.get(id));
const runFeishuHandler = async (task: () => Promise<void>) => {
const promise = task().catch((err) => {
const promise = task().catch((err: unknown) => {
error(`feishu[${accountId}]: error handling drive comment notice: ${String(err)}`);
});
if (!fireAndForget) {

View File

@@ -331,7 +331,7 @@ async function resolveParsedCommentContent(params: {
resolvedObjToken: objToken,
};
})
.catch((error) => {
.catch((error: unknown) => {
params.logger?.(
`feishu[${params.accountId}]: wiki link resolution threw token=${link.wikiNodeToken} error=${formatErrorMessage(error)}`,
);
@@ -485,7 +485,7 @@ async function requestFeishuOpenApi<T>(params: {
{ timeoutMs: params.timeoutMs },
)
.then((resolved) => (resolved.status === "resolved" ? resolved.value : null))
.catch((error) => {
.catch((error: unknown) => {
params.logger?.(`${params.errorLabel}: ${formatErrorDetails(error)}`);
return null;
});

View File

@@ -329,7 +329,7 @@ export function createFeishuMessageReceiveHandler({
await inboundDebouncer.enqueue(event);
};
if (fireAndForget) {
void processMessage().catch((err) => {
void processMessage().catch((err: unknown) => {
releaseFeishuMessageProcessing(messageDedupeKey, accountId);
error(`feishu[${accountId}]: error handling message: ${String(err)}`);
});

View File

@@ -79,7 +79,7 @@ async function waitForSlowBodyTimeoutResponse(
socket.setEncoding("utf8");
socket.on("error", () => {});
socket.on("data", (chunk) => {
response += chunk;
response += chunk.toString();
if (response.includes("Request body timeout")) {
clearTimeout(failTimer);
socket.destroy();
@@ -127,7 +127,7 @@ async function waitForOversizedBodyResponse(url: string): Promise<string> {
socket.setEncoding("utf8");
socket.on("data", (chunk) => {
response += chunk;
response += chunk.toString();
if (response.includes("Payload too large")) {
finish(response);
}

View File

@@ -18,7 +18,6 @@ function resolveFeishuParentConversationCandidates(rawId: string): string[] {
case "group_topic":
case "group_sender":
return [parsed.chatId];
case "group":
default:
return [];
}

View File

@@ -520,7 +520,7 @@ export class FeishuStreamingSession {
.then(async ({ release }) => {
await release();
})
.catch((e) => this.log?.(`Note update failed: ${String(e)}`));
.catch((e: unknown) => this.log?.(`Note update failed: ${String(e)}`));
}
async close(finalText?: string, options?: { note?: string }): Promise<boolean> {
@@ -584,7 +584,7 @@ export class FeishuStreamingSession {
.then(async ({ release }) => {
await release();
})
.catch((e) => this.log?.(`Close failed: ${String(e)}`));
.catch((e: unknown) => this.log?.(`Close failed: ${String(e)}`));
const finalState = this.state;
this.state = null;
this.pendingText = null;