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:
OG T
2026-03-29 17:06:58 +08:00
parent 5cad3707ee
commit 2e9ccf4a26
24 changed files with 62 additions and 58 deletions

View File

@@ -11,7 +11,7 @@
* - HITLSection: AI 思考流 → 動態卡片對接
*/
import { useCallback, useState } from 'react'
import { useCallback, useMemo, useState } from 'react'
import { useTranslations } from 'next-intl'
import { AppLayout } from '@/components/layout'
import { LiveDashboard } from '@/components/dashboard/live-dashboard'
@@ -92,11 +92,11 @@ export default function DemoPage({ params }: { params: { locale: string } }) {
const tDryRun = useTranslations('dryRun')
const locale = params.locale
const [isCreating, setIsCreating] = useState(false)
const [_isCreating, setIsCreating] = useState(false)
const [createError, setCreateError] = useState<string | null>(null)
// i18n-aware approval creation configs
const approvalConfigs = {
// i18n-aware approval creation configs (memoized to prevent re-render dependency issues)
const approvalConfigs = useMemo(() => ({
low: {
action: tMock('testActions.lowAction'),
description: tMock('testActions.lowDesc'),
@@ -127,9 +127,9 @@ export default function DemoPage({ params }: { params: { locale: string } }) {
backupMessage: tDryRun('noRecentBackup'),
okMessage: tDryRun('ok'),
},
}
}), [tMock, tDryRun])
const handleCreateApproval = useCallback(async (riskLevel: 'low' | 'medium' | 'critical') => {
const _handleCreateApproval = useCallback(async (riskLevel: 'low' | 'medium' | 'critical') => {
setIsCreating(true)
setCreateError(null)
try {

View File

@@ -30,7 +30,7 @@ export function generateStaticParams() {
}
export async function generateMetadata({
params: { locale },
params: { locale: _locale },
}: {
params: { locale: Locale }
}): Promise<Metadata> {

View File

@@ -20,16 +20,13 @@
import { useTranslations } from 'next-intl'
import { AppLayout } from '@/components/layout'
import { LiveDashboard } from '@/components/dashboard/live-dashboard'
import { DataPincerCard, DataPincerPanel } from '@/components/cyber'
import { DataPincerPanel } from '@/components/cyber'
import { OpenClawStateMachine } from '@/components/ai/openclaw-state-machine'
import { GlobalPulseChart } from '@/components/charts/global-pulse-chart'
import { useGlobalPulseMetrics } from '@/hooks/useGlobalPulseMetrics'
import { useIncidents } from '@/hooks/useIncidents'
import type { DecisionInfo } from '@/lib/api-client'
import {
IncidentCard,
IncidentCardGrid,
IncidentEmptyState,
ThinkingTerminal,
DualStateIncidentCard,
} from '@/components/incident'
@@ -68,7 +65,7 @@ function convertToDecisionChain(
const data = incident.decision.proposal_data
const target = incident.affected_services?.[0] || 'unknown-service'
const source = data.source || 'unknown'
const now = new Date().toISOString()
const _now = new Date().toISOString()
// 建構推理步驟 (從 API 資料)
const steps: ReasoningStep[] = [
@@ -215,7 +212,7 @@ export default function Home({ params }: { params: { locale: string } }) {
// Phase 7: 真實 Incident 數據
const {
incidents,
pendingApprovals,
pendingApprovals: _pendingApprovals,
isLoading: isIncidentsLoading,
error: incidentsError,
} = useIncidents({

View File

@@ -14,7 +14,7 @@
* @see project_sentry_full_integration.md
*/
import { NextRequest, NextResponse } from 'next/server';
import { type NextRequest, NextResponse } from 'next/server';
// Sentry Self-Hosted 內網地址
const SENTRY_HOST = 'http://192.168.0.110:9000';