@devries-cameron20 / t3code Mirror · read-only / commits / f4da08069e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 05:30 UTC

chore(web): React compiler rules apply to every web file (#20791)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 23:40 UTC f4da08069e35b698329ffd1a16d8a5d560dfc1b3
5 files changed +19 -125
apps/web/reactCompiledFiles.ts deleted
-101
@@ -1,101 +0,0 @@
1 -/**
2 - * Web files the React Compiler must compile, relative to the repository root. Add a
3 - * file once it compiles cleanly. The root lint config makes the compiler's bailout
4 - * rules errors for these files, and src/reactCompiledFiles.test.ts compiles each one
5 - * to catch the bailouts lint cannot see.
6 - */
7 -export const REACT_COMPILED_FILES = [
8 - "apps/web/src/components/ChatView.tsx",
9 - "apps/web/src/components/PersistentThreadTerminals.tsx",
10 - "apps/web/src/components/Sidebar.tsx",
11 - "apps/web/src/components/chat/ChatComposer.tsx",
12 - "apps/web/src/components/chat/usePendingThreadRequests.ts",
13 - "apps/web/src/components/chat/MessagesTimeline.tsx",
14 - "apps/web/src/components/chat/RightPanelSurfaceContent.tsx",
15 - "apps/web/src/components/chat/composerFocusRedirect.ts",
16 - "apps/web/src/components/chat/useChatShortcuts.ts",
17 - "apps/web/src/components/chat/useProjectScriptEditing.ts",
18 - "apps/web/src/components/chat/useQueuedRunEdit.ts",
19 - "apps/web/src/components/chat/useUsageLimitsPanel.ts",
20 - "apps/web/src/components/chat/useWorktreeSetup.ts",
21 - "apps/web/src/components/preview/useAgentOpenedPreviews.ts",
22 - "apps/web/src/components/pullRequest/useThreadLinkedPullRequest.ts",
23 - "apps/web/src/components/terminal/**",
24 - "apps/web/src/hooks/useIncrementalTimelineEntries.ts",
25 - "apps/web/src/hooks/useProactivePanels.ts",
26 - "apps/web/src/hooks/useRightPanelSurfaceClose.ts",
27 - "apps/web/src/components/ui/tooltip.tsx",
28 - "apps/web/src/components/ComposerPromptEditorTiptap.tsx",
29 - "apps/web/src/browser/ServerBrowserSurface.tsx",
30 - "apps/web/src/assets/assetUrls.ts",
31 - "apps/web/src/components/ui/toggle-group.tsx",
32 - "apps/web/src/components/ThreadNotificationCoordinator.tsx",
33 - "apps/web/src/state/queries.ts",
34 - "apps/web/src/state/sourceControlActions.ts",
35 - "apps/web/src/components/settings/ProjectFaviconPickerDialog.tsx",
36 - "apps/web/src/components/settings/ThemeEditorPanel.tsx",
37 - "apps/web/src/panelAnimations.ts",
38 - "apps/web/src/hooks/useCopyToClipboard.ts",
39 - "apps/web/src/components/auth/PairingRouteSurface.tsx",
40 - "apps/web/src/components/Sidebar.logic.ts",
41 - "apps/web/src/components/pullRequest/usePullRequestFilesViewed.ts",
42 - "apps/web/src/hooks/useLiveRefresh.ts",
43 - "apps/web/src/browser/useBrowserViewportResize.ts",
44 - "apps/web/src/components/desktop/SnapShotCoordinator.tsx",
45 - "apps/web/src/components/BranchToolbar.tsx",
46 - "apps/web/src/components/DiffPanel.tsx",
47 - "apps/web/src/components/onboarding/WelcomeWizard.tsx",
48 - "apps/web/src/hooks/useThreadActions.ts",
49 - "apps/web/src/components/pullRequest/PullRequestCodeTab.tsx",
50 - "apps/web/src/hooks/useLocalStorage.ts",
51 - "apps/web/src/hooks/useTheme.ts",
52 - "apps/web/src/hooks/useSettings.ts",
53 - "apps/web/src/components/chat/QueuedRunsControl.tsx",
54 - "apps/web/src/components/preview/PreviewView.tsx",
55 - "apps/web/src/components/CommandPalette.tsx",
56 - "apps/web/src/components/ServerUpdateAction.tsx",
57 - "apps/web/src/components/files/AttachmentFilePreview.tsx",
58 - "apps/web/src/components/usage/UsagePage.tsx",
59 - "apps/web/src/components/ProviderUpdateEnvironmentRows.tsx",
60 - "apps/web/src/components/files/useDirectoryEntries.ts",
61 - "apps/web/src/components/files/FileBrowserPanel.tsx",
62 - "apps/web/src/components/sidebar/SidebarUpdatePill.tsx",
63 - "apps/web/src/components/ProviderUpdatesAction.tsx",
64 - "apps/web/src/components/media/MediaVideoPlayer.tsx",
65 - "apps/web/src/components/media/MediaActions.tsx",
66 - "apps/web/src/components/device/DeviceSetup.tsx",
67 - "apps/web/src/components/device/DevicePanel.tsx",
68 - "apps/web/src/components/desktop/SshPasswordPromptDialog.tsx",
69 - "apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx",
70 - "apps/web/src/components/pullRequest/usePullRequestActions.ts",
71 - "apps/web/src/components/pullRequest/PullRequestReviewAnnotation.tsx",
72 - "apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx",
73 - "apps/web/src/components/pullRequest/LinkPullRequestDialog.tsx",
74 - "apps/web/src/components/settings/GitHubTokenSettings.tsx",
75 - "apps/web/src/components/settings/GitHubAccountSettings.tsx",
76 - "apps/web/src/components/settings/SourceControlHostSettings.tsx",
77 - "apps/web/src/components/settings/UsageProviderSettings.tsx",
78 - "apps/web/src/components/settings/TelemetryExportSettings.tsx",
79 - "apps/web/src/components/settings/useHostConnectionChecks.ts",
80 - "apps/web/src/components/settings/useProjectScriptSettings.ts",
81 - "apps/web/src/components/settings/SnapShotSetupDialog.tsx",
82 - "apps/web/src/components/settings/NotificationSettings.tsx",
83 - "apps/web/src/components/settings/ProviderSetupSection.tsx",
84 - "apps/web/src/components/settings/StorageSettings.tsx",
85 - "apps/web/src/components/settings/DiagnosticsSettings.tsx",
86 - "apps/web/src/components/settings/DeviceHostsSettings.tsx",
87 - "apps/web/src/components/settings/ProjectSettingsPanel.tsx",
88 - "apps/web/src/components/settings/AcpSessionManagementSection.tsx",
89 - "apps/web/src/components/settings/CaptureShortcutConfig.tsx",
90 - "apps/web/src/components/settings/IntegrationsSettings.tsx",
91 - "apps/web/src/components/settings/ThemeImportDialog.tsx",
92 - "apps/web/src/components/settings/SnapShotSettings.tsx",
93 - "apps/web/src/components/settings/ConnectionsSettings.tsx",
94 - "apps/web/src/hooks/useResizeDrag.ts",
95 - "apps/web/src/components/settings/ThemeColorPicker.tsx",
96 - "apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx",
97 - "apps/web/src/components/ThreadTerminalDrawer.tsx",
98 - "apps/web/src/components/settings/SettingsPanels.tsx",
99 - "apps/web/src/routes/_chat.pull-requests.tsx",
100 - "apps/web/src/components/LegacySidebar.tsx",
101 -] as const;
apps/web/src/reactCompilerCoverage.test.ts renamed
+8 -10
@@ -4,26 +4,24 @@ import * as NodePath from "node:path";
4 import * as NodeURL from "node:url";
5 import { transform } from "oxc-transform-react";
6 import { describe, expect, it } from "vite-plus/test";
7 -import { REACT_COMPILED_FILES } from "../reactCompiledFiles";
7
8 const repoRoot = NodePath.resolve(
9 NodePath.dirname(NodeURL.fileURLToPath(import.meta.url)),
10 "../../..",
11 );
12
14 -function expandPattern(pattern: string): string[] {
15 - if (!pattern.endsWith("/**")) return [pattern];
16 - const directory = pattern.slice(0, -3);
17 - return NodeFS.readdirSync(NodePath.join(repoRoot, directory), { recursive: true })
18 - .map(String)
19 - .filter((file) => /\.tsx?$/.test(file) && !/\.(test|browser)\.tsx?$/.test(file))
20 - .map((file) => `${directory}/${file}`);
21 -}
13 +const webSourceFiles = NodeFS.readdirSync(NodePath.join(repoRoot, "apps/web/src"), {
14 + recursive: true,
15 +})
16 + .map(String)
17 + .filter((file) => /\.tsx?$/.test(file) && !/\.(test|browser)\.tsx?$/.test(file))
18 + .filter((file) => !file.endsWith(".gen.ts"))
19 + .map((file) => `apps/web/src/${file}`);
20
21 // Lint reports most compiler bailouts, but not every one (try/finally, throw
22 // inside try). A skipped file still builds, just unmemoized, so check the output.
23 describe("React Compiler coverage", () => {
26 - it.each(REACT_COMPILED_FILES.flatMap(expandPattern))("compiles %s", async (file) => {
24 + it.each(webSourceFiles)("compiles %s", async (file) => {
25 const absolute = NodePath.join(repoRoot, file);
26 const result = await transform(absolute, NodeFS.readFileSync(absolute, "utf8"), {
27 jsx: { runtime: "automatic", development: false, refresh: false },
apps/web/tsconfig.json
-1
@@ -30,7 +30,6 @@
30 "vite",
31 "vite.config.ts",
32 "vercel.ts",
33 - "reactCompiledFiles.ts",
33 "test",
34 "scripts/warm-dep-cache.ts",
35 "../../scripts/lib/public-config.ts",
docs/internals/web-ui.md
+7 -8
@@ -61,11 +61,10 @@ Anything it can't prove, such as reading a ref during render or calling `setStat
61 makes it skip the whole function without a build error. Lint reports each skip as a
62 `react(...)` warning with the note "React Compiler skipped optimizing this component or hook".
63
64 -Files listed in [`reactCompiledFiles.ts`](../../apps/web/reactCompiledFiles.ts) must compile.
65 -Lint makes those rules errors there, and `t3code/no-manual-memo` rejects `useMemo` and
66 -`useCallback`, which the compiler makes redundant. Lint misses some bailouts, notably `try` with
67 -`finally` and `throw` inside `try`, so [`reactCompiledFiles.test.ts`](../../apps/web/src/reactCompiledFiles.test.ts)
68 -compiles each listed file and fails on any skip. Async handlers rarely need `try`: an atom
69 -command settles into a result, so cleanup can follow the `await`. `useStableCallback` still marks
70 -handlers that leave a large component, as described above. Add a file to the list once it
71 -compiles cleanly, and drop its manual memoization in the same change.
64 +Every file under `apps/web/src` must compile. Lint makes those rules errors there, and
65 +`t3code/no-manual-memo` rejects `useMemo` and `useCallback`, which the compiler makes redundant;
66 +no upstream rule bans them outright. Lint misses some bailouts, notably `try` with `finally` and
67 +`throw` inside `try`, so [`reactCompilerCoverage.test.ts`](../../apps/web/src/reactCompilerCoverage.test.ts)
68 +compiles every file and fails on any skip. Async handlers rarely need `try`: an
69 +atom command settles into a result, so cleanup can follow the `await`. `useStableCallback` still
70 +marks handlers that leave a large component, as described above.
vite.config.ts
+4 -5
@@ -1,7 +1,6 @@
1 import "vite-plus/test/config";
2 import { defineConfig } from "vite-plus";
3 import * as NodeURL from "node:url";
4 -import { REACT_COMPILED_FILES } from "./apps/web/reactCompiledFiles.ts";
4
5 const RESTRICTED_IMPORT_PATHS = [
6 {
@@ -322,10 +321,10 @@ export default defineConfig({
321 },
322 },
323 {
325 - // Files the React Compiler must compile. Its bailout rules are errors here, and manual
326 - // memoization is redundant. apps/web/src/compiledFiles.test.ts compiles each file and
327 - // fails on any bailout lint cannot see, such as try/finally.
328 - files: [...REACT_COMPILED_FILES],
324 + // Every web file must compile under the React Compiler. Its bailout rules are errors here,
325 + // and manual memoization is redundant. No upstream rule bans useMemo/useCallback, hence
326 + // t3code/no-manual-memo.
327 + files: ["apps/web/src/**/*.{ts,tsx}"],
328 rules: {
329 "react/exhaustive-effect-dependencies": "error",
330 "react/globals": "error",