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 // Macroscope's glob-per-line ignore grammar, not Markdown: formatting
73 // it rewrites `*` as `_` and joins lines.
74 ".macroscope/ignore.md",
75 ".alchemy",
76 "dist",
77 "dist-electron",
78 "node_modules",
79 "pnpm-lock.yaml",
80 "*.tsbuildinfo",
81 "**/routeTree.gen.ts",
82 "apps/mobile/android/**",
83 "apps/mobile/ios/**",
84 "apps/mobile/uniwind-types.d.ts",
85 "*.icon/**",
86 ],
87 sortPackageJson: {},
88 overrides: [
89 {
90 files: [".devcontainer/devcontainer.json"],
91 options: {
92 trailingComma: "none",
93 },
94 },
95 ],
96 },
97 lint: {
98 ignorePatterns: [
99 ".repos",
100 ".repos/**",
101 "dist",
102 "dist-electron",
103 "node_modules",
104 "pnpm-lock.yaml",
105 "*.tsbuildinfo",
106 "**/routeTree.gen.ts",
107 "apps/mobile/android/**",
108 "apps/mobile/ios/**",
109 "apps/mobile/uniwind-types.d.ts",
110 ],
111 plugins: ["eslint", "oxc", "react", "unicorn", "typescript"],
112 jsPlugins: ["./oxlint-plugin-t3code/index.ts"],
113 categories: {
114 correctness: "warn",
115 suspicious: "warn",
116 perf: "warn",
117 },
118 rules: {
119 "unicorn/no-array-sort": "off",
120 "unicorn/consistent-function-scoping": "off",
121 "oxc/no-map-spread": "off",
122 "react-in-jsx-scope": "off",
123 "react-hooks/exhaustive-deps": "off",
124 "eslint/no-shadow": "off",
125 "eslint/no-await-in-loop": "off",
126 "eslint/no-underscore-dangle": "off",
127 "typescript/consistent-return": "off",
128 "typescript/no-base-to-string": "off",
129 "typescript/no-duplicate-type-constituents": "off",
130 "typescript/no-floating-promises": "off",
131 "typescript/no-implied-eval": "off",
132 "typescript/no-meaningless-void-operator": "off",
133 "typescript/no-redundant-type-constituents": "off",
134 "typescript/no-unnecessary-boolean-literal-compare": "off",
135 "typescript/no-unnecessary-type-conversion": "off",
136 "typescript/no-unnecessary-type-arguments": "off",
137 "typescript/no-unnecessary-type-assertion": "off",
138 "typescript/no-unnecessary-type-parameters": "off",
139 "typescript/no-unsafe-type-assertion": "off",
140 "typescript/await-thenable": "off",
141 "typescript/require-array-sort-compare": "off",
142 "typescript/restrict-template-expressions": "off",
143 "typescript/unbound-method": "off",
144 "eslint/no-restricted-imports": [
145 "error",
146 { paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS] },
147 ],
148 "t3code/no-global-process-runtime": "error",
149 "t3code/no-inline-schema-compile": "warn",
150 "t3code/no-manual-effect-runtime-in-tests": "error",
151 "t3code/no-native-title-tooltip": "error",
152 "t3code/namespace-node-imports": "error",
153 },
154 overrides: [
155 {
156 // The one place that reads the host platform to seed the injected references.
157 files: ["packages/shared/src/hostProcess.ts"],
158 rules: { "t3code/no-global-process-runtime": "off" },
159 },
160 {
161 // The one module allowed to name lucide's pull-request glyphs; everything else picks
162 // from its vocabulary. The other import restrictions still apply here.
163 files: ["apps/web/src/components/pullRequest/pullRequestIcons.tsx"],
164 rules: { "eslint/no-restricted-imports": ["error", { paths: RESTRICTED_IMPORT_PATHS }] },
165 },
166 {
167 files: ["apps/mobile/src/**"],
168 rules: { "t3code/no-mobile-uniwind-theme-escape-hatches": "error" },
169 },
170 {
171 // Shared client code must not call APIs missing from Hermes. Our ESNext
172 // TypeScript target accepts them even when they would crash mobile at launch.
173 // Tests run on Node and are exempt.
174 files: [
175 "apps/mobile/src/**",
176 "packages/client-runtime/src/**",
177 "packages/contracts/src/**",
178 "packages/shared/src/**",
179 ],
180 excludeFiles: ["**/*.test.ts", "**/*.test.tsx"],
181 rules: { "t3code/no-hermes-unsupported-apis": "error" },
182 },
183 {
184 // Reviewed native and third-party interop boundaries that cannot consume a className.
185 files: [
186 "apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx",
187 "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx",
188 "apps/mobile/src/features/files/FileMarkdownPreview.tsx",
189 "apps/mobile/src/features/files/SourceFileSurface.tsx",
190 "apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx",
191 "apps/mobile/src/features/files/AttachmentFileScreen.tsx",
192 "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
193 "apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
194 "apps/mobile/src/features/home/HomeHeader.tsx",
195 "apps/mobile/src/features/review/ReviewSheet.tsx",
196 "apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
197 "apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
198 "apps/mobile/src/features/settings/appearance/components/AppearancePreviews.tsx",
199 "apps/mobile/src/features/threads/GitActionProgressOverlay.tsx",
200 "apps/mobile/src/features/threads/NewTaskDraftScreen.tsx",
201 "apps/mobile/src/features/threads/ThreadComposer.tsx",
202 "apps/mobile/src/features/threads/ThreadFeed.tsx",
203 "apps/mobile/src/features/review/ReviewCommentCard.tsx",
204 "apps/mobile/src/features/threads/ThreadSettingsSheet.tsx",
205 "apps/mobile/src/features/threads/git/GitOverviewSheet.tsx",
206 "apps/mobile/src/features/threads/thread-list-items.tsx",
207 "apps/mobile/src/features/threads/thread-list-v2-items.tsx",
208 "apps/mobile/src/lib/useMobileNavigationTheme.ts",
209 "apps/mobile/src/native/T3ComposerEditor.ios.tsx",
210 "apps/mobile/src/native/T3ComposerEditor.native.tsx",
211 "apps/mobile/src/native/SelectableMarkdownText.android.tsx",
212 ],
213 rules: {
214 "t3code/no-mobile-uniwind-theme-escape-hatches": ["error", { allowUniwindTheme: true }],
215 },
216 },
217 // Legacy manual Effect runners tracked as debt: no net-new occurrences.
218 // Lower a ceiling when you migrate a file, and delete its entry at zero.
219 ...Object.entries({
220 "apps/server/src/orchestration/Layers/CheckpointReactor.test.ts": 42,
221 "apps/server/src/orchestration/Layers/OrchestrationEngine.test.ts": 5,
222 "apps/server/src/orchestration/Layers/OrchestrationReactor.test.ts": 4,
223 "apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts": 66,
224 "apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts": 29,
225 "apps/server/src/orchestration/Layers/ThreadDeletionReactor.test.ts": 2,
226 "apps/server/src/orchestration/commandInvariants.test.ts": 5,
227 "apps/server/src/orchestration/projector.test.ts": 20,
228 "apps/server/src/provider/Layers/CodexAdapter.test.ts": 1,
229 "apps/server/src/provider/Layers/CodexSessionRuntime.test.ts": 5,
230 "apps/server/src/provider/Layers/CursorAdapter.test.ts": 1,
231 "apps/server/src/provider/Layers/CursorProvider.test.ts": 1,
232 "apps/server/src/provider/Layers/ProviderService.test.ts": 2,
233 "apps/server/src/provider/Layers/ProviderSessionReaper.test.ts": 12,
234 "apps/server/src/provider/acp/CursorAcpSupport.test.ts": 1,
235 }).map(([file, maxOccurrences]) => {
236 const rule: ["error", { maxOccurrences: number }] = ["error", { maxOccurrences }];
237 return { files: [file], rules: { "t3code/no-manual-effect-runtime-in-tests": rule } };
238 }),
239 ],
240 options: {
241 reportUnusedDisableDirectives: "error",
242 // Revisit once Oxlint's tsgolint path can integrate with @effect/tsgo diagnostics.
243 typeAware: false,
244 typeCheck: false,
245 },
246 },
247});