Open History to see the last commit
1import "vite-plus/test/config";
2import { defineConfig } from "vite-plus";
3import * as NodeURL from "node:url";
4
5/** Import restrictions every file keeps, including the one module exempt from the glyph rule. */
6const RESTRICTED_IMPORT_PATHS = [
7 {
8 name: "@t3tools/client-runtime",
9 message:
10 "Import from an explicit @t3tools/client-runtime/* subpath. The package has no root export.",
11 },
12 {
13 name: "@pierre/diffs/react",
14 importNames: ["CodeView"],
15 message: "Use StyledDiffCodeView so web diff surfaces share styling and virtualized geometry.",
16 },
17];
18
19/** Lucide's pull-request glyphs, which only `pullRequestIcons.tsx` may name. */
20const RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS = {
21 name: "lucide-react",
22 importNames: [
23 "GitMerge",
24 "GitMergeIcon",
25 "GitPullRequest",
26 "GitPullRequestIcon",
27 "GitPullRequestArrow",
28 "GitPullRequestArrowIcon",
29 "GitPullRequestClosed",
30 "GitPullRequestClosedIcon",
31 "GitPullRequestDraft",
32 "GitPullRequestDraftIcon",
33 "GitPullRequestCreate",
34 "GitPullRequestCreateIcon",
35 "GitPullRequestCreateArrow",
36 "GitPullRequestCreateArrowIcon",
37 ],
38 message:
39 "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.",
40};
41
42export default defineConfig({
43 resolve: {
44 alias: {
45 "~": NodeURL.fileURLToPath(new URL("./apps/web/src", import.meta.url)),
46 },
47 },
48 test: {
49 environment: "node",
50 exclude: [
51 "**/.repos/**",
52 "**/node_modules/**",
53 "**/dist/**",
54 "**/dist-electron/**",
55 "**/.{idea,git,cache,output,temp}/**",
56 ],
57 hookTimeout: 60_000,
58 testTimeout: 60_000,
59 setupFiles: [
60 NodeURL.fileURLToPath(
61 new URL("./packages/shared/src/testing/longTempDir.ts", import.meta.url),
62 ),
63 ],
64 },
65 staged: {
66 // Formatter only for now — no lint or typecheck on commit.
67 "*": "vp fmt --no-error-on-unmatched-pattern",
68 },
69 fmt: {
70 ignorePatterns: [
71 ".repos/**",
72 ".alchemy",
73 "dist",
74 "dist-electron",
75 "node_modules",
76 "pnpm-lock.yaml",
77 "*.tsbuildinfo",
78 "**/routeTree.gen.ts",
79 "apps/mobile/android/**",
80 "apps/mobile/ios/**",
81 "apps/mobile/uniwind-types.d.ts",
82 "*.icon/**",
83 ],
84 sortPackageJson: {},
85 overrides: [
86 {
87 files: [".devcontainer/devcontainer.json"],
88 options: {
89 trailingComma: "none",
90 },
91 },
92 ],
93 },
94 lint: {
95 ignorePatterns: [
96 ".repos",
97 ".repos/**",
98 "dist",
99 "dist-electron",
100 "node_modules",
101 "pnpm-lock.yaml",
102 "*.tsbuildinfo",
103 "**/routeTree.gen.ts",
104 "apps/mobile/android/**",
105 "apps/mobile/ios/**",
106 "apps/mobile/uniwind-types.d.ts",
107 ],
108 plugins: ["eslint", "oxc", "react", "unicorn", "typescript"],
109 jsPlugins: ["./oxlint-plugin-t3code/index.ts"],
110 categories: {
111 correctness: "warn",
112 suspicious: "warn",
113 perf: "warn",
114 },
115 rules: {
116 "unicorn/no-array-sort": "off",
117 "unicorn/consistent-function-scoping": "off",
118 "oxc/no-map-spread": "off",
119 "react-in-jsx-scope": "off",
120 "react-hooks/exhaustive-deps": "off",
121 "eslint/no-shadow": "off",
122 "eslint/no-await-in-loop": "off",
123 "eslint/no-underscore-dangle": "off",
124 "typescript/consistent-return": "off",
125 "typescript/no-base-to-string": "off",
126 "typescript/no-duplicate-type-constituents": "off",
127 "typescript/no-floating-promises": "off",
128 "typescript/no-implied-eval": "off",
129 "typescript/no-meaningless-void-operator": "off",
130 "typescript/no-redundant-type-constituents": "off",
131 "typescript/no-unnecessary-boolean-literal-compare": "off",
132 "typescript/no-unnecessary-type-conversion": "off",
133 "typescript/no-unnecessary-type-arguments": "off",
134 "typescript/no-unnecessary-type-assertion": "off",
135 "typescript/no-unnecessary-type-parameters": "off",
136 "typescript/no-unsafe-type-assertion": "off",
137 "typescript/await-thenable": "off",
138 "typescript/require-array-sort-compare": "off",
139 "typescript/restrict-template-expressions": "off",
140 "typescript/unbound-method": "off",
141 "eslint/no-restricted-imports": [
142 "error",
143 { paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS] },
144 ],
145 "t3code/no-global-process-runtime": "error",
146 "t3code/no-inline-schema-compile": "warn",
147 "t3code/no-manual-effect-runtime-in-tests": "error",
148 "t3code/no-native-title-tooltip": "error",
149 "t3code/namespace-node-imports": "error",
150 },
151 overrides: [
152 {
153 // The one place that reads the host platform to seed the injected references.
154 files: ["packages/shared/src/hostProcess.ts"],
155 rules: { "t3code/no-global-process-runtime": "off" },
156 },
157 {
158 // The one module allowed to name lucide's pull-request glyphs; everything else picks
159 // from its vocabulary. The other import restrictions still apply here.
160 files: ["apps/web/src/components/pullRequest/pullRequestIcons.tsx"],
161 rules: { "eslint/no-restricted-imports": ["error", { paths: RESTRICTED_IMPORT_PATHS }] },
162 },
163 {
164 files: ["apps/mobile/src/**"],
165 rules: { "t3code/no-mobile-uniwind-theme-escape-hatches": "error" },
166 },
167 {
168 // Shared client code must not call APIs missing from Hermes. Our ESNext
169 // TypeScript target accepts them even when they would crash mobile at launch.
170 // Tests run on Node and are exempt.
171 files: [
172 "apps/mobile/src/**",
173 "packages/client-runtime/src/**",
174 "packages/contracts/src/**",
175 "packages/shared/src/**",
176 ],
177 excludeFiles: ["**/*.test.ts", "**/*.test.tsx"],
178 rules: { "t3code/no-hermes-unsupported-apis": "error" },
179 },
180 {
181 // Reviewed native and third-party interop boundaries that cannot consume a className.
182 files: [
183 "apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx",
184 "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx",
185 "apps/mobile/src/features/files/FileMarkdownPreview.tsx",
186 "apps/mobile/src/features/files/SourceFileSurface.tsx",
187 "apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx",
188 "apps/mobile/src/features/files/AttachmentFileScreen.tsx",
189 "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
190 "apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
191 "apps/mobile/src/features/home/HomeHeader.tsx",
192 "apps/mobile/src/features/review/ReviewSheet.tsx",
193 "apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
194 "apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
195 "apps/mobile/src/features/settings/appearance/components/AppearancePreviews.tsx",
196 "apps/mobile/src/features/threads/GitActionProgressOverlay.tsx",
197 "apps/mobile/src/features/threads/NewTaskDraftScreen.tsx",
198 "apps/mobile/src/features/threads/ThreadComposer.tsx",
199 "apps/mobile/src/features/threads/ThreadFeed.tsx",
200 "apps/mobile/src/features/review/ReviewCommentCard.tsx",
201 "apps/mobile/src/features/threads/ThreadSettingsSheet.tsx",
202 "apps/mobile/src/features/threads/git/GitOverviewSheet.tsx",
203 "apps/mobile/src/features/threads/thread-list-items.tsx",
204 "apps/mobile/src/features/threads/thread-list-v2-items.tsx",
205 "apps/mobile/src/lib/useMobileNavigationTheme.ts",
206 "apps/mobile/src/native/T3ComposerEditor.ios.tsx",
207 "apps/mobile/src/native/T3ComposerEditor.native.tsx",
208 "apps/mobile/src/native/SelectableMarkdownText.android.tsx",
209 ],
210 rules: {
211 "t3code/no-mobile-uniwind-theme-escape-hatches": ["error", { allowUniwindTheme: true }],
212 },
213 },
214 // Legacy manual Effect runners tracked as debt: no net-new occurrences.
215 // Lower a ceiling when you migrate a file, and delete its entry at zero.
216 ...Object.entries({
217 "apps/server/src/orchestration/Layers/CheckpointReactor.test.ts": 42,
218 "apps/server/src/orchestration/Layers/OrchestrationEngine.test.ts": 5,
219 "apps/server/src/orchestration/Layers/OrchestrationReactor.test.ts": 4,
220 "apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts": 66,
221 "apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts": 29,
222 "apps/server/src/orchestration/Layers/ThreadDeletionReactor.test.ts": 2,
223 "apps/server/src/orchestration/commandInvariants.test.ts": 5,
224 "apps/server/src/orchestration/projector.test.ts": 20,
225 "apps/server/src/provider/Layers/CodexAdapter.test.ts": 1,
226 "apps/server/src/provider/Layers/CodexSessionRuntime.test.ts": 5,
227 "apps/server/src/provider/Layers/CursorAdapter.test.ts": 1,
228 "apps/server/src/provider/Layers/CursorProvider.test.ts": 1,
229 "apps/server/src/provider/Layers/ProviderService.test.ts": 2,
230 "apps/server/src/provider/Layers/ProviderSessionReaper.test.ts": 12,
231 "apps/server/src/provider/acp/CursorAcpSupport.test.ts": 1,
232 }).map(([file, maxOccurrences]) => {
233 const rule: ["error", { maxOccurrences: number }] = ["error", { maxOccurrences }];
234 return { files: [file], rules: { "t3code/no-manual-effect-runtime-in-tests": rule } };
235 }),
236 ],
237 options: {
238 reportUnusedDisableDirectives: "error",
239 // Revisit once Oxlint's tsgolint path can integrate with @effect/tsgo diagnostics.
240 typeAware: false,
241 typeCheck: false,
242 },
243 },
244});