From b4309d2b799fc3b4cb35b80ca0c24003e6c765ab Mon Sep 17 00:00:00 2001 From: garrytan Date: Sun, 1 Nov 2026 10:35:29 +0000 Subject: [PATCH] fix: three new oxlint findings from main design/src/provider.ts:121 uses startsWith instead of a caret regex (same result; RegExp#test also coerced with String). design/test/gemini-provider.test.ts:47 spreads init?.headers directly (spreading undefined is a no-op). test/hook-scripts.test.ts:1726 drops the unused base binding. Baseline unchanged at 970. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- design/src/provider.ts | 2 +- design/test/gemini-provider.test.ts | 2 +- test/hook-scripts.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/design/src/provider.ts b/design/src/provider.ts index 0761fd71b..c7231e60c 100644 --- a/design/src/provider.ts +++ b/design/src/provider.ts @@ -118,7 +118,7 @@ export function readImage(auth: DesignAuth, data: any): { responseId: string; im const parts: any[] = candidate?.content?.parts ?? []; const images = parts.filter(part => { const inline = part?.inlineData ?? part?.inline_data; - return typeof inline?.data === "string" && /^image\//.test(inline.mimeType ?? inline.mime_type ?? ""); + return typeof inline?.data === "string" && String(inline.mimeType ?? inline.mime_type ?? "").startsWith("image/"); }); const image = images.findLast(part => part?.thought !== true) ?? images.at(-1); if (image) { diff --git a/design/test/gemini-provider.test.ts b/design/test/gemini-provider.test.ts index e1b2b0188..97cf28e7f 100644 --- a/design/test/gemini-provider.test.ts +++ b/design/test/gemini-provider.test.ts @@ -44,7 +44,7 @@ const savedConsoleLog = console.log; function stubFetch(reply: (url: string, n: number) => Response) { globalThis.fetch = (async (input: any, init?: any) => { const url = String(input); - calls.push({ url, headers: { ...(init?.headers ?? {}) }, body: JSON.parse(String(init?.body)) }); + calls.push({ url, headers: { ...init?.headers }, body: JSON.parse(String(init?.body)) }); return reply(url, calls.length); }) as typeof globalThis.fetch; } diff --git a/test/hook-scripts.test.ts b/test/hook-scripts.test.ts index d1b789e92..8baf7ab88 100644 --- a/test/hook-scripts.test.ts +++ b/test/hook-scripts.test.ts @@ -1723,7 +1723,7 @@ describe('check-freeze.sh', () => { // The host resolves a relative path against its physical cwd; a logical // $PWD through a symlink names a different parent for '..'. test.skipIf(process.platform === 'win32')('a relative path resolves against the physical working directory', () => { - withTree(({ base, home, src, outside }) => { + withTree(({ home, src, outside }) => { const work = path.join(outside, 'work'); fs.mkdirSync(work); fs.mkdirSync(path.join(src, 'a', 'b'), { recursive: true });