Open History to see the last commit
1import "vite-plus/test/config";
2import { defineConfig } from "vite-plus";
3import * as NodeURL from "node:url";
4import { remoteCacheUrl } from "./infra/task-cache/src/remoteCache.ts";
5import { cachedTestTasks } from "./scripts/lib/cached-tests.ts";
6
7const 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`.
18const 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.
29const isRepoRootTestRun = process.cwd() === import.meta.dirname;
30
31const 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
62const 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
71const 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.
94const cacheUrl = remoteCacheUrl(import.meta.dirname);
95const taskCacheConfig = {
96 scripts: false,
97 ...(cacheUrl ? { remote: { url: cacheUrl } } : {}),
98};
99
100export 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-layout-command-approval-writes": "error",
314 "t3code/no-raw-mcp-registration": "error",
315 "t3code/no-real-time-wait-in-tests": "error",
316 "t3code/no-test-in-loop": "error",
317 "t3code/no-test-timeout-or-unreasoned-skip": "error",
318 "t3code/no-rpc-permission-bypass": ["error", { allowRawClientAccess: true }],
319 "t3code/no-unscoped-has": "error",
320 "t3code/no-wall-clock-in-tests": "error",
321 "t3code/namespace-node-imports": "error",
322 "t3code/prefer-catch-tags": "error",
323 "t3code/prefer-effect-fn": "error",
324 "t3code/require-centered-scroll-gutter": "error",
325 "t3code/require-suppression-reason": "error",
326 },
327 overrides: [
328 {
329 files: [
330 "**/*.{test,spec,testkit}.{ts,tsx}",
331 "**/{test,tests,testkit,testing,fixtures,integration}/**",
332 "packages/provider-testing/**",
333 ],
334 rules: { "t3code/prefer-effect-fn": "off" },
335 },
336 {
337 files: ["apps/web/src/**", "apps/mobile/src/**", "apps/desktop/src/**"],
338 // Users still pick their own project icon from the full Lucide set.
339 excludeFiles: ["apps/web/src/projectIconOptions.ts"],
340 rules: { "t3code/no-sparkles-icon": "error" },
341 },
342 {
343 files: ["apps/web/**/*.test.{ts,tsx}"],
344 rules: { "t3code/require-disposable-render": "error" },
345 },
346 {
347 files: ["apps/web/src/**/*.browser.test.{ts,tsx}"],
348 rules: { "t3code/no-frame-waits-in-browser-tests": "error" },
349 },
350 {
351 files: ["apps/**/src/**", "packages/**/src/**"],
352 rules: { "t3code/no-dom-test-environment": "error" },
353 },
354 {
355 files: ["packages/client-runtime/src/state/**", "apps/{web,mobile,desktop}/src/**"],
356 rules: { "t3code/no-rpc-permission-bypass": ["error", { allowRawClientAccess: false }] },
357 },
358 {
359 files: [
360 "packages/client-runtime/src/state/runtime.ts",
361 "packages/client-runtime/src/state/vcsAction.ts",
362 ],
363 rules: {
364 "t3code/no-rpc-permission-bypass": [
365 "error",
366 { allowGuardInstallation: true, allowRawClientAccess: false },
367 ],
368 },
369 },
370 {
371 files: [
372 "apps/web/src/components/settings/AuthorizedClientsSettings.tsx",
373 "apps/mobile/src/features/updates/app-updates.ts",
374 "apps/web/src/components/device/DevicePhoneViewport.tsx",
375 "apps/web/src/components/device/DeviceDuoViewport.tsx",
376 ],
377 rules: { "t3code/no-rpc-permission-bypass": ["error", { allowRawClientAccess: true }] },
378 },
379 {
380 files: ["packages/client-runtime/src/connection/outdatedHostUpdate.ts"],
381 rules: { "t3code/no-rpc-permission-bypass": "off" },
382 },
383 {
384 files: [
385 "packages/client-runtime/src/rpc/**",
386 "**/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}",
387 ],
388 rules: { "t3code/no-rpc-permission-bypass": "off" },
389 },
390 {
391 files: ["packages/shared/src/HostProcess.ts"],
392 rules: { "t3code/no-global-process-runtime": "off" },
393 },
394 {
395 // The `t3` npm launcher is published as plain, dependency-free Node.
396 files: ["scripts/npm-launcher/**"],
397 rules: {
398 "t3code/no-global-process-runtime": "off",
399 "t3code/namespace-node-imports": "off",
400 },
401 },
402 {
403 files: ["apps/server/src/mcp/McpHttpServer.ts"],
404 rules: { "t3code/no-raw-mcp-registration": "off" },
405 },
406 {
407 // The client RPC, the layer that builds it, and the tests that stand in for a person.
408 files: [
409 "apps/server/src/ws.ts",
410 "apps/server/src/server.ts",
411 "apps/server/src/ws.test.ts",
412 "apps/server/src/workspace/TaskFolders.testkit.ts",
413 ],
414 rules: { "t3code/no-layout-command-approval-writes": "off" },
415 },
416 {
417 files: ["apps/web/src/**"],
418 excludeFiles: ["apps/web/src/components/ui/**"],
419 rules: {
420 "eslint/no-restricted-imports": [
421 "error",
422 {
423 paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS],
424 patterns: RESTRICTED_UI_VARIANT_PATTERNS,
425 },
426 ],
427 },
428 },
429 {
430 files: ["apps/web/src/components/pullRequest/pullRequestIcons.tsx"],
431 rules: { "eslint/no-restricted-imports": ["error", { paths: RESTRICTED_IMPORT_PATHS }] },
432 },
433 {
434 // The server and every client load a forge's shared definition, so a UI runtime
435 // imported there would break the server; client-only forge code goes in `src/client/`.
436 files: ["packages/source-control-*/src/shared/**"],
437 rules: {
438 "eslint/no-restricted-imports": [
439 "error",
440 {
441 paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS],
442 patterns: [
443 {
444 group: [
445 "react",
446 "react/*",
447 "react-*",
448 "expo",
449 "expo-*",
450 "lucide-react",
451 "@t3tools/client-runtime",
452 "@t3tools/client-runtime/*",
453 "../client/*",
454 "../server/*",
455 "../../client/*",
456 "../../server/*",
457 "../../../client/*",
458 "../../../server/*",
459 "@t3tools/source-control-*/client/*",
460 "@t3tools/source-control-*/server/*",
461 ],
462 message:
463 "Shared forge definitions load on the server and every client; keep UI and server code out.",
464 },
465 ],
466 },
467 ],
468 },
469 },
470 {
471 files: ["apps/server/src/**", "packages/source-control-*/src/server/**"],
472 rules: {
473 "eslint/no-restricted-imports": [
474 "error",
475 {
476 paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS],
477 patterns: [
478 {
479 group: [
480 "@t3tools/source-control-*/client/*",
481 "../client/*",
482 "../../client/*",
483 "../../../client/*",
484 ],
485 message:
486 "A forge's client entry is UI-only; the server reads its `shared/definition`.",
487 },
488 ],
489 },
490 ],
491 },
492 },
493 {
494 files: ["apps/mobile/src/**"],
495 rules: {
496 "t3code/no-mobile-uniwind-theme-escape-hatches": "error",
497 "t3code/require-registered-list-scroll": "error",
498 },
499 },
500 {
501 files: ["apps/mobile/src/**"],
502 excludeFiles: [
503 "apps/mobile/src/components/ui/AppSymbol.tsx",
504 "apps/mobile/src/components/ui/AppSymbol.android.tsx",
505 "apps/mobile/src/features/pull-requests/pullRequestGlyphs.ts",
506 ],
507 rules: { "t3code/no-mobile-pull-request-glyph-literals": "error" },
508 },
509 {
510 files: ["apps/mobile/src/**"],
511 excludeFiles: ["**/*.test.{ts,tsx}"],
512 rules: { "t3code/no-ambiguous-detail-navigation": "error" },
513 },
514 {
515 // Raw ResizeObserver state commits miss the paint; observeResize flushes derived layout together.
516 files: ["apps/web/src/**"],
517 excludeFiles: [
518 "apps/web/src/lib/observeResize.ts",
519 "**/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}",
520 ],
521 rules: { "t3code/no-raw-resize-observer": "error" },
522 },
523 {
524 files: ["apps/web/src/**"],
525 rules: { "shadcn/no-unknown-classes": "error" },
526 },
527 {
528 files: ["apps/web/src/**"],
529 rules: { "t3code/no-outset-state-indicators": "error" },
530 },
531 {
532 files: ["apps/web/src/**"],
533 rules: { "t3code/max-settings-description-length": "error" },
534 },
535 {
536 files: ["apps/*/src/**", "packages/*/src/**"],
537 excludeFiles: [
538 "**/*.{test,spec}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}",
539 "**/testkit/**",
540 "**/_generated/**",
541 // Real user quotes stay verbatim.
542 "apps/marketing/src/lib/tweets.ts",
543 ],
544 rules: { "t3code/no-em-dash-copy": "error" },
545 },
546 {
547 files: ["apps/web/src/**"],
548 rules: { "shadcn/no-raw-colors": "error" },
549 },
550 {
551 // Third-party marks must retain their exact colors.
552 files: ["apps/web/src/components/Icons.tsx", "apps/web/src/components/JetBrainsIcons.tsx"],
553 rules: { "shadcn/no-raw-colors": "off" },
554 },
555 {
556 files: ["apps/web/src/**"],
557 excludeFiles: ["apps/web/src/components/ui/**"],
558 rules: {
559 "shadcn/require-static-classes": "error",
560 "shadcn/no-arbitrary-values": [
561 "error",
562 {
563 allow: [
564 "layout",
565 "transition",
566 "rounded-[inherit]",
567 "gap-[0.33em]",
568 "gap-[0.2em]",
569 "leading-[normal]",
570 "underline-offset-[0.2em]",
571 "rounded-[25%]",
572 "text-[length:80cqh]",
573 "bg-[Highlight]",
574 "fill-[#26251E]",
575 "fill-[#EDECEC]",
576 "fill-[#0F0F0F]",
577 "fill-[#F5F5F5]",
578 "fill-[#d97757]",
579 "text-[#d97757]",
580 ],
581 },
582 ],
583 "shadcn/no-restyle": [
584 "error",
585 {
586 allow: ["layout"],
587 contracts: [
588 {
589 // CollapsibleTrigger has no styled counterpart; other triggers use render={<Button …/>}.
590 pattern: "^CollapsibleTrigger$",
591 allow: ["layout", "color", "typography", "spacing", "shape", "effects", "motion"],
592 },
593 ],
594 },
595 ],
596 },
597 },
598 // Registered always so a disable comment for intentional English counts as used.
599 // `vp run i18n:untranslated` counts what it flags.
600 {
601 files: ["apps/web/src/**", "apps/mobile/src/**", "packages/client-runtime/src/**"],
602 excludeFiles: [
603 "**/*.{test,spec,bench}.{ts,tsx}",
604 "**/{test,testkit,testing,fixtures}/**",
605 "**/*.test-fixtures.ts",
606 "**/{test-fixtures,*TestFixtures}.ts",
607 "apps/mobile/src/features/development/**",
608 "packages/client-runtime/src/rpc/**",
609 ],
610 rules: { "t3code/no-untranslated-copy": "error" },
611 },
612 {
613 // React Compiler owns memoization; upstream rules do not ban redundant useMemo/useCallback.
614 files: ["apps/web/src/**/*.{ts,tsx}"],
615 rules: {
616 "react/exhaustive-effect-dependencies": "error",
617 "react/globals": "error",
618 "react/hooks": "error",
619 "react/immutability": "error",
620 // The compiler memoizes context values; this rule would ask for useMemo.
621 "react/jsx-no-constructed-context-values": "off",
622 "react/memo-dependencies": "error",
623 "react/preserve-manual-memoization": "error",
624 // Render-time clock reads use @t3tools/client-runtime/clock or state seeded with the
625 // time; any other read carries a suppression that says why. oxlint also flags time reads
626 // inside event handlers (oxc#27309); those suppressions cite it.
627 "react/purity": "error",
628 "react/refs": "error",
629 "react/set-state-in-effect": "error",
630 "react/set-state-in-render": "error",
631 "react/static-components": "error",
632 "react/unsupported-syntax": "error",
633 "t3code/no-manual-memo": "error",
634 },
635 },
636 {
637 // ESNext types allow APIs absent from Hermes; restrict shared client code, exempting Node tests.
638 files: [
639 "apps/mobile/src/**",
640 "packages/client-runtime/src/**",
641 "packages/contracts/src/**",
642 "packages/shared/src/**",
643 ],
644 excludeFiles: ["**/*.test.ts", "**/*.test.tsx"],
645 rules: { "t3code/no-hermes-unsupported-apis": "error" },
646 },
647 {
648 // Directives hide bailouts from mobile's compiler-coverage check; retain hooks until its allowlist is empty.
649 files: ["apps/mobile/src/**/*.{ts,tsx}"],
650 rules: { "t3code/no-manual-memo": ["error", { allowMemoHooks: true }] },
651 },
652 {
653 files: ["apps/web/src/**", "apps/mobile/src/**", "packages/*/src/**"],
654 rules: { "t3code/no-unreasoned-state-sync": "error" },
655 },
656 {
657 // React Compiler caches use* functions only if they call a hook.
658 files: ["apps/web/src/**/*.{ts,tsx}", "apps/mobile/src/**/*.{ts,tsx}"],
659 excludeFiles: ["**/*.test.ts", "**/*.test.tsx"],
660 rules: { "t3code/no-hookless-use-function": "error" },
661 },
662 {
663 files: [
664 "apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx",
665 "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx",
666 "apps/mobile/src/features/files/FileMarkdownPreview.tsx",
667 "apps/mobile/src/features/files/SourceFileSurface.tsx",
668 "apps/mobile/src/features/files/AttachmentFileScreen.tsx",
669 "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
670 "apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
671 "apps/mobile/src/features/layout/nested-stacks.tsx",
672 "apps/mobile/src/features/review/ReviewSheet.tsx",
673 "apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
674 "apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
675 "apps/mobile/src/features/threads/ThreadComposer.tsx",
676 "apps/mobile/src/components/ComposerSurface.tsx",
677 "apps/mobile/src/features/threads/ThreadFeed.tsx",
678 "apps/mobile/src/features/threads/ThreadQueueControl.tsx",
679 "apps/mobile/src/features/review/ReviewCommentCard.tsx",
680 "apps/mobile/src/features/threads/thread-list-v2-items.tsx",
681 "apps/mobile/src/components/ui/SecretTextInput.android.tsx",
682 "apps/mobile/src/lib/useMobileNavigationTheme.ts",
683 "apps/mobile/src/native/T3ComposerEditor.ios.tsx",
684 "apps/mobile/src/native/T3ComposerEditor.native.tsx",
685 "apps/mobile/src/native/SelectableMarkdownText.tsx",
686 "apps/mobile/src/native/useEnrichedLinkVariants.ts",
687 ],
688 rules: {
689 "t3code/no-mobile-uniwind-theme-escape-hatches": ["error", { allowUniwindTheme: true }],
690 },
691 },
692 ],
693 options: {
694 reportUnusedDisableDirectives: "error",
695 typeAware: false,
696 typeCheck: false,
697 },
698 },
699});