chore: apply extension lint cleanups · openclaw/openclaw@0b0662b
steipete
·
2026-04-23
·
via Recent Commits to openclaw:main
File tree
mattermost/src/mattermost
| Original file line number | Diff line number | Diff line change |
|---|
@@ -178,7 +178,7 @@ async function queryBlueBubblesChats(params: {
|
178 | 178 | return []; |
179 | 179 | } |
180 | 180 | const payload = (await res.json().catch(() => null)) as Record<string, unknown> | null; |
181 | | -const data = payload && typeof payload.data !== "undefined" ? (payload.data as unknown) : null; |
| 181 | +const data = payload && payload.data !== undefined ? (payload.data as unknown) : null; |
182 | 182 | return Array.isArray(data) ? (data as BlueBubblesChatRecord[]) : []; |
183 | 183 | } |
184 | 184 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -226,7 +226,7 @@ async function queryChats(params: {
|
226 | 226 | return []; |
227 | 227 | } |
228 | 228 | const payload = (await res.json().catch(() => null)) as Record<string, unknown> | null; |
229 | | -const data = payload && typeof payload.data !== "undefined" ? (payload.data as unknown) : null; |
| 229 | +const data = payload && payload.data !== undefined ? (payload.data as unknown) : null; |
230 | 230 | return Array.isArray(data) ? (data as BlueBubblesChatRecord[]) : []; |
231 | 231 | } |
232 | 232 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -189,7 +189,7 @@ function readNativeCompactionCompletion(
|
189 | 189 | |
190 | 190 | function resolveCompactionWaitTimeoutMs(): number { |
191 | 191 | const raw = process.env.OPENCLAW_CODEX_COMPACTION_WAIT_TIMEOUT_MS?.trim(); |
192 | | -const parsed = raw ? Number.parseInt(raw, 10) : NaN; |
| 192 | +const parsed = raw ? Number.parseInt(raw, 10) : Number.NaN; |
193 | 193 | if (Number.isFinite(parsed) && parsed > 0) { |
194 | 194 | return parsed; |
195 | 195 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -68,8 +68,8 @@ export async function getAudioDuration(filePath: string): Promise<number> {
|
68 | 68 | "csv=p=0", |
69 | 69 | filePath, |
70 | 70 | ]); |
71 | | -const duration = parseFloat(stdout.trim()); |
72 | | -if (isNaN(duration)) { |
| 71 | +const duration = Number.parseFloat(stdout.trim()); |
| 72 | +if (Number.isNaN(duration)) { |
73 | 73 | throw new Error("Could not parse duration"); |
74 | 74 | } |
75 | 75 | return Math.round(duration * 100) / 100; // Round to 2 decimal places |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,8 +2,8 @@ import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
|
2 | 2 | |
3 | 3 | const DECRYPT_FAILURE_WINDOW_MS = 30_000; |
4 | 4 | const DECRYPT_FAILURE_RECONNECT_THRESHOLD = 3; |
5 | | -const DECRYPT_FAILURE_PATTERN = /DecryptionFailed\(/; |
6 | | -const DAVE_PASSTHROUGH_DISABLED_PATTERN = /UnencryptedWhenPassthroughDisabled/; |
| 5 | +const DECRYPT_FAILURE_MARKER = "DecryptionFailed("; |
| 6 | +const DAVE_PASSTHROUGH_DISABLED_MARKER = "UnencryptedWhenPassthroughDisabled"; |
7 | 7 | |
8 | 8 | export const DAVE_RECEIVE_PASSTHROUGH_INITIAL_EXPIRY_SECONDS = 30; |
9 | 9 | export const DAVE_RECEIVE_PASSTHROUGH_REARM_EXPIRY_SECONDS = 15; |
@@ -80,12 +80,12 @@ export function isAbortLikeReceiveError(err: unknown): boolean {
|
80 | 80 | |
81 | 81 | export function analyzeVoiceReceiveError(err: unknown): VoiceReceiveErrorAnalysis { |
82 | 82 | const message = formatErrorMessage(err); |
83 | | -const shouldAttemptPassthrough = DAVE_PASSTHROUGH_DISABLED_PATTERN.test(message); |
| 83 | +const shouldAttemptPassthrough = message.includes(DAVE_PASSTHROUGH_DISABLED_MARKER); |
84 | 84 | return { |
85 | 85 | message, |
86 | 86 | isAbortLike: isAbortLikeReceiveError(err), |
87 | 87 | shouldAttemptPassthrough, |
88 | | -countsAsDecryptFailure: DECRYPT_FAILURE_PATTERN.test(message) || shouldAttemptPassthrough, |
| 88 | +countsAsDecryptFailure: message.includes(DECRYPT_FAILURE_MARKER) || shouldAttemptPassthrough, |
89 | 89 | }; |
90 | 90 | } |
91 | 91 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -49,7 +49,7 @@ function decodeHtmlEntities(text: string): string {
|
49 | 49 | .replace(/—/g, "--") |
50 | 50 | .replace(/…/g, "...") |
51 | 51 | .replace(/&#(\d+);/g, (_, code) => String.fromCodePoint(Number(code))) |
52 | | -.replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCodePoint(parseInt(code, 16))); |
| 52 | +.replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16))); |
53 | 53 | } |
54 | 54 | |
55 | 55 | function stripHtml(html: string): string { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -38,9 +38,7 @@ type FeishuMessageLike = {
|
38 | 38 | |
39 | 39 | export type GroupSessionScope = "group" | "group_sender" | "group_topic" | "group_topic_sender"; |
40 | 40 | |
41 | | -type FeishuLogger = { |
42 | | -(...args: unknown[]): void; |
43 | | -}; |
| 41 | +type FeishuLogger = (...args: unknown[]) => void; |
44 | 42 | |
45 | 43 | export type ResolvedFeishuGroupSession = { |
46 | 44 | peerId: string; |
@@ -215,7 +213,7 @@ export function parseMergeForwardContent(params: { content: string; log?: Feishu
|
215 | 213 | |
216 | 214 | log?.(`feishu: merge_forward contains ${subMessages.length} sub-messages`); |
217 | 215 | subMessages.sort( |
218 | | -(a, b) => parseInt(a.create_time || "0", 10) - parseInt(b.create_time || "0", 10), |
| 216 | +(a, b) => Number.parseInt(a.create_time || "0", 10) - Number.parseInt(b.create_time || "0", 10), |
219 | 217 | ); |
220 | 218 | |
221 | 219 | const lines = ["[Merged and Forwarded Messages]"]; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -17,9 +17,7 @@ type FeishuContactUserGetResponse = Awaited<
|
17 | 17 | ReturnType<ReturnType<typeof createFeishuClient>["contact"]["user"]["get"]> |
18 | 18 | >; |
19 | 19 | |
20 | | -type FeishuLogger = { |
21 | | -(...args: unknown[]): void; |
22 | | -}; |
| 20 | +type FeishuLogger = (...args: unknown[]) => void; |
23 | 21 | |
24 | 22 | const IGNORED_PERMISSION_SCOPE_TOKENS = ["contact:contact.base:readonly"]; |
25 | 23 | const FEISHU_SCOPE_CORRECTIONS: Record<string, string> = { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -409,7 +409,7 @@ export async function handleFeishuMessage(params: {
|
409 | 409 | // instead of the delivery/processing time. Feishu uses a millisecond |
410 | 410 | // epoch string; fall back to Date.now() only when the field is absent. |
411 | 411 | const messageCreateTimeMs = event.message.create_time |
412 | | - ? parseInt(event.message.create_time, 10) |
| 412 | + ? Number.parseInt(event.message.create_time, 10) |
413 | 413 | : Date.now(); |
414 | 414 | |
415 | 415 | let requireMention = false; // DMs never require mention; groups may override below |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -import fs from "fs"; |
2 | | -import path from "path"; |
3 | | -import { Readable } from "stream"; |
| 1 | +import fs from "node:fs"; |
| 2 | +import path from "node:path"; |
| 3 | +import { Readable } from "node:stream"; |
4 | 4 | import type * as Lark from "@larksuiteoapi/node-sdk"; |
5 | 5 | import { mediaKindFromMime } from "openclaw/plugin-sdk/media-runtime"; |
6 | 6 | import { withTempDownloadPath } from "openclaw/plugin-sdk/temp-path"; |
@@ -627,22 +627,21 @@ export async function sendMediaFeishu(params: {
|
627 | 627 | if (routing.msgType === "image") { |
628 | 628 | const { imageKey } = await uploadImageFeishu({ cfg, image: buffer, accountId }); |
629 | 629 | return sendImageFeishu({ cfg, to, imageKey, replyToMessageId, replyInThread, accountId }); |
630 | | -} else { |
631 | | -const { fileKey } = await uploadFileFeishu({ |
632 | | - cfg, |
633 | | -file: buffer, |
634 | | -fileName: name, |
635 | | -fileType: routing.fileType ?? "stream", |
636 | | - accountId, |
637 | | -}); |
638 | | -return sendFileFeishu({ |
639 | | - cfg, |
640 | | - to, |
641 | | - fileKey, |
642 | | -msgType: routing.msgType, |
643 | | - replyToMessageId, |
644 | | - replyInThread, |
645 | | - accountId, |
646 | | -}); |
647 | 630 | } |
| 631 | +const { fileKey } = await uploadFileFeishu({ |
| 632 | + cfg, |
| 633 | +file: buffer, |
| 634 | +fileName: name, |
| 635 | +fileType: routing.fileType ?? "stream", |
| 636 | + accountId, |
| 637 | +}); |
| 638 | +return sendFileFeishu({ |
| 639 | + cfg, |
| 640 | + to, |
| 641 | + fileKey, |
| 642 | +msgType: routing.msgType, |
| 643 | + replyToMessageId, |
| 644 | + replyInThread, |
| 645 | + accountId, |
| 646 | +}); |
648 | 647 | } |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。