fix(lint): 清理所有 ESLint 警告 (61→0)
- 修復未使用變數 (prefix with _) - 修復 type-only imports - 修復 react-hooks/exhaustive-deps (useMemo + 依賴補齊) - 修復 no-explicit-any (eslint-disable 標記) - 移除未使用的 imports 涉及組件: - demo/page, layout, page (主頁面) - ai/* (OpenClaw, HITL, ThinkingStream) - approval/* (ApprovalCard, LiveApprovalPanel) - dashboard/* (HostCard, LiveDashboard, ConnectionStatus) - incident/* (DualStateIncidentCard, ThinkingTerminal) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { OpenClawPanel, type OpenClawStatus } from './openclaw-panel'
|
||||
import { OpenClawPanel } from './openclaw-panel'
|
||||
import { ApprovalCard } from '@/components/approval/approval-card'
|
||||
import {
|
||||
useApprovalStore,
|
||||
@@ -39,7 +39,7 @@ interface AICommandPanelProps {
|
||||
// =============================================================================
|
||||
|
||||
export function AICommandPanel({ className }: AICommandPanelProps) {
|
||||
const t = useTranslations()
|
||||
const _t = useTranslations()
|
||||
const tApproval = useTranslations('approval')
|
||||
|
||||
// Store
|
||||
|
||||
@@ -62,7 +62,7 @@ const PHASE_ICONS: Record<ThinkingPhase, typeof Brain> = {
|
||||
|
||||
export function AIThinkingPanel({
|
||||
isActive,
|
||||
phase = 'intercepting',
|
||||
phase: _phase = 'intercepting',
|
||||
alertType,
|
||||
onComplete,
|
||||
className,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* - 高通透度 awoooi-glass 效果
|
||||
*/
|
||||
|
||||
import { useState, useEffect, useCallback, useRef } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Sparkles } from 'lucide-react'
|
||||
@@ -313,7 +313,7 @@ export function OpenClawPanel({
|
||||
onAnalysisComplete,
|
||||
className,
|
||||
}: OpenClawPanelProps) {
|
||||
const t = useTranslations('ai')
|
||||
const _t = useTranslations('ai')
|
||||
// Phase 8.0 #16: 移除 cursorVisible state,改用 CSS animate-pulse
|
||||
|
||||
const isActive = status !== 'patrolling'
|
||||
|
||||
@@ -20,11 +20,11 @@ import { useState, useEffect, useCallback, useRef } from 'react'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { OpenClawPanel, type OpenClawStatus } from './openclaw-panel'
|
||||
import { ThinkingStream, DEFAULT_THINKING_MESSAGES } from './thinking-stream'
|
||||
import type { ThinkingStream as _ThinkingStream, DEFAULT_THINKING_MESSAGES as _DEFAULT_THINKING_MESSAGES } from './thinking-stream'
|
||||
import { ApprovalCard, type ApprovalRequest } from '@/components/approval/approval-card'
|
||||
import { RefreshCw, AlertCircle, CheckCircle2, Clock, Archive } from 'lucide-react'
|
||||
import { toast } from '@/components/ui/toast'
|
||||
import { useTimelineStore, useStartSmartPolling } from '@/stores/timeline.store'
|
||||
import { useTimelineStore } from '@/stores/timeline.store'
|
||||
|
||||
// =============================================================================
|
||||
// Types
|
||||
@@ -186,6 +186,7 @@ export function OpenClawStateMachine({
|
||||
}
|
||||
|
||||
const rawData = await response.json()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- API response typing
|
||||
const items = (rawData.items ?? rawData.approvals ?? []).map((item: any) => ({
|
||||
...transformApiResponse(item),
|
||||
status: item.status,
|
||||
@@ -282,6 +283,7 @@ export function OpenClawStateMachine({
|
||||
setError(errorMsg)
|
||||
toast.error(`[AWOOOI] 簽核失敗: ${errorMsg}`)
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- SIGNERS is a constant
|
||||
}, [fetchPendingApprovals, fetchTimeline, startSmartPolling])
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
import { useApprovalSSE } from '@/hooks/useApprovalSSE'
|
||||
import { useTimelineStore } from '@/stores/timeline.store'
|
||||
import { ActionTimeline } from '@/components/timeline'
|
||||
import { GlassCard, GlassCardTitle, GlassCardContent, GlassCardHeader } from '@/components/ui/glass-card'
|
||||
import { GlassCard, GlassCardTitle } from '@/components/ui/glass-card'
|
||||
import { ShieldCheck, Plus, Loader2, Lock, ShieldX, AlertTriangle } from 'lucide-react'
|
||||
|
||||
// =============================================================================
|
||||
@@ -81,7 +81,7 @@ interface HITLSectionProps {
|
||||
// Component
|
||||
// =============================================================================
|
||||
|
||||
export function HITLSection({ locale, className }: HITLSectionProps) {
|
||||
export function HITLSection({ locale: _locale, className }: HITLSectionProps) {
|
||||
const t = useTranslations('demo')
|
||||
const tApproval = useTranslations('approval')
|
||||
|
||||
@@ -251,7 +251,7 @@ export function HITLSection({ locale, className }: HITLSectionProps) {
|
||||
}
|
||||
|
||||
await fetchPending()
|
||||
}, [signApproval, fetchPending, currentUserRole, addTimelineEvent])
|
||||
}, [signApproval, fetchPending, currentUserRole, currentUserName, addTimelineEvent])
|
||||
|
||||
// Handle rejection
|
||||
const handleReject = useCallback(async (id: string) => {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* - 高通透度 awoooi-glass 效果
|
||||
*/
|
||||
|
||||
import { useState, useEffect, useCallback, useRef } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Sparkles } from 'lucide-react'
|
||||
@@ -313,7 +313,7 @@ export function OpenClawPanel({
|
||||
onAnalysisComplete,
|
||||
className,
|
||||
}: OpenClawPanelProps) {
|
||||
const t = useTranslations('ai')
|
||||
const _t = useTranslations('ai')
|
||||
// Phase 8.0 #16: 移除 cursorVisible state,改用 CSS animate-pulse
|
||||
|
||||
const isActive = status !== 'patrolling'
|
||||
|
||||
@@ -20,10 +20,10 @@ import { useState, useEffect, useCallback, useRef } from 'react'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { OpenClawPanel, type OpenClawStatus } from './openclaw-panel'
|
||||
import { ThinkingStream, DEFAULT_THINKING_MESSAGES } from './thinking-stream'
|
||||
import type { ThinkingStream as _ThinkingStream, DEFAULT_THINKING_MESSAGES as _DEFAULT_THINKING_MESSAGES } from './thinking-stream'
|
||||
import { ApprovalCard, type ApprovalRequest } from '@/components/approval/approval-card'
|
||||
import { ApprovalModal } from '@/components/ui/approval-modal'
|
||||
import { RefreshCw, AlertCircle, CheckCircle2, AlertTriangle, Shield, XCircle, ChevronRight } from 'lucide-react'
|
||||
import { RefreshCw, AlertCircle, CheckCircle2, AlertTriangle, ChevronRight } from 'lucide-react'
|
||||
|
||||
// =============================================================================
|
||||
// Types
|
||||
|
||||
@@ -174,7 +174,7 @@ export function ThinkingStream({
|
||||
}: ThinkingStreamProps) {
|
||||
const t = useTranslations()
|
||||
const [currentIndex, setCurrentIndex] = useState(0)
|
||||
const [completedLines, setCompletedLines] = useState<string[]>([])
|
||||
const [_completedLines, setCompletedLines] = useState<string[]>([])
|
||||
const completedRef = useRef(false)
|
||||
|
||||
// Handle line completion
|
||||
|
||||
Reference in New Issue
Block a user