From 15528c8a14e6a5ea6691e065a1f154438ed4eaa0 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 24 Apr 2026 05:21:20 +0700 Subject: [PATCH] chore(lint): no-shadow in app composer/message-input/e2e helpers --- packages/app/e2e/helpers/app.ts | 14 ++++------ packages/app/e2e/helpers/archive-tab.ts | 16 +++++------ .../components/composer-height-mirror.web.ts | 13 ++++++--- packages/app/src/components/message-input.tsx | 28 +++++++++---------- .../app/src/hooks/use-pr-pane-data.test.ts | 14 +++++----- 5 files changed, 44 insertions(+), 41 deletions(-) diff --git a/packages/app/e2e/helpers/app.ts b/packages/app/e2e/helpers/app.ts index ab65c8524..7761139e2 100644 --- a/packages/app/e2e/helpers/app.ts +++ b/packages/app/e2e/helpers/app.ts @@ -27,14 +27,14 @@ async function ensureE2EStorageSeeded(page: Page): Promise { } const needsReset = await page.evaluate( - ({ expectedEndpoint, expectedServerId }) => { + ({ expectedEndpoint: endpoint, expectedServerId: serverId }) => { const raw = localStorage.getItem("@paseo:daemon-registry"); if (!raw) return true; try { const parsed = JSON.parse(raw); if (!Array.isArray(parsed) || parsed.length !== 1) return true; const entry = parsed[0] as any; - if (entry?.serverId !== expectedServerId) return true; + if (entry?.serverId !== serverId) return true; const connections = entry?.connections; if (!Array.isArray(connections)) return true; if ( @@ -46,9 +46,7 @@ async function ensureE2EStorageSeeded(page: Page): Promise { ) ) return true; - return !connections.some( - (c: any) => c?.type === "directTcp" && c?.endpoint === expectedEndpoint, - ); + return !connections.some((c: any) => c?.type === "directTcp" && c?.endpoint === endpoint); } catch { return true; } @@ -68,10 +66,10 @@ async function ensureE2EStorageSeeded(page: Page): Promise { }); const preferences = buildCreateAgentPreferences(expectedServerId); await page.evaluate( - ({ daemon, preferences }) => { + ({ daemon: seededDaemon, preferences: seededPreferences }) => { localStorage.setItem("@paseo:e2e", "1"); - localStorage.setItem("@paseo:daemon-registry", JSON.stringify([daemon])); - localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(preferences)); + localStorage.setItem("@paseo:daemon-registry", JSON.stringify([seededDaemon])); + localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(seededPreferences)); localStorage.removeItem("@paseo:settings"); }, { daemon, preferences }, diff --git a/packages/app/e2e/helpers/archive-tab.ts b/packages/app/e2e/helpers/archive-tab.ts index d12b57787..b3f4de8bc 100644 --- a/packages/app/e2e/helpers/archive-tab.ts +++ b/packages/app/e2e/helpers/archive-tab.ts @@ -148,21 +148,21 @@ export async function primeAdditionalPage(page: Page): Promise { await ws.close({ code: 1008, reason: "Blocked connection to localhost:6767 during e2e." }); }); await page.addInitScript( - ({ daemon, preferences, seedNonce }) => { + ({ daemon: seededDaemon, preferences: seededPreferences, seedNonce: nonce }) => { const disableOnceKey = "@paseo:e2e-disable-default-seed-once"; const disableValue = localStorage.getItem(disableOnceKey); if (disableValue) { localStorage.removeItem(disableOnceKey); - if (disableValue === seedNonce) { + if (disableValue === nonce) { return; } } localStorage.setItem("@paseo:e2e", "1"); - localStorage.setItem("@paseo:e2e-seed-nonce", seedNonce); - localStorage.setItem("@paseo:daemon-registry", JSON.stringify([daemon])); + localStorage.setItem("@paseo:e2e-seed-nonce", nonce); + localStorage.setItem("@paseo:daemon-registry", JSON.stringify([seededDaemon])); localStorage.removeItem("@paseo:settings"); - localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(preferences)); + localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(seededPreferences)); }, { daemon, preferences, seedNonce }, ); @@ -173,11 +173,11 @@ export async function resetSeededPageState(page: Page): Promise { const { daemon, preferences } = buildSeededStoragePayload(); await page.goto("/"); await page.evaluate( - ({ daemon, preferences }) => { + ({ daemon: seededDaemon, preferences: seededPreferences }) => { localStorage.clear(); localStorage.setItem("@paseo:e2e", "1"); - localStorage.setItem("@paseo:daemon-registry", JSON.stringify([daemon])); - localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(preferences)); + localStorage.setItem("@paseo:daemon-registry", JSON.stringify([seededDaemon])); + localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(seededPreferences)); localStorage.removeItem("@paseo:settings"); }, { daemon, preferences }, diff --git a/packages/app/src/components/composer-height-mirror.web.ts b/packages/app/src/components/composer-height-mirror.web.ts index 7fb335cf1..58ddbb277 100644 --- a/packages/app/src/components/composer-height-mirror.web.ts +++ b/packages/app/src/components/composer-height-mirror.web.ts @@ -83,12 +83,17 @@ export function useComposerHeightMirror({ } ms.width = `${source.clientWidth}px`; - const { value, minHeight, maxHeight, onHeight } = paramsRef.current; + const { + value: currentValue, + minHeight: currentMinHeight, + maxHeight: currentMaxHeight, + onHeight: currentOnHeight, + } = paramsRef.current; // Trailing newline is collapsed by textarea measurement — pad with a space. - mirror.value = value.endsWith("\n") ? `${value} ` : value; + mirror.value = currentValue.endsWith("\n") ? `${currentValue} ` : currentValue; - const next = Math.max(minHeight, Math.min(maxHeight, mirror.scrollHeight)); - onHeight(next); + const next = Math.max(currentMinHeight, Math.min(currentMaxHeight, mirror.scrollHeight)); + currentOnHeight(next); }, [textareaRef]); useLayoutEffect(() => { diff --git a/packages/app/src/components/message-input.tsx b/packages/app/src/components/message-input.tsx index 7cd2b8130..e38d11978 100644 --- a/packages/app/src/components/message-input.tsx +++ b/packages/app/src/components/message-input.tsx @@ -650,13 +650,13 @@ export const MessageInput = forwardRef(funct } const getWebTextArea = useCallback((): TextAreaHandle | null => { - const ref = textInputRef.current; - if (!ref) return null; - if (typeof (ref as any).getNativeRef === "function") { - const native = (ref as any).getNativeRef(); + const current = textInputRef.current; + if (!current) return null; + if (typeof (current as any).getNativeRef === "function") { + const native = (current as any).getNativeRef(); if (isTextAreaLike(native)) return native; } - if (isTextAreaLike(ref)) return ref; + if (isTextAreaLike(current)) return current; return null; }, []); @@ -673,12 +673,12 @@ export const MessageInput = forwardRef(funct }); const getWebElement = useCallback((target: "root" | "wrapper"): HTMLElement | null => { - const ref = target === "root" ? rootRef.current : inputWrapperRef.current; - if (!ref) return null; - return ref instanceof HTMLElement - ? ref - : (ref as unknown as { getBoundingClientRect?: () => DOMRect }).getBoundingClientRect - ? (ref as unknown as HTMLElement) + const current = target === "root" ? rootRef.current : inputWrapperRef.current; + if (!current) return null; + return current instanceof HTMLElement + ? current + : (current as unknown as { getBoundingClientRect?: () => DOMRect }).getBoundingClientRect + ? (current as unknown as HTMLElement) : null; }, []); @@ -710,11 +710,11 @@ export const MessageInput = forwardRef(funct event.preventDefault(); void filesToImageAttachments(imageFiles) - .then((attachments) => { - if (disposed || attachments.length === 0) { + .then((pastedAttachments) => { + if (disposed || pastedAttachments.length === 0) { return; } - onAddImages(attachments); + onAddImages(pastedAttachments); return; }) .catch((error) => { diff --git a/packages/app/src/hooks/use-pr-pane-data.test.ts b/packages/app/src/hooks/use-pr-pane-data.test.ts index a647ad986..3226a6372 100644 --- a/packages/app/src/hooks/use-pr-pane-data.test.ts +++ b/packages/app/src/hooks/use-pr-pane-data.test.ts @@ -24,26 +24,26 @@ type CheckoutPrStatusPayload = CheckoutPrStatusResponse["payload"]; type PullRequestTimelinePayload = PullRequestTimelineResponse["payload"]; const { mockRuntime, mockClient, checkoutStatusUpdateHandlers } = vi.hoisted(() => { - const checkoutStatusUpdateHandlers = new Set<(message: unknown) => void>(); - const mockClient = { + const hoistedHandlers = new Set<(message: unknown) => void>(); + const hoistedClient = { checkoutPrStatus: vi.fn(), pullRequestTimeline: vi.fn(), on: vi.fn((type: string, handler: (message: unknown) => void) => { if (type !== "checkout_status_update") { return () => {}; } - checkoutStatusUpdateHandlers.add(handler); + hoistedHandlers.add(handler); return () => { - checkoutStatusUpdateHandlers.delete(handler); + hoistedHandlers.delete(handler); }; }), }; return { - mockClient, - checkoutStatusUpdateHandlers, + mockClient: hoistedClient, + checkoutStatusUpdateHandlers: hoistedHandlers, mockRuntime: { - client: mockClient, + client: hoistedClient, isConnected: true, }, };