From 5ee139749a34bc75e1ad89579be2391747e130b1 Mon Sep 17 00:00:00 2001 From: OG T Date: Sun, 29 Mar 2026 16:40:19 +0800 Subject: [PATCH] =?UTF-8?q?chore(lint):=20=E6=B8=85=E7=90=86=207=20?= =?UTF-8?q?=E9=A0=85=20ESLint=20=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - useApprovalSSE.ts: 標記未使用的 fallbackToPolling - useErrors.ts: 移除未使用的 ErrorListResponse import - dashboard.store.ts: 標記 SSE event 參數 - agent.store.ts: 加註 SSE 串流迴圈說明 - approval.store.ts: 改用正規 type import - terminal.store.ts: 改用 inline type import - OmniTerminal.tsx: 改用 type import Co-Authored-By: Claude Opus 4.5 --- apps/web/src/components/terminal/OmniTerminal.tsx | 2 +- apps/web/src/hooks/useApprovalSSE.ts | 2 +- apps/web/src/hooks/useErrors.ts | 1 - apps/web/src/stores/agent.store.ts | 1 + apps/web/src/stores/approval.store.ts | 3 ++- apps/web/src/stores/dashboard.store.ts | 4 ++-- apps/web/src/stores/terminal.store.ts | 8 ++++---- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/web/src/components/terminal/OmniTerminal.tsx b/apps/web/src/components/terminal/OmniTerminal.tsx index e00688c1f..e25800eb8 100644 --- a/apps/web/src/components/terminal/OmniTerminal.tsx +++ b/apps/web/src/components/terminal/OmniTerminal.tsx @@ -28,7 +28,7 @@ import { useIsConnected, useTerminalMessages, useIsTerminalOpen, - TerminalMessage, + type TerminalMessage, } from '@/stores/terminal.store' import { GenUIRenderer, isRegistered } from '@/components/genui' import { Z_INDEX } from '@/lib/constants/z-index' diff --git a/apps/web/src/hooks/useApprovalSSE.ts b/apps/web/src/hooks/useApprovalSSE.ts index f9c5cc1b7..256e40ccb 100644 --- a/apps/web/src/hooks/useApprovalSSE.ts +++ b/apps/web/src/hooks/useApprovalSSE.ts @@ -37,7 +37,7 @@ interface UseApprovalSSEReturn { } export function useApprovalSSE(options: UseApprovalSSEOptions = {}): UseApprovalSSEReturn { - const { autoConnect = true, fallbackToPolling = true } = options + const { autoConnect = true, fallbackToPolling: _fallbackToPolling = true } = options const connectSSE = useApprovalStore((s) => s.connectSSE) const disconnectSSE = useApprovalStore((s) => s.disconnectSSE) diff --git a/apps/web/src/hooks/useErrors.ts b/apps/web/src/hooks/useErrors.ts index 0ecb3f233..c63d05bc0 100644 --- a/apps/web/src/hooks/useErrors.ts +++ b/apps/web/src/hooks/useErrors.ts @@ -16,7 +16,6 @@ import { useState, useEffect, useCallback } from 'react' import { apiClient, type ErrorStatsResponse, - type ErrorListResponse, type ErrorTrendResponse, type SentryIssue, } from '@/lib/api-client' diff --git a/apps/web/src/stores/agent.store.ts b/apps/web/src/stores/agent.store.ts index 2f0e73733..ab481b220 100644 --- a/apps/web/src/stores/agent.store.ts +++ b/apps/web/src/stores/agent.store.ts @@ -180,6 +180,7 @@ export const useAgentStore = create()( const decoder = new TextDecoder() let buffer = '' // Buffer 累積,防止 TCP 封包切斷 JSON + // eslint-disable-next-line no-constant-condition -- SSE 串流讀取迴圈,由 done 控制退出 while (true) { const { done, value } = await reader.read() if (done) break diff --git a/apps/web/src/stores/approval.store.ts b/apps/web/src/stores/approval.store.ts index fec4a3fee..93727e7ff 100644 --- a/apps/web/src/stores/approval.store.ts +++ b/apps/web/src/stores/approval.store.ts @@ -12,6 +12,7 @@ import { create } from 'zustand' import { subscribeWithSelector } from 'zustand/middleware' +import type { ApprovalRequest as FrontendApprovalRequest } from '@/components/approval/approval-card' // ============================================================================= // Types (與後端 Pydantic 模型對應) @@ -595,7 +596,7 @@ const DATA_IMPACT_MAP: Record()( } // Handle events - eventSource.addEventListener('connected', (e: MessageEvent) => { + eventSource.addEventListener('connected', (_e: MessageEvent) => { console.log('[SSE] Received connected event') resetHeartbeat() }) @@ -223,7 +223,7 @@ export const useDashboardStore = create()( } }) - eventSource.addEventListener('heartbeat', (e: MessageEvent) => { + eventSource.addEventListener('heartbeat', (_e: MessageEvent) => { console.log('[SSE] Heartbeat received') resetHeartbeat() }) diff --git a/apps/web/src/stores/terminal.store.ts b/apps/web/src/stores/terminal.store.ts index 7c2c89ef3..9bc1c0620 100644 --- a/apps/web/src/stores/terminal.store.ts +++ b/apps/web/src/stores/terminal.store.ts @@ -19,10 +19,10 @@ import { create } from 'zustand' import { - SSEConnectionState, - TerminalSession, - TerminalEventType, - SSEEventData, + type SSEConnectionState, + type TerminalSession, + type TerminalEventType, + type SSEEventData, isValidTransition, getReconnectDelay, shouldRetry,