From 0b250ff5b5605006ab48f0dd85972546355278b2 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Mon, 2 Mar 2026 07:52:08 -0800 Subject: [PATCH] Fix lint --- plugins-external/faker/tests/init.test.ts | 12 ++++++++---- plugins-external/httpsnippet/src/index.ts | 5 ++++- plugins/importer-curl/src/index.ts | 10 ++++++++-- src-web/components/HttpResponseTimeline.tsx | 1 - 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/plugins-external/faker/tests/init.test.ts b/plugins-external/faker/tests/init.test.ts index 823188a9..a4fd4c60 100644 --- a/plugins-external/faker/tests/init.test.ts +++ b/plugins-external/faker/tests/init.test.ts @@ -13,12 +13,16 @@ describe('template-function-faker', () => { it('renders date results as unquoted ISO strings', async () => { const { plugin } = await import('../src/index'); const fn = plugin.templateFunctions?.find((fn) => fn.name === 'faker.date.future'); + const onRender = fn?.onRender; - expect(fn?.onRender).toBeTypeOf('function'); + expect(onRender).toBeTypeOf('function'); + if (onRender == null) { + throw new Error("Expected template function 'faker.date.future' to define onRender"); + } - const result = await fn!.onRender!( - {} as Parameters>[0], - { values: {} } as Parameters>[1], + const result = await onRender( + {} as Parameters[0], + { values: {} } as Parameters[1], ); expect(result).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/); diff --git a/plugins-external/httpsnippet/src/index.ts b/plugins-external/httpsnippet/src/index.ts index b9f301fc..92303317 100644 --- a/plugins-external/httpsnippet/src/index.ts +++ b/plugins-external/httpsnippet/src/index.ts @@ -206,7 +206,10 @@ export const plugin: PluginDefinition = { // Create snippet generator const snippet = new HTTPSnippet(harRequest); const generateSnippet = (target: string, client: string): string => { - const result = snippet.convert(target as any, client); + const result = snippet.convert( + target as Parameters[0], + client as Parameters[1], + ); return (Array.isArray(result) ? result.join('\n') : result || '').replace(/\r\n/g, '\n'); }; diff --git a/plugins/importer-curl/src/index.ts b/plugins/importer-curl/src/index.ts index 23542c1e..c7f2cf86 100644 --- a/plugins/importer-curl/src/index.ts +++ b/plugins/importer-curl/src/index.ts @@ -82,7 +82,9 @@ function splitCommands(rawData: string): string[] { let inDollarQuote = false; for (let i = 0; i < joined.length; i++) { - const ch = joined[i]!; + if (joined[i] === undefined) break; // Make TS happy + + const ch = joined[i]; const next = joined[i + 1]; // Track quoting state to avoid splitting inside quoted strings @@ -121,7 +123,11 @@ function splitCommands(rawData: string): string[] { const inQuote = inSingleQuote || inDoubleQuote || inDollarQuote; // Split on ;, newline, or CRLF when not inside quotes and not escaped - if (!inQuote && !isEscaped(i) && (ch === ';' || ch === '\n' || (ch === '\r' && next === '\n'))) { + if ( + !inQuote && + !isEscaped(i) && + (ch === ';' || ch === '\n' || (ch === '\r' && next === '\n')) + ) { if (ch === '\r') i++; // Skip the \n in \r\n if (current.trim()) { commands.push(current.trim()); diff --git a/src-web/components/HttpResponseTimeline.tsx b/src-web/components/HttpResponseTimeline.tsx index a8cce8d9..939d653c 100644 --- a/src-web/components/HttpResponseTimeline.tsx +++ b/src-web/components/HttpResponseTimeline.tsx @@ -8,7 +8,6 @@ import { useHttpResponseEvents } from '../hooks/useHttpResponseEvents'; import { Editor } from './core/Editor/LazyEditor'; import { type EventDetailAction, EventDetailHeader, EventViewer } from './core/EventViewer'; import { EventViewerRow } from './core/EventViewerRow'; -import { HttpMethodTagRaw } from './core/HttpMethodTag'; import { HttpStatusTagRaw } from './core/HttpStatusTag'; import { Icon, type IconProps } from './core/Icon'; import { KeyValueRow, KeyValueRows } from './core/KeyValueRow';