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", "@shadcn/lint"],
113 settings: {
114 shadcn: { ui: "~/components/ui" },
115 },
116 categories: {
117 correctness: "warn",
118 suspicious: "warn",
119 perf: "warn",
120 },
121 rules: {
122 "unicorn/no-array-sort": "off",
123 "unicorn/consistent-function-scoping": "off",
124 "oxc/no-map-spread": "off",
125 "react-in-jsx-scope": "off",
126 "react-hooks/exhaustive-deps": "off",
127 "eslint/no-shadow": "off",
128 "eslint/no-await-in-loop": "off",
129 "eslint/no-underscore-dangle": "off",
130 "typescript/consistent-return": "off",
131 "typescript/no-base-to-string": "off",
132 "typescript/no-duplicate-type-constituents": "off",
133 "typescript/no-floating-promises": "off",
134 "typescript/no-implied-eval": "off",
135 "typescript/no-meaningless-void-operator": "off",
136 "typescript/no-redundant-type-constituents": "off",
137 "typescript/no-unnecessary-boolean-literal-compare": "off",
138 "typescript/no-unnecessary-type-conversion": "off",
139 "typescript/no-unnecessary-type-arguments": "off",
140 "typescript/no-unnecessary-type-assertion": "off",
141 "typescript/no-unnecessary-type-parameters": "off",
142 "typescript/no-unsafe-type-assertion": "off",
143 "typescript/await-thenable": "off",
144 "typescript/require-array-sort-compare": "off",
145 "typescript/restrict-template-expressions": "off",
146 "typescript/unbound-method": "off",
147 "eslint/no-restricted-imports": [
148 "error",
149 { paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS] },
150 ],
151 "t3code/no-global-process-runtime": "error",
152 "t3code/no-inline-schema-compile": "warn",
153 "t3code/no-manual-effect-runtime-in-tests": "error",
154 "t3code/no-native-title-tooltip": "error",
155 "t3code/namespace-node-imports": "error",
156 },
157 overrides: [
158 {
159 // The one place that reads the host platform to seed the injected references.
160 files: ["packages/shared/src/hostProcess.ts"],
161 rules: { "t3code/no-global-process-runtime": "off" },
162 },
163 {
164 // The one module allowed to name lucide's pull-request glyphs; everything else picks
165 // from its vocabulary. The other import restrictions still apply here.
166 files: ["apps/web/src/components/pullRequest/pullRequestIcons.tsx"],
167 rules: { "eslint/no-restricted-imports": ["error", { paths: RESTRICTED_IMPORT_PATHS }] },
168 },
169 {
170 files: ["apps/mobile/src/**"],
171 rules: { "t3code/no-mobile-uniwind-theme-escape-hatches": "error" },
172 },
173 {
174 // components/ui exports own their look. App code picks a variant or size instead
175 // of restyling with className; layout classes (width, flex, margin, position) stay
176 // allowed because placement belongs to the parent. Warn-only until the existing
177 // overrides are migrated to variants; the ceiling below stops the count growing.
178 files: ["apps/web/src/**"],
179 excludeFiles: ["apps/web/src/components/ui/**"],
180 rules: {
181 "shadcn/no-restyle": [
182 "warn",
183 {
184 allow: ["layout"],
185 contracts: [
186 {
187 // CollapsibleTrigger is a bare button with no styled counterpart
188 // (a disclosure row is not a Button), so its className is the API.
189 // Every other trigger has one: style them with render={<Button …/>}.
190 pattern: "^CollapsibleTrigger$",
191 allow: ["layout", "color", "typography", "spacing", "shape", "effects", "motion"],
192 },
193 ],
194 },
195 ],
196 },
197 },
198 {
199 // Shared client code must not call APIs missing from Hermes. Our ESNext
200 // TypeScript target accepts them even when they would crash mobile at launch.
201 // Tests run on Node and are exempt.
202 files: [
203 "apps/mobile/src/**",
204 "packages/client-runtime/src/**",
205 "packages/contracts/src/**",
206 "packages/shared/src/**",
207 ],
208 excludeFiles: ["**/*.test.ts", "**/*.test.tsx"],
209 rules: { "t3code/no-hermes-unsupported-apis": "error" },
210 },
211 {
212 // Reviewed native and third-party interop boundaries that cannot consume a className.
213 files: [
214 "apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx",
215 "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx",
216 "apps/mobile/src/features/files/FileMarkdownPreview.tsx",
217 "apps/mobile/src/features/files/SourceFileSurface.tsx",
218 "apps/mobile/src/features/files/AttachmentFileScreen.tsx",
219 "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
220 "apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
221 "apps/mobile/src/features/home/HomeHeader.tsx",
222 "apps/mobile/src/features/review/ReviewSheet.tsx",
223 "apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
224 "apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
225 "apps/mobile/src/features/threads/GitActionProgressOverlay.tsx",
226 "apps/mobile/src/features/threads/NewTaskDraftScreen.tsx",
227 "apps/mobile/src/features/threads/ThreadComposer.tsx",
228 "apps/mobile/src/features/threads/ThreadFeed.tsx",
229 "apps/mobile/src/features/review/ReviewCommentCard.tsx",
230 "apps/mobile/src/features/threads/ThreadSettingsSheet.tsx",
231 "apps/mobile/src/features/threads/git/GitOverviewSheet.tsx",
232 "apps/mobile/src/features/threads/thread-list-items.tsx",
233 "apps/mobile/src/features/threads/thread-list-v2-items.tsx",
234 "apps/mobile/src/lib/useMobileNavigationTheme.ts",
235 "apps/mobile/src/native/T3ComposerEditor.ios.tsx",
236 "apps/mobile/src/native/T3ComposerEditor.native.tsx",
237 "apps/mobile/src/native/SelectableMarkdownText.android.tsx",
238 ],
239 rules: {
240 "t3code/no-mobile-uniwind-theme-escape-hatches": ["error", { allowUniwindTheme: true }],
241 },
242 },
243 // Legacy manual Effect runners tracked as debt: no net-new occurrences.
244 // Lower a ceiling when you migrate a file, and delete its entry at zero.
245 ...Object.entries({
246 "apps/server/src/orchestration/Layers/CheckpointReactor.test.ts": 42,
247 "apps/server/src/orchestration/Layers/OrchestrationEngine.test.ts": 5,
248 "apps/server/src/orchestration/Layers/OrchestrationReactor.test.ts": 4,
249 "apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts": 66,
250 "apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts": 29,
251 "apps/server/src/orchestration/Layers/ThreadDeletionReactor.test.ts": 2,
252 "apps/server/src/orchestration/commandInvariants.test.ts": 5,
253 "apps/server/src/orchestration/projector.test.ts": 20,
254 "apps/server/src/provider/Layers/CodexAdapter.test.ts": 1,
255 "apps/server/src/provider/Layers/CodexSessionRuntime.test.ts": 5,
256 "apps/server/src/provider/Layers/CursorAdapter.test.ts": 1,
257 "apps/server/src/provider/Layers/CursorProvider.test.ts": 1,
258 "apps/server/src/provider/Layers/ProviderService.test.ts": 2,
259 "apps/server/src/provider/Layers/ProviderSessionReaper.test.ts": 12,
260 "apps/server/src/provider/acp/CursorAcpSupport.test.ts": 1,
261 }).map(([file, maxOccurrences]) => {
262 const rule: ["error", { maxOccurrences: number }] = ["error", { maxOccurrences }];
263 return { files: [file], rules: { "t3code/no-manual-effect-runtime-in-tests": rule } };
264 }),
265 ],
266 options: {
267 reportUnusedDisableDirectives: "error",
268 // Revisit once Oxlint's tsgolint path can integrate with @effect/tsgo diagnostics.
269 typeAware: false,
270 typeCheck: false,
271 },
272 },
273});