TypeScript
chore(lint): React effects can't grow past each file's budget (#24964)
Julius Marminge762b047f673a
diff --git a/AGENTS.md b/AGENTS.mdindex 3a6e2a957d7..a0a1f949faa 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -194,6 +194,7 @@ Architecture and its constraints: `docs/internals/overview.md`. Glossary: `docs/options, and pass combinators as additional function-builder arguments.- Inferred types over annotations. `any` is the enemy.- Default to no comment. Write one only for a constraint, an external quirk, or an invariant the code can't show, in one line where you can and four at most. Don't restate names or signatures, narrate steps, record history, or explain the fix you just made; the PR carries that. `t3code/no-low-value-comments` enforces the length cap and the mechanical cases.+- React effects are a last resort: derive in render, act in handlers, reset with `key`, or use a ref callback or store. The `t3code/react-effect-budget` lint rule holds each file to its entry in `scripts/effect-budget.json`; raise an entry only in the PR that needs the effect, and lower it when you remove one.- Our users drive agents all day and notice a dropped frame, a lying spinner, and a stale label. No continuously repainting animations; they peg the GPU on high-refresh displays.- If a rule here fights the task in front of you, say so loudly and get a human sign-off before breaking it.diff --git a/oxlint-plugin-t3code/index.ts b/oxlint-plugin-t3code/index.tsindex acae1e75258..cf9c614c403 100644--- a/oxlint-plugin-t3code/index.ts+++ b/oxlint-plugin-t3code/index.ts@@ -15,6 +15,7 @@ import noMobileUniwindThemeEscapeHatches from "./rules/no-mobile-uniwind-theme-eimport noAmbiguousDetailNavigation from "./rules/no-ambiguous-detail-navigation.ts";import noMobilePullRequestGlyphLiterals from "./rules/no-mobile-pull-request-glyph-literals.ts";import noNativeTitleTooltip from "./rules/no-native-title-tooltip.ts";+import reactEffectBudget from "./rules/react-effect-budget.ts";import requireRegisteredListScroll from "./rules/require-registered-list-scroll.ts";import noOutsetStateIndicators from "./rules/no-outset-state-indicators.ts";import noPollingLoopInTests from "./rules/no-polling-loop-in-tests.ts";@@ -52,6 +53,7 @@ export default definePlugin({"no-ambiguous-detail-navigation": noAmbiguousDetailNavigation,"no-mobile-pull-request-glyph-literals": noMobilePullRequestGlyphLiterals,"no-native-title-tooltip": noNativeTitleTooltip,+ "react-effect-budget": reactEffectBudget,"require-registered-list-scroll": requireRegisteredListScroll,"no-outset-state-indicators": noOutsetStateIndicators,"no-polling-loop-in-tests": noPollingLoopInTests,diff --git a/oxlint-plugin-t3code/rules/react-effect-budget.test.ts b/oxlint-plugin-t3code/rules/react-effect-budget.test.tsnew file mode 100644index 00000000000..b1cba759d18--- /dev/null+++ b/oxlint-plugin-t3code/rules/react-effect-budget.test.ts@@ -0,0 +1,50 @@+import { assert, describe } from "@effect/vitest";++import budget from "../../scripts/effect-budget.json" with { type: "json" };+import { createOxlintRuleHarness } from "../test/utils.ts";++const [budgetedFile, allowed] = Object.entries(budget)[0]!;++const component = (effects: number) => `import React, { useEffect } from "react";+export function Panel() {+${Array.from({ length: effects }, (_, index) => (index % 2 === 0 ? " useEffect(() => {}, []);" : " React.useLayoutEffect(() => {});")).join("\n")}+ return null;+}+`;++const reports = (output: string) => output.match(/t3code\(react-effect-budget\)/g)?.length ?? 0;+const lint = (filename: string) =>+ createOxlintRuleHarness("t3code/react-effect-budget", { filename });++const budgeted = lint(budgetedFile);+const unbudgeted = lint("apps/web/src/NotInTheBudget.tsx");++describe("t3code/react-effect-budget", () => {+ budgeted.valid("passes a file at its budget", component(allowed));++ budgeted.invalid("reports only the calls past the budget", component(allowed + 2), (output) => {+ assert.strictEqual(reports(output), 2);+ assert.include(output, `has ${allowed + 2} React effects against a budget of ${allowed}`);+ });++ unbudgeted.invalid(+ "gives a file without an entry a budget of 0, counting member calls",+ `export function New() { React.useEffect(() => {}); return null; }`,+ (output) => {+ assert.strictEqual(reports(output), 1);+ assert.include(output, "has 1 React effect against a budget of 0");+ },+ );++ unbudgeted.valid(+ "ignores comments, strings and lookalike names",+ `// useEffect(() => {}) in a comment+/* React.useLayoutEffect(() => {}) */+const label = "useEffect(() => {})";+const pipeline = Effect.matchCauseEffect(effect, {});+const alias = useEffect;+`,+ );++ lint("apps/web/src/Panel.test.tsx").valid("skips test files", component(3));+});diff --git a/oxlint-plugin-t3code/rules/react-effect-budget.ts b/oxlint-plugin-t3code/rules/react-effect-budget.tsnew file mode 100644index 00000000000..3974eb6e7b9--- /dev/null+++ b/oxlint-plugin-t3code/rules/react-effect-budget.ts@@ -0,0 +1,58 @@+import { defineRule, type ESTree } from "@oxlint/plugins";+import * as Option from "effect/Option";++import budget from "../../scripts/effect-budget.json" with { type: "json" };+import { getPropertyName, unwrapExpression } from "../utils.ts";++const BUDGET_FILE = "scripts/effect-budget.json";+const EFFECT_HOOKS = new Set(["useEffect", "useLayoutEffect", "useInsertionEffect"]);+const EFFECT_HOOK_TEXT = /use(?:Layout|Insertion)?Effect/;+const UNBUDGETED_FILE = /\.test\.[cm]?[jt]sx?$|[\\/](?:test|__tests__)[\\/]/;+const budgets: Readonly<Record<string, number>> = budget;++const isEffectHookCall = (node: ESTree.CallExpression): boolean => {+ const callee = unwrapExpression(node.callee);+ if (Option.isNone(callee)) return false;+ const expression = callee.value;+ if (expression.type === "Identifier") return EFFECT_HOOKS.has(expression.name);+ if (expression.type === "MemberExpression" && !expression.computed) {+ return Option.exists(getPropertyName(expression.property), (name) => EFFECT_HOOKS.has(name));+ }+ return false;+};++// Budget keys are repo-relative; matching on the path's end also works for files linted elsewhere.+const budgetFor = (filename: string): number => {+ const normalized = filename.replaceAll("\\", "/");+ const key = Object.keys(budgets).find((file) => normalized.endsWith(`/${file}`));+ return key === undefined ? 0 : budgets[key]!;+};++export default defineRule({+ meta: {+ type: "suggestion",+ docs: {+ description: `Hold each file to the React effect hooks it is allowed in ${BUDGET_FILE}; a missing entry allows none.`,+ },+ },+ create(context) {+ if (UNBUDGETED_FILE.test(context.filename) || !EFFECT_HOOK_TEXT.test(context.sourceCode.text)) {+ return {};+ }+ const calls: Array<ESTree.CallExpression> = [];+ return {+ CallExpression(node) {+ if (isEffectHookCall(node)) calls.push(node);+ },+ "Program:exit"() {+ const allowed = budgetFor(context.filename);+ if (calls.length <= allowed) return;+ const message =+ `This file has ${calls.length} React ${calls.length === 1 ? "effect" : "effects"} against a budget of ${allowed}. ` ++ "Prefer deriving in render, event handlers, a `key` reset, an element-owned ref callback, or a store. " ++ `If an effect is genuinely right, raise this file's entry in ${BUDGET_FILE} in the same PR.`;+ for (const node of calls.slice(allowed)) context.report({ node, message });+ },+ };+ },+});diff --git a/scripts/effect-budget.json b/scripts/effect-budget.jsonnew file mode 100644index 00000000000..44c55fb2752--- /dev/null+++ b/scripts/effect-budget.json@@ -0,0 +1,433 @@+{+ "apps/mobile/src/App.tsx": 2,+ "apps/mobile/src/Stack.tsx": 1,+ "apps/mobile/src/components/ComposerAttachmentStrip.tsx": 2,+ "apps/mobile/src/components/ComposerContextAttachment.tsx": 1,+ "apps/mobile/src/components/ComposerEditor.tsx": 2,+ "apps/mobile/src/components/FilePreview.ios.tsx": 1,+ "apps/mobile/src/components/FilePreview.tsx": 1,+ "apps/mobile/src/components/FilePreviewModal.tsx": 5,+ "apps/mobile/src/components/MediaVideoPlayer.tsx": 3,+ "apps/mobile/src/components/PdfPreview.android.tsx": 1,+ "apps/mobile/src/components/ProjectFavicon.tsx": 1,+ "apps/mobile/src/components/VideoPreviewModal.ios.tsx": 6,+ "apps/mobile/src/components/VideoPreviewModal.tsx": 3,+ "apps/mobile/src/components/VideoThumbnailImage.tsx": 1,+ "apps/mobile/src/components/ui/AndroidAnchoredMenu.tsx": 1,+ "apps/mobile/src/components/ui/AppBar.android.tsx": 1,+ "apps/mobile/src/components/ui/Dialog.android.tsx": 1,+ "apps/mobile/src/components/ui/Notice.tsx": 1,+ "apps/mobile/src/components/ui/OverlayPortal.tsx": 3,+ "apps/mobile/src/components/ui/SliderRow.android.tsx": 1,+ "apps/mobile/src/components/ui/SliderRow.tsx": 1,+ "apps/mobile/src/components/ui/Toast.tsx": 2,+ "apps/mobile/src/features/agent-awareness/notificationNavigation.ts": 3,+ "apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx": 2,+ "apps/mobile/src/features/browser/PreviewStreamWebView.tsx": 5,+ "apps/mobile/src/features/browser/ThreadBrowserFloat.tsx": 2,+ "apps/mobile/src/features/cloud/CloudAuthProvider.tsx": 3,+ "apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx": 1,+ "apps/mobile/src/features/cloud/connectOnboardingNavigation.ts": 1,+ "apps/mobile/src/features/cloud/managedRelayState.ts": 1,+ "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx": 5,+ "apps/mobile/src/features/connection/PermissionUpdateNotice.tsx": 2,+ "apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx": 6,+ "apps/mobile/src/features/devices/DeviceStreamWebView.tsx": 2,+ "apps/mobile/src/features/diagnostics/SettingsDiagnosticsRouteScreen.tsx": 1,+ "apps/mobile/src/features/diffs/nativeReviewDiffSurface.ts": 3,+ "apps/mobile/src/features/files/AttachmentFileScreen.tsx": 1,+ "apps/mobile/src/features/files/AudioFilePreview.tsx": 2,+ "apps/mobile/src/features/files/FileTreeBrowser.tsx": 3,+ "apps/mobile/src/features/files/FilesHeader.tsx": 1,+ "apps/mobile/src/features/files/SourceFileSurface.tsx": 1,+ "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx": 1,+ "apps/mobile/src/features/files/WorkspaceFileWebPreview.tsx": 1,+ "apps/mobile/src/features/files/useFileTreeEntries.ts": 1,+ "apps/mobile/src/features/home/HomeRouteScreen.tsx": 2,+ "apps/mobile/src/features/home/HomeScreen.tsx": 4,+ "apps/mobile/src/features/home/ThreadListToolbar.tsx": 1,+ "apps/mobile/src/features/home/WorkspaceConnectionTitle.tsx": 2,+ "apps/mobile/src/features/home/home-list-options.ts": 1,+ "apps/mobile/src/features/home/home-route-visibility.ts": 1,+ "apps/mobile/src/features/home/thread-swipe-actions.tsx": 5,+ "apps/mobile/src/features/keyboard/CommandPalette.tsx": 2,+ "apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx": 1,+ "apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts": 1,+ "apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx": 3,+ "apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx": 1,+ "apps/mobile/src/features/layout/workspace-inspector-pane.tsx": 2,+ "apps/mobile/src/features/projects/AddProjectScreen.tsx": 2,+ "apps/mobile/src/features/prompt-links/usePromptLinkResolver.ts": 1,+ "apps/mobile/src/features/prompt-links/useThreadPromptLink.ts": 1,+ "apps/mobile/src/features/pull-requests/PullRequestFilterMenuContext.tsx": 1,+ "apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx": 1,+ "apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx": 4,+ "apps/mobile/src/features/pull-requests/PullRequestToolbar.android.tsx": 1,+ "apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx": 1,+ "apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx": 1,+ "apps/mobile/src/features/pull-requests/usePullRequestDiff.ts": 1,+ "apps/mobile/src/features/pull-requests/usePullRequestEnvironmentFallback.ts": 1,+ "apps/mobile/src/features/pull-requests/usePullRequestFilesViewed.ts": 4,+ "apps/mobile/src/features/pull-requests/usePullRequestList.ts": 3,+ "apps/mobile/src/features/pull-requests/usePullRequestReviewDraft.ts": 1,+ "apps/mobile/src/features/review/ReviewSheet.tsx": 1,+ "apps/mobile/src/features/review/useNativeReviewDiffHighlighting.ts": 2,+ "apps/mobile/src/features/review/useReviewCommentSelectionController.ts": 2,+ "apps/mobile/src/features/review/useReviewDiffData.ts": 2,+ "apps/mobile/src/features/review/useReviewDiffPrewarming.ts": 1,+ "apps/mobile/src/features/review/useReviewSections.ts": 5,+ "apps/mobile/src/features/settings/OutdatedServerUpdateSection.tsx": 1,+ "apps/mobile/src/features/settings/SettingsAboutRouteScreen.tsx": 1,+ "apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx": 2,+ "apps/mobile/src/features/settings/SettingsEnvironmentDetailRouteScreen.tsx": 1,+ "apps/mobile/src/features/settings/SettingsMicrophoneRouteScreen.tsx": 1,+ "apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx": 2,+ "apps/mobile/src/features/settings/SettingsProjectOverviewRouteScreen.tsx": 1,+ "apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx": 2,+ "apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx": 2,+ "apps/mobile/src/features/settings/components/BranchNamingSettings.tsx": 1,+ "apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx": 1,+ "apps/mobile/src/features/sharing/IncomingShareProvider.tsx": 4,+ "apps/mobile/src/features/shortcuts/useAppShortcuts.ts": 4,+ "apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx": 11,+ "apps/mobile/src/features/terminal/NativeTerminalSurface.tsx": 4,+ "apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx": 14,+ "apps/mobile/src/features/terminal/terminalLaunchContext.ts": 1,+ "apps/mobile/src/features/terminal/useTerminalGridSync.ts": 1,+ "apps/mobile/src/features/terminal/useTerminalLifecycle.ts": 1,+ "apps/mobile/src/features/threads/ComposerPopoverAnchor.android.tsx": 2,+ "apps/mobile/src/features/threads/ComposerPopoverAnchor.tsx": 1,+ "apps/mobile/src/features/threads/CopyTextButton.tsx": 1,+ "apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx": 1,+ "apps/mobile/src/features/threads/GitActionProgressOverlay.tsx": 1,+ "apps/mobile/src/features/threads/HtmlRenderWebView.tsx": 1,+ "apps/mobile/src/features/threads/McpAppFullscreenScreen.tsx": 1,+ "apps/mobile/src/features/threads/McpAppWebView.tsx": 7,+ "apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx": 2,+ "apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx": 5,+ "apps/mobile/src/features/threads/NewTaskDraftScreen.tsx": 10,+ "apps/mobile/src/features/threads/NewTaskRouteScreen.tsx": 1,+ "apps/mobile/src/features/threads/QuestionAttachments.tsx": 2,+ "apps/mobile/src/features/threads/ThreadAgentsSheet.tsx": 1,+ "apps/mobile/src/features/threads/ThreadArrangementSheet.tsx": 3,+ "apps/mobile/src/features/threads/ThreadComposer.tsx": 6,+ "apps/mobile/src/features/threads/ThreadDetailScreen.tsx": 20,+ "apps/mobile/src/features/threads/ThreadFeed.tsx": 14,+ "apps/mobile/src/features/threads/ThreadGuestShareBar.tsx": 1,+ "apps/mobile/src/features/threads/ThreadInlineFilePreview.tsx": 2,+ "apps/mobile/src/features/threads/ThreadMarkdownImage.tsx": 3,+ "apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx": 3,+ "apps/mobile/src/features/threads/ThreadQueueControl.tsx": 2,+ "apps/mobile/src/features/threads/ThreadRouteScreen.tsx": 2,+ "apps/mobile/src/features/threads/ThreadScreenHost.tsx": 2,+ "apps/mobile/src/features/threads/ThreadSettingsSheet.tsx": 2,+ "apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx": 1,+ "apps/mobile/src/features/threads/floating-working-control.tsx": 2,+ "apps/mobile/src/features/threads/git/GitOverviewSheet.tsx": 1,+ "apps/mobile/src/features/threads/new-task-flow-provider.tsx": 6,+ "apps/mobile/src/features/threads/thread-inspector-content-stack.tsx": 1,+ "apps/mobile/src/features/threads/thread-list-v2-items.tsx": 1,+ "apps/mobile/src/features/threads/thread-subagent-group.tsx": 2,+ "apps/mobile/src/features/threads/thread-work-log.tsx": 5,+ "apps/mobile/src/features/threads/use-composer-command-menu.ts": 5,+ "apps/mobile/src/features/threads/use-thread-settings-sheet-presentation.ts": 2,+ "apps/mobile/src/features/threads/use-visible-second-clock.ts": 2,+ "apps/mobile/src/features/threads/use-worktree-setup.ts": 1,+ "apps/mobile/src/features/threads/useFileChipShare.ts": 2,+ "apps/mobile/src/features/usage/UsageLimitsSection.tsx": 1,+ "apps/mobile/src/features/usage/UsageRouteScreen.tsx": 1,+ "apps/mobile/src/features/voice-input/ComposerDictationControl.tsx": 3,+ "apps/mobile/src/features/voice-input/GlobalVoiceInputControl.tsx": 2,+ "apps/mobile/src/features/voice-input/VoiceInputProvider.tsx": 4,+ "apps/mobile/src/features/voice-input/useVoiceInputController.ts": 1,+ "apps/mobile/src/features/workspace/AndroidWorkspaceTabsProvider.tsx": 1,+ "apps/mobile/src/features/workspace/WorkspaceNativeTabs.ios.tsx": 1,+ "apps/mobile/src/features/workspace/WorkspaceTabsContext.tsx": 1,+ "apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx": 1,+ "apps/mobile/src/features/workspace/WorkspaceToolbar.tsx": 2,+ "apps/mobile/src/lib/attachmentDocument.ts": 4,+ "apps/mobile/src/lib/useDelayedStatus.ts": 2,+ "apps/mobile/src/lib/useUiRuntimeMemoryWarningGc.ts": 1,+ "apps/mobile/src/lib/videoAudioSession.ts": 1,+ "apps/mobile/src/native/NativeHeaderToolbar.tsx": 2,+ "apps/mobile/src/native/NativeWorkspaceColumns.ios.tsx": 1,+ "apps/mobile/src/native/StackHeader.tsx": 2,+ "apps/mobile/src/native/T3ComposerEditor.ios.tsx": 2,+ "apps/mobile/src/native/T3ComposerEditor.native.tsx": 2,+ "apps/mobile/src/native/V5StackHeader.ios.tsx": 1,+ "apps/mobile/src/native/useRetryingImageSource.ts": 1,+ "apps/mobile/src/state/composer-attachment-uploads.ts": 2,+ "apps/mobile/src/state/mediaActions.ts": 1,+ "apps/mobile/src/state/olderSettledShelf.ts": 2,+ "apps/mobile/src/state/queries.ts": 2,+ "apps/mobile/src/state/thread-order.ts": 1,+ "apps/mobile/src/state/threads.ts": 1,+ "apps/mobile/src/state/use-composer-attachment-actions.ts": 1,+ "apps/mobile/src/state/use-composer-drafts.ts": 3,+ "apps/mobile/src/state/use-pull-to-refresh.ts": 1,+ "apps/mobile/src/state/use-selected-thread-git-actions.ts": 1,+ "apps/mobile/src/state/use-selected-thread-requests.ts": 2,+ "apps/mobile/src/state/use-thread-composer-state.ts": 3,+ "apps/mobile/src/state/use-thread-outbox-drain.ts": 4,+ "apps/mobile/src/state/use-thread-pr.ts": 1,+ "apps/mobile/src/state/use-vcs-action-state.ts": 1,+ "apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx": 1,+ "apps/mobile/src/widgets/useSubscriptionUsage.ts": 1,+ "apps/web/src/AppRoot.tsx": 1,+ "apps/web/src/browser/BrowserProfileReporter.tsx": 1,+ "apps/web/src/browser/BrowserSurfaceSlot.tsx": 2,+ "apps/web/src/browser/ElectronBrowserHost.tsx": 3,+ "apps/web/src/browser/HostedBrowserWebview.tsx": 6,+ "apps/web/src/browser/ServerBrowserSurface.tsx": 5,+ "apps/web/src/browser/useBrowserViewportResize.ts": 2,+ "apps/web/src/cloud/managedAuth.tsx": 2,+ "apps/web/src/cloud/managedRelayState.ts": 2,+ "apps/web/src/components/AddProjectToMachineDialog.tsx": 1,+ "apps/web/src/components/AnimatedHeight.tsx": 2,+ "apps/web/src/components/AnimatedWidth.tsx": 1,+ "apps/web/src/components/AppSidebarLayout.tsx": 4,+ "apps/web/src/components/BackgroundThreadAnnouncer.tsx": 1,+ "apps/web/src/components/BranchPicker.tsx": 2,+ "apps/web/src/components/BranchToolbar.tsx": 4,+ "apps/web/src/components/BranchToolbarBranchSelector.tsx": 1,+ "apps/web/src/components/ChatMarkdown.tsx": 1,+ "apps/web/src/components/ChatView.tsx": 23,+ "apps/web/src/components/CommandPalette.tsx": 5,+ "apps/web/src/components/CommandPaletteContent.tsx": 1,+ "apps/web/src/components/ComposerPromptEditorTiptap.tsx": 13,+ "apps/web/src/components/ConfirmDialogHost.tsx": 1,+ "apps/web/src/components/CustomSnoozeDialog.tsx": 1,+ "apps/web/src/components/DiffPanel.tsx": 4,+ "apps/web/src/components/DiffWorkerPoolProvider.tsx": 2,+ "apps/web/src/components/GitActionsControl.tsx": 4,+ "apps/web/src/components/HostFreezeToastCoordinator.tsx": 1,+ "apps/web/src/components/LegacySidebar.tsx": 5,+ "apps/web/src/components/LegacyThreadMigrationToast.tsx": 2,+ "apps/web/src/components/PermissionUpdateNotice.tsx": 1,+ "apps/web/src/components/PersistentThreadTerminals.tsx": 1,+ "apps/web/src/components/ProjectCloneToastCoordinator.tsx": 2,+ "apps/web/src/components/PullRequestThreadDialog.tsx": 1,+ "apps/web/src/components/QuitHoldOverlay.tsx": 1,+ "apps/web/src/components/ReopenClosedViewShortcut.tsx": 2,+ "apps/web/src/components/RightPanelTabs.tsx": 5,+ "apps/web/src/components/Sidebar.logic.ts": 2,+ "apps/web/src/components/Sidebar.pointer.ts": 1,+ "apps/web/src/components/Sidebar.tsx": 10,+ "apps/web/src/components/SlowRpcRequestToastCoordinator.tsx": 2,+ "apps/web/src/components/ThreadNotificationCoordinator.tsx": 5,+ "apps/web/src/components/ThreadRouteView.tsx": 5,+ "apps/web/src/components/ThreadTerminalDrawer.tsx": 13,+ "apps/web/src/components/auth/ConnectAgentSurface.tsx": 1,+ "apps/web/src/components/auth/PairingRouteSurface.tsx": 2,+ "apps/web/src/components/chat/AgentElapsed.tsx": 1,+ "apps/web/src/components/chat/AssistantCitationChip.tsx": 2,+ "apps/web/src/components/chat/AssistantCitationSource.tsx": 1,+ "apps/web/src/components/chat/AssistantSelectionToolbar.tsx": 2,+ "apps/web/src/components/chat/ChangedFilesTree.tsx": 1,+ "apps/web/src/components/chat/ChatCanvas.tsx": 1,+ "apps/web/src/components/chat/ChatComposer.tsx": 26,+ "apps/web/src/components/chat/ChatHeader.tsx": 2,+ "apps/web/src/components/chat/ChatMarkdownMedia.tsx": 1,+ "apps/web/src/components/chat/ChatOverlayHosts.tsx": 1,+ "apps/web/src/components/chat/CommandOutputPanel.tsx": 1,+ "apps/web/src/components/chat/ComposerAttachmentStrip.tsx": 1,+ "apps/web/src/components/chat/ComposerBannerStack.tsx": 3,+ "apps/web/src/components/chat/ComposerCommandMenu.tsx": 1,+ "apps/web/src/components/chat/ComposerCommandMenuLayer.tsx": 1,+ "apps/web/src/components/chat/ComposerImageThumbnail.tsx": 1,+ "apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx": 2,+ "apps/web/src/components/chat/ComposerStashMenu.tsx": 2,+ "apps/web/src/components/chat/DraftHeroHeadline.tsx": 1,+ "apps/web/src/components/chat/DraftHeroProjectHeading.tsx": 1,+ "apps/web/src/components/chat/ExpandedImageDialog.tsx": 4,+ "apps/web/src/components/chat/HtmlRenderFrame.tsx": 3,+ "apps/web/src/components/chat/MarkdownCodeBlock.tsx": 3,+ "apps/web/src/components/chat/MarkdownTable.tsx": 3,+ "apps/web/src/components/chat/McpAppFrame.tsx": 10,+ "apps/web/src/components/chat/MermaidDiagram.tsx": 1,+ "apps/web/src/components/chat/MessagesTimeline.tsx": 10,+ "apps/web/src/components/chat/ModelPickerContent.tsx": 4,+ "apps/web/src/components/chat/ModelPickerSidebar.tsx": 1,+ "apps/web/src/components/chat/OpenInPicker.tsx": 1,+ "apps/web/src/components/chat/OpenInPickerShortcut.ts": 1,+ "apps/web/src/components/chat/PierreEntryIcon.tsx": 1,+ "apps/web/src/components/chat/ProviderModelPicker.tsx": 1,+ "apps/web/src/components/chat/ProviderSubagentBar.tsx": 1,+ "apps/web/src/components/chat/ThreadActivityAnnouncer.tsx": 1,+ "apps/web/src/components/chat/ThreadDetailsCard.tsx": 4,+ "apps/web/src/components/chat/ThreadFindBar.tsx": 1,+ "apps/web/src/components/chat/ThreadFindProvider.tsx": 1,+ "apps/web/src/components/chat/ThreadTimeline.tsx": 1,+ "apps/web/src/components/chat/ThreadVisitWatermark.tsx": 2,+ "apps/web/src/components/chat/TimelineMinimap.tsx": 1,+ "apps/web/src/components/chat/TimelineWorkGroupRows.tsx": 3,+ "apps/web/src/components/chat/UsageLimitRecoveryBanner.tsx": 1,+ "apps/web/src/components/chat/WorkLog.tsx": 1,+ "apps/web/src/components/chat/WorktreeSetupCard.tsx": 1,+ "apps/web/src/components/chat/ZoomableImage.tsx": 3,+ "apps/web/src/components/chat/composerContextUndo.ts": 1,+ "apps/web/src/components/chat/threadContextDrag.ts": 1,+ "apps/web/src/components/chat/threadFindHighlights.ts": 3,+ "apps/web/src/components/chat/useAssistantCitationTarget.ts": 2,+ "apps/web/src/components/chat/useAttachmentPreviewHandoff.ts": 4,+ "apps/web/src/components/chat/useChatShortcuts.ts": 1,+ "apps/web/src/components/chat/useComposerCommandKey.ts": 1,+ "apps/web/src/components/chat/useComposerMultilinePrompt.ts": 1,+ "apps/web/src/components/chat/useComposerRestingTransition.ts": 5,+ "apps/web/src/components/chat/useComposerSend.ts": 1,+ "apps/web/src/components/chat/useComposerStash.ts": 2,+ "apps/web/src/components/chat/useComposerTypingGuard.ts": 1,+ "apps/web/src/components/chat/useDraftEnvironmentRouting.ts": 3,+ "apps/web/src/components/chat/useDraftHeroLayoutTransition.ts": 1,+ "apps/web/src/components/chat/usePasteToFocusComposer.ts": 1,+ "apps/web/src/components/chat/usePendingThreadRequests.ts": 2,+ "apps/web/src/components/chat/useProviderWorkspaceSnapshotRefresh.ts": 2,+ "apps/web/src/components/chat/useQueuedRunEdit.ts": 1,+ "apps/web/src/components/chat/useRestingComposerControlsLayout.ts": 1,+ "apps/web/src/components/chat/useRightPanelActions.ts": 1,+ "apps/web/src/components/chat/useSystemComposerBanners.tsx": 1,+ "apps/web/src/components/chat/useThreadFind.ts": 6,+ "apps/web/src/components/chat/useThreadFindNavigation.ts": 5,+ "apps/web/src/components/chat/useThreadFindPositionReader.ts": 1,+ "apps/web/src/components/chat/useThreadLifecycle.tsx": 1,+ "apps/web/src/components/chat/useTimelineFollow.ts": 6,+ "apps/web/src/components/chat/useTimelinePositionRestore.ts": 2,+ "apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx": 3,+ "apps/web/src/components/cloud/ConnectCliAuthSurface.tsx": 1,+ "apps/web/src/components/contextChipParts.tsx": 1,+ "apps/web/src/components/desktop/DesktopAppActivationCoordinator.tsx": 1,+ "apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx": 1,+ "apps/web/src/components/desktop/SnapShotCoordinator.tsx": 2,+ "apps/web/src/components/desktop/SshPasswordPromptDialog.tsx": 3,+ "apps/web/src/components/device/DeviceAndroidFoldControls.tsx": 2,+ "apps/web/src/components/device/DeviceDuoViewport.tsx": 4,+ "apps/web/src/components/device/DevicePanel.tsx": 1,+ "apps/web/src/components/device/DevicePhoneViewport.tsx": 3,+ "apps/web/src/components/device/DeviceSetup.tsx": 1,+ "apps/web/src/components/device/DeviceStreamView.tsx": 4,+ "apps/web/src/components/device/DeviceToolsPanel.tsx": 1,+ "apps/web/src/components/device/DeviceWorkspace.tsx": 1,+ "apps/web/src/components/device/useDeviceControls.ts": 2,+ "apps/web/src/components/diffs/DiffCommentAnnotation.tsx": 1,+ "apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx": 1,+ "apps/web/src/components/diffs/DiffFileTree.tsx": 3,+ "apps/web/src/components/diffs/useCodeViewFileReveal.ts": 1,+ "apps/web/src/components/diffs/useReviewFilePatches.ts": 1,+ "apps/web/src/components/files/AttachmentFilePreview.tsx": 3,+ "apps/web/src/components/files/BrowserDocumentFrame.tsx": 7,+ "apps/web/src/components/files/FileBrowserPanel.tsx": 9,+ "apps/web/src/components/files/FilePreviewPanel.tsx": 3,+ "apps/web/src/components/files/useDirectoryEntries.ts": 1,+ "apps/web/src/components/files/useFileSaveCoordinator.ts": 2,+ "apps/web/src/components/guest/GuestHtmlRender.tsx": 3,+ "apps/web/src/components/guest/GuestPage.tsx": 7,+ "apps/web/src/components/media/AttachmentImage.tsx": 1,+ "apps/web/src/components/media/MediaVideoPlayer.tsx": 2,+ "apps/web/src/components/onboarding/FirstRunGate.tsx": 3,+ "apps/web/src/components/onboarding/WelcomeWizard.tsx": 7,+ "apps/web/src/components/permissions/usePermissionStatus.ts": 1,+ "apps/web/src/components/preview/AgentBrowserCursor.tsx": 1,+ "apps/web/src/components/preview/PreviewChromeRow.tsx": 1,+ "apps/web/src/components/preview/PreviewPanelShell.tsx": 3,+ "apps/web/src/components/preview/PreviewView.tsx": 7,+ "apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx": 3,+ "apps/web/src/components/preview/ZoomIndicator.tsx": 1,+ "apps/web/src/components/preview/useAgentOpenedPreviews.ts": 3,+ "apps/web/src/components/preview/usePreviewBridge.ts": 2,+ "apps/web/src/components/projectScriptEditor.tsx": 1,+ "apps/web/src/components/promptLinks/HostedPromptLinkLanding.tsx": 1,+ "apps/web/src/components/promptLinks/NewThreadLinkView.tsx": 2,+ "apps/web/src/components/promptLinks/ThreadLinkPrompt.tsx": 1,+ "apps/web/src/components/pullRequest/LinkPullRequestDialog.tsx": 1,+ "apps/web/src/components/pullRequest/PullRequestCodeTab.tsx": 5,+ "apps/web/src/components/pullRequest/PullRequestCommentBody.tsx": 1,+ "apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx": 5,+ "apps/web/src/components/pullRequest/PullRequestGuideTab.tsx": 2,+ "apps/web/src/components/pullRequest/PullRequestsColumn.tsx": 5,+ "apps/web/src/components/pullRequest/PullRequestsPage.tsx": 9,+ "apps/web/src/components/pullRequest/guide/GuideTour.tsx": 1,+ "apps/web/src/components/pullRequest/guide/PullRequestGuideRunCoordinator.tsx": 2,+ "apps/web/src/components/pullRequest/guide/useReviewGuideWriter.ts": 1,+ "apps/web/src/components/pullRequest/useInlineActionConfirm.ts": 1,+ "apps/web/src/components/pullRequest/usePullRequestDetail.ts": 1,+ "apps/web/src/components/pullRequest/usePullRequestFilesViewed.ts": 2,+ "apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts": 1,+ "apps/web/src/components/search/ProjectContentSearchDialog.tsx": 1,+ "apps/web/src/components/settings/AcpRegistryIcon.tsx": 1,+ "apps/web/src/components/settings/AcpRegistrySearchStep.tsx": 2,+ "apps/web/src/components/settings/AddCodexAccountDialog.tsx": 1,+ "apps/web/src/components/settings/AddEnvironmentDialog.tsx": 1,+ "apps/web/src/components/settings/CliCommandSettingsRow.tsx": 1,+ "apps/web/src/components/settings/CodexSetupSection.tsx": 6,+ "apps/web/src/components/settings/ConnectionDiagnosisDetails.tsx": 1,+ "apps/web/src/components/settings/DiagnosticsSettings.tsx": 2,+ "apps/web/src/components/settings/EasDeviceHostsSettings.tsx": 1,+ "apps/web/src/components/settings/FontFamilyPicker.tsx": 2,+ "apps/web/src/components/settings/OpenSourceLicenses.tsx": 1,+ "apps/web/src/components/settings/ProjectFaviconThumbnail.tsx": 1,+ "apps/web/src/components/settings/ProjectIconPickerDialog.tsx": 1,+ "apps/web/src/components/settings/ProjectSettingsPanel.tsx": 2,+ "apps/web/src/components/settings/ProviderAccentColorPicker.tsx": 3,+ "apps/web/src/components/settings/ProviderAuthCallbackCoordinator.tsx": 1,+ "apps/web/src/components/settings/ProviderAuthTerminal.tsx": 2,+ "apps/web/src/components/settings/ProviderInstanceCard.tsx": 1,+ "apps/web/src/components/settings/ProviderModelsSection.tsx": 1,+ "apps/web/src/components/settings/ProviderSettingsForm.tsx": 1,+ "apps/web/src/components/settings/ResourceTelemetryDiagnostics.tsx": 2,+ "apps/web/src/components/settings/SavedEnvironmentRows.tsx": 1,+ "apps/web/src/components/settings/ScheduledTasksSettings.tsx": 2,+ "apps/web/src/components/settings/SettingsFontPreviews.tsx": 5,+ "apps/web/src/components/settings/SettingsPanels.tsx": 1,+ "apps/web/src/components/settings/SettingsSidebarNav.tsx": 3,+ "apps/web/src/components/settings/SnapShotSettings.tsx": 4,+ "apps/web/src/components/settings/TelemetryExportSettings.tsx": 1,+ "apps/web/src/components/settings/ThemeColorPicker.tsx": 1,+ "apps/web/src/components/settings/ThemeEditorPanel.tsx": 5,+ "apps/web/src/components/settings/ThemeImportDialog.tsx": 1,+ "apps/web/src/components/settings/ThemeSearchSection.tsx": 3,+ "apps/web/src/components/settings/TypographySettings.tsx": 2,+ "apps/web/src/components/settings/settingsLayout.tsx": 1,+ "apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx": 1,+ "apps/web/src/components/sidebar/SidebarProviderUpdatePill.tsx": 2,+ "apps/web/src/components/sidebar/SidebarThreadRow.tsx": 5,+ "apps/web/src/components/sidebar/SidebarThreadUndoNotice.tsx": 1,+ "apps/web/src/components/sidebar/SidebarUpdatePill.tsx": 1,+ "apps/web/src/components/sidebar/mainAppLocation.ts": 1,+ "apps/web/src/components/sidebar/updateEverythingRun.tsx": 2,+ "apps/web/src/components/ui/sidebar.tsx": 3,+ "apps/web/src/components/ui/toast.tsx": 2,+ "apps/web/src/components/ui/tooltip.tsx": 1,+ "apps/web/src/components/usage/UsageLimits.tsx": 1,+ "apps/web/src/components/usage/UsageLimitsPooled.tsx": 1,+ "apps/web/src/components/usage/UsagePage.tsx": 3,+ "apps/web/src/components/usage/UsageProviderChart.tsx": 1,+ "apps/web/src/connection/useDesktopLocalBootstraps.ts": 1,+ "apps/web/src/hooks/FileMetadataThreadProvider.tsx": 1,+ "apps/web/src/hooks/useCopyToClipboard.ts": 1,+ "apps/web/src/hooks/useDefaultTheme.ts": 1,+ "apps/web/src/hooks/useDelayedStatus.ts": 2,+ "apps/web/src/hooks/useEnvironmentDisconnectDelay.ts": 1,+ "apps/web/src/hooks/useEnvironmentTheme.ts": 1,+ "apps/web/src/hooks/useLiveRefresh.ts": 1,+ "apps/web/src/hooks/useLiveRegion.ts": 1,+ "apps/web/src/hooks/useNavigateBack.ts": 1,+ "apps/web/src/hooks/usePreviewPanelInlineSize.ts": 1,+ "apps/web/src/hooks/useProactivePanels.ts": 1,+ "apps/web/src/hooks/useResizableWidth.ts": 2,+ "apps/web/src/hooks/useResizeDrag.ts": 2,+ "apps/web/src/hooks/useSettings.ts": 1,+ "apps/web/src/hooks/useStableCallback.ts": 1,+ "apps/web/src/hooks/useTheme.ts": 1,+ "apps/web/src/hooks/useThreadVisitedMigration.ts": 1,+ "apps/web/src/hooks/useWorkspaceMutationRefresh.ts": 1,+ "apps/web/src/panelAnimations.ts": 2,+ "apps/web/src/remoteOpen.ts": 1,+ "apps/web/src/routes/__root.tsx": 13,+ "apps/web/src/routes/_chat.index.tsx": 1,+ "apps/web/src/routes/_chat.tsx": 1,+ "apps/web/src/shortcutModifierState.ts": 1,+ "apps/web/src/state/olderSettledShelf.ts": 2,+ "apps/web/src/state/pullRequests.ts": 2,+ "apps/web/src/state/queries.ts": 2,+ "apps/web/src/state/threads.ts": 1+}diff --git a/vite.config.ts b/vite.config.tsindex 875cb2cbe39..d17d7ad57f1 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -585,6 +585,10 @@ export default defineConfig({files: ["apps/mobile/src/**/*.{ts,tsx}"],rules: { "t3code/no-manual-memo": ["error", { allowMemoHooks: true }] },},+ {+ files: ["apps/web/src/**", "apps/mobile/src/**", "packages/*/src/**"],+ rules: { "t3code/react-effect-budget": "error" },+ },{// React Compiler caches use* functions only if they call a hook.files: ["apps/web/src/**/*.{ts,tsx}", "apps/mobile/src/**/*.{ts,tsx}"],