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

main
ts 688 lines 24.8 KB
Raw
1 import "vite-plus/test/config";
2 import { defineConfig } from "vite-plus";
3 import * as NodeURL from "node:url";
4 import { remoteCacheUrl } from "./infra/task-cache/src/remoteCache.ts";
5 import { cachedTestTasks } from "./scripts/lib/cached-tests.ts";
6
7 const TEST_EXCLUDE = [
8 "**/.repos/**",
9 "**/.t3/**",
10 "**/node_modules/**",
11 "**/dist/**",
12 "**/dist-electron/**",
13 "**/.{idea,git,cache,output,temp}/**",
14 ];
15
16 // Directories whose tests belong to a package's own test config. desktop also
17 // owns the kde-snap-shot tests through its `include`.
18 const TEST_CONFIG_PACKAGES = [
19 "apps/desktop",
20 "apps/mobile",
21 "apps/server",
22 "apps/web",
23 "packages/client-runtime",
24 ];
25
26 // `vp test run <file>` from the repo root hands each file to its package's
27 // config. Packages that borrow this config (`--config ../../vite.config.ts`) run
28 // from their own directory, as CI does, so they keep one plain project.
29 const isRepoRootTestRun = process.cwd() === import.meta.dirname;
30
31 const RESTRICTED_IMPORT_PATHS = [
32 {
33 name: "react-native",
34 importNames: ["FlatList"],
35 message:
36 "Use LegendList from @legendapp/list/react-native, with renderScrollComponent={NativeScrollView} in a screen. Pass whatever renderItem reads through extraData: rows only re-render when their item or extraData changes.",
37 },
38 {
39 name: "@t3tools/client-runtime",
40 message:
41 "Import from an explicit @t3tools/client-runtime/* subpath. The package has no root export.",
42 },
43 {
44 name: "@pierre/diffs/react",
45 importNames: ["CodeView"],
46 message: "Use StyledDiffCodeView so web diff surfaces share styling and virtualized geometry.",
47 },
48 {
49 name: "react-native-screens",
50 importNames: ["ScrollViewMarker"],
51 message:
52 "Use NativeScrollViewMarker or NativeScrollView (src/native/NativeScrollViewMarker.tsx): they carry the header's scroll-edge blur under the Duo's vertical bar.",
53 },
54 {
55 name: "react-native",
56 importNames: ["RefreshControl"],
57 message:
58 "Use RefreshControl from src/components/ui/RefreshControl: Android bottom sheets own the pull at the top, so it steps aside there.",
59 },
60 ];
61
62 const RESTRICTED_UI_VARIANT_PATTERNS = [
63 {
64 group: ["**/components/ui/*", "**/ui/*", "./ui/*"],
65 importNames: ["buttonVariants", "toggleVariants", "badgeVariants", "selectTriggerVariants"],
66 message:
67 "Render the components/ui export instead of borrowing its class recipe (render={<Button …/>}, SelectButton, ToggleGroup).",
68 },
69 ];
70
71 const RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS = {
72 name: "lucide-react",
73 importNames: [
74 "GitMerge",
75 "GitMergeIcon",
76 "GitPullRequest",
77 "GitPullRequestIcon",
78 "GitPullRequestArrow",
79 "GitPullRequestArrowIcon",
80 "GitPullRequestClosed",
81 "GitPullRequestClosedIcon",
82 "GitPullRequestDraft",
83 "GitPullRequestDraftIcon",
84 "GitPullRequestCreate",
85 "GitPullRequestCreateIcon",
86 "GitPullRequestCreateArrow",
87 "GitPullRequestCreateArrowIcon",
88 ],
89 message:
90 "Pick a glyph by meaning from PullRequestGlyph in apps/web/src/components/pullRequest/pullRequestIcons.tsx so every surface draws the same pull request the same way.",
91 };
92
93 // Vite+ supports remote configuration before its published types include it.
94 const cacheUrl = remoteCacheUrl(import.meta.dirname);
95 const taskCacheConfig = {
96 scripts: false,
97 ...(cacheUrl ? { remote: { url: cacheUrl } } : {}),
98 };
99
100 export default defineConfig({
101 run: {
102 cache: taskCacheConfig,
103 tasks: {
104 ...cachedTestTasks(process.env.T3_CACHED_TESTS),
105 // The two knip passes read the same files and write nothing, so they run side by side.
106 // The `knip:check` script runs this task, so `vp run knip:check` and `pnpm run knip:check` both use it.
107 "knip:check:all": {
108 command: 'node -e ""',
109 dependsOn: ["knip:check:files", "knip:check:exports"],
110 cache: false,
111 },
112 },
113 },
114 resolve: {
115 alias: {
116 "~": NodeURL.fileURLToPath(new URL("./apps/web/src", import.meta.url)),
117 },
118 },
119 test: {
120 environment: "node",
121 // Fixture subprocesses must not inherit the outer task runner’s cache policy.
122 env: { VP_REMOTE_CACHE: "off", VP_REMOTE_CACHE_URL: "" },
123 exclude: TEST_EXCLUDE,
124 hookTimeout: 60_000,
125 testTimeout: 60_000,
126 allowOnly: !process.env.CI,
127 // Flaky tests are fixed, not retried.
128 retry: 0,
129 fakeTimers: {
130 toFake: [
131 "setTimeout",
132 "clearTimeout",
133 "setInterval",
134 "clearInterval",
135 "setImmediate",
136 "clearImmediate",
137 "Date",
138 "performance",
139 "requestAnimationFrame",
140 "cancelAnimationFrame",
141 "requestIdleCallback",
142 "cancelIdleCallback",
143 ],
144 },
145 setupFiles: [
146 NodeURL.fileURLToPath(
147 new URL("./packages/shared/src/testing/longTempDir.ts", import.meta.url),
148 ),
149 NodeURL.fileURLToPath(
150 new URL("./packages/shared/src/testing/providerEnv.ts", import.meta.url),
151 ),
152 NodeURL.fileURLToPath(new URL("./packages/shared/src/testing/gitEnv.ts", import.meta.url)),
153 ],
154 ...(isRepoRootTestRun
155 ? {
156 projects: [
157 ...TEST_CONFIG_PACKAGES,
158 {
159 extends: true,
160 test: {
161 name: "root",
162 exclude: [
163 ...TEST_EXCLUDE,
164 ...TEST_CONFIG_PACKAGES.map((dir) => `${dir}/**`),
165 "native/kde-snap-shot/**",
166 ],
167 },
168 },
169 ],
170 }
171 : {}),
172 },
173 staged: {
174 // In order, so lint reads the formatted file. CI lint failures cost a full round trip.
175 "*": ["vp fmt --no-error-on-unmatched-pattern", "vp lint --no-error-on-unmatched-pattern"],
176 // knip checks the whole repo, so it takes no file list. Any code or manifest change can leave
177 // a file, export, or dependency unused.
178 "{*.{js,jsx,ts,tsx,mjs,cjs,mts,cts},package.json,knip.jsonc}": () => "vp run knip:check",
179 },
180 fmt: {
181 ignorePatterns: [
182 ".repos/**",
183 "infra/task-cache/vendor/**",
184 // Macroscope requires one glob per line; Markdown formatting corrupts it.
185 ".macroscope/ignore.md",
186 ".alchemy",
187 "dist",
188 "dist-electron",
189 "node_modules",
190 "pnpm-lock.yaml",
191 "*.tsbuildinfo",
192 "**/routeTree.gen.ts",
193 "**/*.graphql.ts",
194 "packages/source-control-github/schema/**",
195 "apps/server/schema/**",
196 "apps/mobile/android/**",
197 "apps/mobile/ios/**",
198 "apps/mobile/uniwind-types.d.ts",
199 // Vendored and generated C.
200 "apps/mobile/modules/t3-highlights/Vendor/**",
201 "apps/mobile/modules/t3-highlights/cpp/generated/**",
202 "apps/mobile/modules/t3-highlights/nitrogen/generated/**",
203 "*.icon/**",
204 ],
205 sortPackageJson: {},
206 overrides: [
207 {
208 files: [".devcontainer/devcontainer.json"],
209 options: {
210 trailingComma: "none",
211 },
212 },
213 ],
214 },
215 lint: {
216 ignorePatterns: [
217 ".repos",
218 ".repos/**",
219 "infra/task-cache/vendor/**",
220 "dist",
221 "dist-electron",
222 "node_modules",
223 "pnpm-lock.yaml",
224 "*.tsbuildinfo",
225 "**/routeTree.gen.ts",
226 "**/*.graphql.ts",
227 "packages/source-control-github/schema/**",
228 "apps/server/schema/**",
229 "apps/mobile/android/**",
230 "apps/mobile/ios/**",
231 "apps/mobile/uniwind-types.d.ts",
232 ],
233 plugins: ["eslint", "oxc", "react", "unicorn", "typescript"],
234 jsPlugins: ["./oxlint-plugin-t3code/index.ts", "@shadcn/lint"],
235 settings: {
236 shadcn: { ui: "~/components/ui" },
237 },
238 categories: {
239 correctness: "warn",
240 suspicious: "warn",
241 perf: "warn",
242 },
243 rules: {
244 "oxc/no-accumulating-spread": "error",
245 "eslint/no-control-regex": "off",
246 "typescript/no-this-alias": "off",
247 "unicorn/prefer-add-event-listener": "off",
248 "unicorn/prefer-string-starts-ends-with": "off",
249 "unicorn/prefer-set-has": "off",
250 "unicorn/prefer-array-find": "off",
251 "unicorn/no-new-array": "off",
252 "unicorn/no-array-reverse": "off",
253 "react/no-object-type-as-default-prop": "off",
254 "react/jsx-no-constructed-context-values": "off",
255 "react/memo-dependencies": "error",
256 "react/purity": "error",
257 "react/refs": "error",
258 "react/exhaustive-effect-dependencies": "error",
259 "react/set-state-in-effect": "error",
260 "react/immutability": "error",
261 "react/no-array-index-key": "error",
262 "react/no-unstable-nested-components": "error",
263 "react/static-components": "error",
264 "react/capitalized-calls": "error",
265 "typescript/no-extraneous-class": "error",
266 "eslint/no-empty-pattern": "error",
267 "eslint/no-new": "error",
268 "unicorn/no-useless-spread": "error",
269 "eslint/no-unused-vars": [
270 "error",
271 { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
272 ],
273 "eslint/no-unsafe-optional-chaining": "error",
274 "eslint/no-unneeded-ternary": "error",
275 "unicorn/no-useless-fallback-in-spread": "error",
276 "unicorn/require-module-specifiers": "error",
277 "unicorn/no-array-sort": "off",
278 "unicorn/consistent-function-scoping": "off",
279 "oxc/no-map-spread": "off",
280 "react-in-jsx-scope": "off",
281 "react-hooks/exhaustive-deps": "off",
282 "eslint/no-shadow": "off",
283 "eslint/no-await-in-loop": "off",
284 "eslint/no-underscore-dangle": "off",
285 "typescript/consistent-return": "off",
286 "typescript/no-base-to-string": "off",
287 "typescript/no-duplicate-type-constituents": "off",
288 "typescript/no-floating-promises": "off",
289 "typescript/no-implied-eval": "off",
290 "typescript/no-meaningless-void-operator": "off",
291 "typescript/no-redundant-type-constituents": "off",
292 "typescript/no-unnecessary-boolean-literal-compare": "off",
293 "typescript/no-unnecessary-type-conversion": "off",
294 "typescript/no-unnecessary-type-arguments": "off",
295 "typescript/no-unnecessary-type-assertion": "off",
296 "typescript/no-unnecessary-type-parameters": "off",
297 "typescript/no-unsafe-type-assertion": "off",
298 "typescript/await-thenable": "off",
299 "typescript/require-array-sort-compare": "off",
300 "typescript/restrict-template-expressions": "off",
301 "typescript/unbound-method": "off",
302 "eslint/no-restricted-imports": [
303 "error",
304 { paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS] },
305 ],
306 "t3code/no-global-process-runtime": "error",
307 "t3code/no-inline-schema-compile": "error",
308 "t3code/no-low-value-comments": "error",
309 "t3code/no-manual-effect-runtime-in-tests": "error",
310 "t3code/no-native-title-tooltip": "error",
311 // Test files only (the rule checks the filename).
312 "t3code/no-polling-loop-in-tests": "error",
313 "t3code/no-raw-mcp-registration": "error",
314 "t3code/no-real-time-wait-in-tests": "error",
315 "t3code/no-test-in-loop": "error",
316 "t3code/no-test-timeout-or-unreasoned-skip": "error",
317 "t3code/no-rpc-permission-bypass": ["error", { allowRawClientAccess: true }],
318 "t3code/no-unscoped-has": "error",
319 "t3code/no-wall-clock-in-tests": "error",
320 "t3code/namespace-node-imports": "error",
321 "t3code/prefer-catch-tags": "error",
322 "t3code/prefer-effect-fn": "error",
323 "t3code/require-centered-scroll-gutter": "error",
324 "t3code/require-suppression-reason": "error",
325 },
326 overrides: [
327 {
328 files: [
329 "**/*.{test,spec,testkit}.{ts,tsx}",
330 "**/{test,tests,testkit,testing,fixtures,integration}/**",
331 "packages/provider-testing/**",
332 ],
333 rules: { "t3code/prefer-effect-fn": "off" },
334 },
335 {
336 files: ["apps/web/src/**", "apps/mobile/src/**", "apps/desktop/src/**"],
337 // Users still pick their own project icon from the full Lucide set.
338 excludeFiles: ["apps/web/src/projectIconOptions.ts"],
339 rules: { "t3code/no-sparkles-icon": "error" },
340 },
341 {
342 files: ["apps/web/**/*.test.{ts,tsx}"],
343 rules: { "t3code/require-disposable-render": "error" },
344 },
345 {
346 files: ["apps/web/src/**/*.browser.test.{ts,tsx}"],
347 rules: { "t3code/no-frame-waits-in-browser-tests": "error" },
348 },
349 {
350 files: ["apps/**/src/**", "packages/**/src/**"],
351 rules: { "t3code/no-dom-test-environment": "error" },
352 },
353 {
354 files: ["packages/client-runtime/src/state/**", "apps/{web,mobile,desktop}/src/**"],
355 rules: { "t3code/no-rpc-permission-bypass": ["error", { allowRawClientAccess: false }] },
356 },
357 {
358 files: [
359 "packages/client-runtime/src/state/runtime.ts",
360 "packages/client-runtime/src/state/vcsAction.ts",
361 ],
362 rules: {
363 "t3code/no-rpc-permission-bypass": [
364 "error",
365 { allowGuardInstallation: true, allowRawClientAccess: false },
366 ],
367 },
368 },
369 {
370 files: [
371 "apps/web/src/components/settings/AuthorizedClientsSettings.tsx",
372 "apps/mobile/src/features/updates/app-updates.ts",
373 "apps/web/src/components/device/DevicePhoneViewport.tsx",
374 "apps/web/src/components/device/DeviceDuoViewport.tsx",
375 ],
376 rules: { "t3code/no-rpc-permission-bypass": ["error", { allowRawClientAccess: true }] },
377 },
378 {
379 files: ["packages/client-runtime/src/connection/outdatedHostUpdate.ts"],
380 rules: { "t3code/no-rpc-permission-bypass": "off" },
381 },
382 {
383 files: [
384 "packages/client-runtime/src/rpc/**",
385 "**/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}",
386 ],
387 rules: { "t3code/no-rpc-permission-bypass": "off" },
388 },
389 {
390 files: ["packages/shared/src/HostProcess.ts"],
391 rules: { "t3code/no-global-process-runtime": "off" },
392 },
393 {
394 // The `t3` npm launcher is published as plain, dependency-free Node.
395 files: ["scripts/npm-launcher/**"],
396 rules: {
397 "t3code/no-global-process-runtime": "off",
398 "t3code/namespace-node-imports": "off",
399 },
400 },
401 {
402 files: ["apps/server/src/mcp/McpHttpServer.ts"],
403 rules: { "t3code/no-raw-mcp-registration": "off" },
404 },
405 {
406 files: ["apps/web/src/**"],
407 excludeFiles: ["apps/web/src/components/ui/**"],
408 rules: {
409 "eslint/no-restricted-imports": [
410 "error",
411 {
412 paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS],
413 patterns: RESTRICTED_UI_VARIANT_PATTERNS,
414 },
415 ],
416 },
417 },
418 {
419 files: ["apps/web/src/components/pullRequest/pullRequestIcons.tsx"],
420 rules: { "eslint/no-restricted-imports": ["error", { paths: RESTRICTED_IMPORT_PATHS }] },
421 },
422 {
423 // The server and every client load a forge's shared definition, so a UI runtime
424 // imported there would break the server; client-only forge code goes in `src/client/`.
425 files: ["packages/source-control-*/src/shared/**"],
426 rules: {
427 "eslint/no-restricted-imports": [
428 "error",
429 {
430 paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS],
431 patterns: [
432 {
433 group: [
434 "react",
435 "react/*",
436 "react-*",
437 "expo",
438 "expo-*",
439 "lucide-react",
440 "@t3tools/client-runtime",
441 "@t3tools/client-runtime/*",
442 "../client/*",
443 "../server/*",
444 "../../client/*",
445 "../../server/*",
446 "../../../client/*",
447 "../../../server/*",
448 "@t3tools/source-control-*/client/*",
449 "@t3tools/source-control-*/server/*",
450 ],
451 message:
452 "Shared forge definitions load on the server and every client; keep UI and server code out.",
453 },
454 ],
455 },
456 ],
457 },
458 },
459 {
460 files: ["apps/server/src/**", "packages/source-control-*/src/server/**"],
461 rules: {
462 "eslint/no-restricted-imports": [
463 "error",
464 {
465 paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS],
466 patterns: [
467 {
468 group: [
469 "@t3tools/source-control-*/client/*",
470 "../client/*",
471 "../../client/*",
472 "../../../client/*",
473 ],
474 message:
475 "A forge's client entry is UI-only; the server reads its `shared/definition`.",
476 },
477 ],
478 },
479 ],
480 },
481 },
482 {
483 files: ["apps/mobile/src/**"],
484 rules: {
485 "t3code/no-mobile-uniwind-theme-escape-hatches": "error",
486 "t3code/require-registered-list-scroll": "error",
487 },
488 },
489 {
490 files: ["apps/mobile/src/**"],
491 excludeFiles: [
492 "apps/mobile/src/components/ui/AppSymbol.tsx",
493 "apps/mobile/src/components/ui/AppSymbol.android.tsx",
494 "apps/mobile/src/features/pull-requests/pullRequestGlyphs.ts",
495 ],
496 rules: { "t3code/no-mobile-pull-request-glyph-literals": "error" },
497 },
498 {
499 files: ["apps/mobile/src/**"],
500 excludeFiles: ["**/*.test.{ts,tsx}"],
501 rules: { "t3code/no-ambiguous-detail-navigation": "error" },
502 },
503 {
504 // Raw ResizeObserver state commits miss the paint; observeResize flushes derived layout together.
505 files: ["apps/web/src/**"],
506 excludeFiles: [
507 "apps/web/src/lib/observeResize.ts",
508 "**/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}",
509 ],
510 rules: { "t3code/no-raw-resize-observer": "error" },
511 },
512 {
513 files: ["apps/web/src/**"],
514 rules: { "shadcn/no-unknown-classes": "error" },
515 },
516 {
517 files: ["apps/web/src/**"],
518 rules: { "t3code/no-outset-state-indicators": "error" },
519 },
520 {
521 files: ["apps/web/src/**"],
522 rules: { "t3code/max-settings-description-length": "error" },
523 },
524 {
525 files: ["apps/*/src/**", "packages/*/src/**"],
526 excludeFiles: [
527 "**/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}",
528 "**/testkit/**",
529 "**/_generated/**",
530 // Real user quotes stay verbatim.
531 "apps/marketing/src/lib/tweets.ts",
532 ],
533 rules: { "t3code/no-em-dash-copy": "error" },
534 },
535 {
536 files: ["apps/web/src/**"],
537 rules: { "shadcn/no-raw-colors": "error" },
538 },
539 {
540 // Third-party marks must retain their exact colors.
541 files: ["apps/web/src/components/Icons.tsx", "apps/web/src/components/JetBrainsIcons.tsx"],
542 rules: { "shadcn/no-raw-colors": "off" },
543 },
544 {
545 files: ["apps/web/src/**"],
546 excludeFiles: ["apps/web/src/components/ui/**"],
547 rules: {
548 "shadcn/require-static-classes": "error",
549 "shadcn/no-arbitrary-values": [
550 "error",
551 {
552 allow: [
553 "layout",
554 "transition",
555 "rounded-[inherit]",
556 "gap-[0.33em]",
557 "gap-[0.2em]",
558 "leading-[normal]",
559 "underline-offset-[0.2em]",
560 "rounded-[25%]",
561 "text-[length:80cqh]",
562 "bg-[Highlight]",
563 "fill-[#26251E]",
564 "fill-[#EDECEC]",
565 "fill-[#0F0F0F]",
566 "fill-[#F5F5F5]",
567 "fill-[#d97757]",
568 "text-[#d97757]",
569 ],
570 },
571 ],
572 "shadcn/no-restyle": [
573 "error",
574 {
575 allow: ["layout"],
576 contracts: [
577 {
578 // CollapsibleTrigger has no styled counterpart; other triggers use render={<Button …/>}.
579 pattern: "^CollapsibleTrigger$",
580 allow: ["layout", "color", "typography", "spacing", "shape", "effects", "motion"],
581 },
582 ],
583 },
584 ],
585 },
586 },
587 // Registered always so a disable comment for intentional English counts as used.
588 // `vp run i18n:untranslated` counts what it flags.
589 {
590 files: ["apps/web/src/**", "apps/mobile/src/**", "packages/client-runtime/src/**"],
591 excludeFiles: [
592 "**/*.{test,spec,bench}.{ts,tsx}",
593 "**/{test,testkit,testing,fixtures}/**",
594 "**/*.test-fixtures.ts",
595 "**/{test-fixtures,*TestFixtures}.ts",
596 "apps/mobile/src/features/development/**",
597 "packages/client-runtime/src/rpc/**",
598 ],
599 rules: { "t3code/no-untranslated-copy": "error" },
600 },
601 {
602 // React Compiler owns memoization; upstream rules do not ban redundant useMemo/useCallback.
603 files: ["apps/web/src/**/*.{ts,tsx}"],
604 rules: {
605 "react/exhaustive-effect-dependencies": "error",
606 "react/globals": "error",
607 "react/hooks": "error",
608 "react/immutability": "error",
609 // The compiler memoizes context values; this rule would ask for useMemo.
610 "react/jsx-no-constructed-context-values": "off",
611 "react/memo-dependencies": "error",
612 "react/preserve-manual-memoization": "error",
613 // Render-time clock reads use @t3tools/client-runtime/clock or state seeded with the
614 // time; any other read carries a suppression that says why. oxlint also flags time reads
615 // inside event handlers (oxc#27309); those suppressions cite it.
616 "react/purity": "error",
617 "react/refs": "error",
618 "react/set-state-in-effect": "error",
619 "react/set-state-in-render": "error",
620 "react/static-components": "error",
621 "react/unsupported-syntax": "error",
622 "t3code/no-manual-memo": "error",
623 },
624 },
625 {
626 // ESNext types allow APIs absent from Hermes; restrict shared client code, exempting Node tests.
627 files: [
628 "apps/mobile/src/**",
629 "packages/client-runtime/src/**",
630 "packages/contracts/src/**",
631 "packages/shared/src/**",
632 ],
633 excludeFiles: ["**/*.test.ts", "**/*.test.tsx"],
634 rules: { "t3code/no-hermes-unsupported-apis": "error" },
635 },
636 {
637 // Directives hide bailouts from mobile's compiler-coverage check; retain hooks until its allowlist is empty.
638 files: ["apps/mobile/src/**/*.{ts,tsx}"],
639 rules: { "t3code/no-manual-memo": ["error", { allowMemoHooks: true }] },
640 },
641 {
642 files: ["apps/web/src/**", "apps/mobile/src/**", "packages/*/src/**"],
643 rules: { "t3code/no-unreasoned-state-sync": "error" },
644 },
645 {
646 // React Compiler caches use* functions only if they call a hook.
647 files: ["apps/web/src/**/*.{ts,tsx}", "apps/mobile/src/**/*.{ts,tsx}"],
648 excludeFiles: ["**/*.test.ts", "**/*.test.tsx"],
649 rules: { "t3code/no-hookless-use-function": "error" },
650 },
651 {
652 files: [
653 "apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx",
654 "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx",
655 "apps/mobile/src/features/files/FileMarkdownPreview.tsx",
656 "apps/mobile/src/features/files/SourceFileSurface.tsx",
657 "apps/mobile/src/features/files/AttachmentFileScreen.tsx",
658 "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
659 "apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
660 "apps/mobile/src/features/layout/nested-stacks.tsx",
661 "apps/mobile/src/features/review/ReviewSheet.tsx",
662 "apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
663 "apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
664 "apps/mobile/src/features/threads/ThreadComposer.tsx",
665 "apps/mobile/src/components/ComposerSurface.tsx",
666 "apps/mobile/src/features/threads/ThreadFeed.tsx",
667 "apps/mobile/src/features/threads/ThreadQueueControl.tsx",
668 "apps/mobile/src/features/review/ReviewCommentCard.tsx",
669 "apps/mobile/src/features/threads/thread-list-v2-items.tsx",
670 "apps/mobile/src/components/ui/SecretTextInput.android.tsx",
671 "apps/mobile/src/lib/useMobileNavigationTheme.ts",
672 "apps/mobile/src/native/T3ComposerEditor.ios.tsx",
673 "apps/mobile/src/native/T3ComposerEditor.native.tsx",
674 "apps/mobile/src/native/SelectableMarkdownText.tsx",
675 "apps/mobile/src/native/useEnrichedLinkVariants.ts",
676 ],
677 rules: {
678 "t3code/no-mobile-uniwind-theme-escape-hatches": ["error", { allowUniwindTheme: true }],
679 },
680 },
681 ],
682 options: {
683 reportUnusedDisableDirectives: "error",
684 typeAware: false,
685 typeCheck: false,
686 },
687 },
688 });