Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

vite.config.ts

203 lines8.0 KB

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