From 2f42e953fa7f3f69c9a62a1c1b12e03716321d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 17 Jul 2026 13:46:34 +0800 Subject: [PATCH] fix lint err --- apps/ai-game-creator-shell/src/App.tsx | 63 ++++++++++--------- .../home/components/RichInputArea/index.tsx | 2 +- .../RichInputArea/richTextToPrompt.tsx | 2 +- .../ai-game-creator-shell/src/view/layout.tsx | 5 +- .../tests/appSurface.test.ts | 14 ++--- .../index.test.tsx | 2 +- .../index.test.tsx | 4 +- .../index.tsx | 7 --- .../image-editor/ImageCanvasEditorView.tsx | 4 +- .../usePlatformProfileCenterController.ts | 2 +- src/components/rpg-entry/RpgEntryHomeView.tsx | 6 +- 11 files changed, 56 insertions(+), 55 deletions(-) diff --git a/apps/ai-game-creator-shell/src/App.tsx b/apps/ai-game-creator-shell/src/App.tsx index d1eb5f9dd..2b650855d 100644 --- a/apps/ai-game-creator-shell/src/App.tsx +++ b/apps/ai-game-creator-shell/src/App.tsx @@ -1,3 +1,23 @@ +/* eslint-disable react-refresh/only-export-components -- Testable pure helpers currently share this legacy app module. */ + +import { + Archive, + ChevronDown, + ChevronUp, + FileText, + FolderKanban, + Gamepad2, + GitFork, + Image, + Pause, + Pencil, + Play, + Plus, + Send, + Target, + Trash2, + Zap, +} from 'lucide-react'; import { type ChangeEvent, type FormEvent, @@ -11,32 +31,7 @@ import { useRef, useState, } from 'react'; -import { - Archive, - Bell, - BookOpen, - ChevronDown, - ChevronUp, - CircleHelp, - Contact, - FileText, - FolderKanban, - Gamepad2, - GitFork, - Home, - Image, - LogOut, - Pause, - Pencil, - Play, - Plus, - Send, - Settings, - Target, - Trash2, - User, - Zap, -} from 'lucide-react'; + import { PlatformMudPointWalletEntry, } from '../../../packages/shared/src/components/PlatformMudPointWalletEntry'; @@ -45,7 +40,6 @@ import { type PlatformProfileRechargeNativePaymentState, } from '../../../packages/shared/src/components/PlatformProfileRechargeModal'; import { PlatformProfileWalletLedgerModal } from '../../../packages/shared/src/components/PlatformProfileWalletLedgerModal'; - import type { AuthEntryResponse, AuthMeResponse, @@ -106,7 +100,7 @@ import HomeView, { type HomeDraft, } from './view/home'; import { useLauncherHomeDraftStore } from './view/home/useHomeDraftStore'; -import { Sidebar, type LauncherView } from './view/layout'; +import { type LauncherView, Sidebar } from './view/layout'; const seedManifest = createGameCreationAppManifest( 'local-project-draft', @@ -4125,6 +4119,8 @@ function RuntimeConfigDialog({ useEffect(() => { void readRuntimeConfig(); + // The dialog reads once on mount; subsequent reads are explicit user actions. + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); function updateRuntimeLlmConfig( @@ -5860,6 +5856,8 @@ export function WorkspaceLauncher({ return; } void loadAgentChatLlmStatus(); + // Reload only when the active launcher selection changes. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [launcherView, agentChatSelectedAgentId]); function validateProjectPath(nextProjectPath: string) { @@ -17259,6 +17257,8 @@ export function App({ ) { cancelUiCommandConfirmation(); } + // The callbacks intentionally read the latest project refs. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [localProject?.projectPath, projectPath]); useEffect(() => { @@ -17284,6 +17284,8 @@ export function App({ return; } void openWorkspace(initialProjectPath, false); + // Initial project opening is guarded by initialProjectOpenedRef. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [initialProjectPath, projectSupervisorOnly]); useEffect(() => { @@ -17507,6 +17509,8 @@ export function App({ disposed = true; window.clearInterval(timer); }; + // Polling restarts only when the tracked runtime identity or phase changes. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ localProject?.projectPath, projectSupervisorSessionId, @@ -17658,6 +17662,9 @@ export function App({ setConversationWriteVersion((current) => current + 1); } }); + // Writes are driven by message and confirmation state; the confirmation helper + // intentionally observes the latest policy refs. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ localProject?.projectPath, messages, diff --git a/apps/ai-game-creator-shell/src/view/home/components/RichInputArea/index.tsx b/apps/ai-game-creator-shell/src/view/home/components/RichInputArea/index.tsx index 5d2bb59cd..f8a36c53e 100644 --- a/apps/ai-game-creator-shell/src/view/home/components/RichInputArea/index.tsx +++ b/apps/ai-game-creator-shell/src/view/home/components/RichInputArea/index.tsx @@ -19,7 +19,7 @@ import { import { Upload } from 'lucide-react'; import React, { useEffect, useRef } from 'react'; -import type { HomeAttachmentDraft, Draft } from '../../useHomeDraftStore'; +import type { Draft, HomeAttachmentDraft } from '../../useHomeDraftStore'; import { $createAttachmentNode, AttachmentNode, diff --git a/apps/ai-game-creator-shell/src/view/home/components/RichInputArea/richTextToPrompt.tsx b/apps/ai-game-creator-shell/src/view/home/components/RichInputArea/richTextToPrompt.tsx index deb92826d..a62bdb291 100644 --- a/apps/ai-game-creator-shell/src/view/home/components/RichInputArea/richTextToPrompt.tsx +++ b/apps/ai-game-creator-shell/src/view/home/components/RichInputArea/richTextToPrompt.tsx @@ -6,7 +6,7 @@ import { type LexicalNode, } from 'lexical'; -import type { HomeAttachmentDraft, Draft } from '../../useHomeDraftStore'; +import type { Draft, HomeAttachmentDraft } from '../../useHomeDraftStore'; import { $isAttachmentNode } from './attachmentNode'; function ordinalSuffix(index: number) { diff --git a/apps/ai-game-creator-shell/src/view/layout.tsx b/apps/ai-game-creator-shell/src/view/layout.tsx index e80140ada..4f3006f57 100644 --- a/apps/ai-game-creator-shell/src/view/layout.tsx +++ b/apps/ai-game-creator-shell/src/view/layout.tsx @@ -1,3 +1,4 @@ +import { openUrl } from '@tauri-apps/plugin-opener'; import { CircleHelp, FolderKanban, @@ -8,9 +9,9 @@ import { } from 'lucide-react'; import { useEffect, useRef, useState } from 'react'; -import { getClientProfileDashboard } from '../services/clientApi'; import BRAND_ICON from '../../../../packages/shared/src/icons/taonier-product-ip.png'; -import { openUrl } from '@tauri-apps/plugin-opener'; +import { getClientProfileDashboard } from '../services/clientApi'; + function cx(...classNames: Array) { return classNames.filter(Boolean).join(' '); } diff --git a/apps/ai-game-creator-shell/tests/appSurface.test.ts b/apps/ai-game-creator-shell/tests/appSurface.test.ts index 487829fa2..d113f5705 100644 --- a/apps/ai-game-creator-shell/tests/appSurface.test.ts +++ b/apps/ai-game-creator-shell/tests/appSurface.test.ts @@ -267,8 +267,8 @@ function createProjectSupervisorRuntimeHarness({ let messageSequence = 0; let steerSequence = 0; let sessionExists = initialSessionExists; - let currentProjectMessages = [...projectMessages]; - let currentSupervisorMessages = [...supervisorMessages]; + const currentProjectMessages = [...projectMessages]; + const currentSupervisorMessages = [...supervisorMessages]; const runtimeState = ( overrides: Record = {}, ): Record => ({ @@ -20050,7 +20050,7 @@ describe('AI 游戏创作 App 界面边界', () => { it('keeps Anthropic web search choices visible when the save gate rejects them', async () => { const invoke = vi.fn( - async (command: string, args?: Record) => { + async (command: string, _args?: Record) => { if (command === 'read_game_creator_app_config') { return { path: '/home/test/AppData/game-creator.config.json', @@ -20187,7 +20187,7 @@ describe('AI 游戏创作 App 界面边界', () => { it('blocks developer file write confirmation when project policy denies it', async () => { const invoke = vi.fn( - async (command: string, args?: Record) => { + async (command: string, _args?: Record) => { if (command === 'append_local_permission_log') { return {}; } @@ -24946,7 +24946,7 @@ describe('AI 游戏创作 App 界面边界', () => { '未命名游戏原型', ); const invoke = vi.fn( - async (command: string, args?: Record) => { + async (command: string, _args?: Record) => { if (command === 'append_local_permission_log') { return {}; } @@ -31149,7 +31149,7 @@ describe('AI 游戏创作 App 界面边界', () => { it('generates platform art assets from the developer asset panel after confirmation', async () => { const invoke = vi.fn( - async (command: string, args?: Record) => { + async (command: string, _args?: Record) => { if (command === 'append_local_permission_log') { return {}; } @@ -31712,7 +31712,7 @@ describe('AI 游戏创作 App 界面边界', () => { | ((value: { url: string }) => void) | undefined; const invoke = vi.fn( - async (command: string, args?: Record) => { + async (command: string, _args?: Record) => { if (command === 'append_local_permission_log') { return {}; } diff --git a/packages/shared/src/components/PlatformProfileRechargeModal/index.test.tsx b/packages/shared/src/components/PlatformProfileRechargeModal/index.test.tsx index aa69e4d46..fe2ff64d1 100644 --- a/packages/shared/src/components/PlatformProfileRechargeModal/index.test.tsx +++ b/packages/shared/src/components/PlatformProfileRechargeModal/index.test.tsx @@ -6,7 +6,7 @@ import { describe, expect, test, vi } from 'vitest'; import type { ProfileRechargeProduct } from '@/packages/shared/src'; -import { PlatformProfileRechargeModal } from '../../index'; +import { PlatformProfileRechargeModal } from './index'; function buildNormalMembership() { return { diff --git a/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx b/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx index a063bdcec..877ab5793 100644 --- a/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx +++ b/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx @@ -5,13 +5,13 @@ import userEvent from '@testing-library/user-event'; import { describe, expect, test, vi } from 'vitest'; import type { ProfileWalletLedgerEntry } from '../../contracts/runtime'; +import { PlatformProfileWalletLedgerModal } from './index'; import { buildWalletLedgerPresentation, formatWalletLedgerAmount, formatWalletLedgerDate, getWalletLedgerSourceLabel, - PlatformProfileWalletLedgerModal, -} from './index'; +} from './model'; function buildLedgerEntry( overrides: Partial = {}, diff --git a/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.tsx b/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.tsx index a733ab079..405a16e41 100644 --- a/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.tsx +++ b/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.tsx @@ -128,10 +128,3 @@ export function PlatformProfileWalletLedgerModal({ ); } - -export { - buildWalletLedgerPresentation, - formatWalletLedgerAmount, - formatWalletLedgerDate, - getWalletLedgerSourceLabel, -} from './model'; diff --git a/src/components/image-editor/ImageCanvasEditorView.tsx b/src/components/image-editor/ImageCanvasEditorView.tsx index cbbab7bc0..da0a539eb 100644 --- a/src/components/image-editor/ImageCanvasEditorView.tsx +++ b/src/components/image-editor/ImageCanvasEditorView.tsx @@ -9,6 +9,8 @@ import { useState, } from 'react'; +import { PlatformProfileRechargeModal } from '../../../packages/shared/src/components/PlatformProfileRechargeModal'; +import { PlatformProfileWalletLedgerModal } from '../../../packages/shared/src/components/PlatformProfileWalletLedgerModal'; import type { EditorAgentGenerationResultEvent } from '../../../packages/shared/src/contracts/editorAgent'; import type { ExternalGenerationTaskRecord } from '../../../packages/shared/src/contracts/externalGeneration'; import { loadFrontendRuntimeConfig } from '../../services/frontendRuntimeConfigService'; @@ -24,8 +26,6 @@ import { shouldShowRechargeEntry } from '../../services/payment/paymentPlatform' import { getPlatformProfileDashboard } from '../../services/platform-entry/platformProfileClient'; import { useAuthUi } from '../auth/AuthUiContext'; import { PlatformDangerConfirmDialog } from '../common/PlatformDangerConfirmDialog'; -import { PlatformProfileRechargeModal } from '../../../packages/shared/src/components/PlatformProfileRechargeModal'; -import { PlatformProfileWalletLedgerModal } from '../../../packages/shared/src/components/PlatformProfileWalletLedgerModal'; import { PlatformProfileRewardCodeRedeemModal } from '../platform-entry/PlatformProfileRewardCodeRedeemModal'; import { PlatformRechargePaymentConfirmationMask, diff --git a/src/components/platform-entry/usePlatformProfileCenterController.ts b/src/components/platform-entry/usePlatformProfileCenterController.ts index 6e5dd11df..67b5172d4 100644 --- a/src/components/platform-entry/usePlatformProfileCenterController.ts +++ b/src/components/platform-entry/usePlatformProfileCenterController.ts @@ -1,5 +1,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import type { PlatformProfileRechargeNativePaymentState } from '../../../packages/shared/src/components/PlatformProfileRechargeModal'; import { type ConfirmWechatProfileRechargeOrderResponse, type ProfileRechargeCenterResponse, @@ -10,7 +11,6 @@ import { type ProfileWalletLedgerResponse, type RedeemProfileRewardCodeResponse, } from '../../../packages/shared/src/contracts/runtime'; -import type { PlatformProfileRechargeNativePaymentState } from '../../../packages/shared/src/components/PlatformProfileRechargeModal'; import { clearStoredAccessToken, refreshStoredAccessToken, diff --git a/src/components/rpg-entry/RpgEntryHomeView.tsx b/src/components/rpg-entry/RpgEntryHomeView.tsx index df74aec8c..4a3e58750 100644 --- a/src/components/rpg-entry/RpgEntryHomeView.tsx +++ b/src/components/rpg-entry/RpgEntryHomeView.tsx @@ -51,6 +51,8 @@ import profileCommunityImage from '../../../media/profile/_Image (7).png'; import profileFeedbackImage from '../../../media/profile/_Image (8).png'; import profileMascotImage from '../../../media/profile/_Image (9).png'; import profilePointImage from '../../../media/profile/_Image.png'; +import { PlatformProfileRechargeModal } from '../../../packages/shared/src/components/PlatformProfileRechargeModal'; +import { PlatformProfileWalletLedgerModal } from '../../../packages/shared/src/components/PlatformProfileWalletLedgerModal'; import type { PublicUserSummary } from '../../../packages/shared/src/contracts/auth'; import type { CustomWorldLibraryEntry, @@ -79,7 +81,6 @@ import { } from '../../services/host-bridge/hostBridge'; import { shouldShowRechargeEntry } from '../../services/payment/paymentPlatform'; import type { CustomWorldProfile } from '../../types'; -import type { PlatformHomeTab } from '../platform-entry/platformEntryTypes'; import { useAuthUi } from '../auth/AuthUiContext'; import { CopyFeedbackButton } from '../common/CopyFeedbackButton'; import { LegalDocumentModal } from '../common/LegalDocumentModal'; @@ -120,6 +121,7 @@ import { isEdutainmentEntryEnabled, } from '../platform-entry/platformEdutainmentVisibility'; import { getInitialPlatformDesktopLayout } from '../platform-entry/platformEntryResponsive'; +import type { PlatformHomeTab } from '../platform-entry/platformEntryTypes'; import type { ExternalGenerationQueueStatus } from '../platform-entry/platformExternalGenerationQueueStatusModel'; import { PlatformProfileApiKeysModal } from '../platform-entry/PlatformProfileApiKeysModal'; import { PlatformProfileGenerationQueueCard } from '../platform-entry/PlatformProfileGenerationQueueCard'; @@ -133,8 +135,6 @@ import { ProfileStatCardSkeleton, } from '../platform-entry/PlatformProfilePrimitives'; import { PlatformProfileQrScannerModal } from '../platform-entry/PlatformProfileQrScannerModal'; -import { PlatformProfileRechargeModal } from '../../../packages/shared/src/components/PlatformProfileRechargeModal'; -import { PlatformProfileWalletLedgerModal } from '../../../packages/shared/src/components/PlatformProfileWalletLedgerModal'; import { PlatformProfileReferralModal } from '../platform-entry/PlatformProfileReferralModal'; import { PlatformProfileRewardCodeRedeemModal } from '../platform-entry/PlatformProfileRewardCodeRedeemModal'; import {