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

vite.config.ts

218 lines8.6 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 // Code that runs on Hermes. It has no ES2023 change-array-by-copy methods, and
141 // tsconfig targets ESNext, so only lint stands between a call and a fatal launch.
142 // Tests run on Node and are exempt.
143 files: [
144 "apps/mobile/src/**",
145 "packages/client-runtime/src/**",
146 "packages/contracts/src/**",
147 "packages/shared/src/**",
148 ],
149 excludeFiles: ["**/*.test.ts", "**/*.test.tsx"],
150 rules: { "t3code/no-hermes-unsupported-array-methods": "error" },
151 },
152 {
153 // Reviewed native and third-party interop boundaries that cannot consume a className.
154 files: [
155 "apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx",
156 "apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx",
157 "apps/mobile/src/features/files/FileMarkdownPreview.tsx",
158 "apps/mobile/src/features/files/SourceFileSurface.tsx",
159 "apps/mobile/src/features/files/AttachmentFileScreen.tsx",
160 "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
161 "apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
162 "apps/mobile/src/features/home/HomeHeader.tsx",
163 "apps/mobile/src/features/review/ReviewSheet.tsx",
164 "apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
165 "apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
166 "apps/mobile/src/features/settings/appearance/components/AppearancePreviews.tsx",
167 "apps/mobile/src/features/threads/GitActionProgressOverlay.tsx",
168 "apps/mobile/src/features/threads/NewTaskDraftScreen.tsx",
169 "apps/mobile/src/features/threads/ThreadComposer.tsx",
170 "apps/mobile/src/features/threads/ThreadFeed.tsx",
171 "apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx",
172 "apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx",
173 "apps/mobile/src/features/threads/ThreadQueueControl.tsx",
174 "apps/mobile/src/features/threads/ThreadRelationshipsBanner.tsx",
175 "apps/mobile/src/features/review/ReviewCommentCard.tsx",
176 "apps/mobile/src/features/threads/ThreadSettingsSheet.tsx",
177 "apps/mobile/src/features/threads/git/GitOverviewSheet.tsx",
178 "apps/mobile/src/features/threads/thread-list-items.tsx",
179 "apps/mobile/src/features/threads/thread-list-v2-items.tsx",
180 "apps/mobile/src/lib/useMobileNavigationTheme.ts",
181 "apps/mobile/src/native/T3ComposerEditor.ios.tsx",
182 "apps/mobile/src/native/T3ComposerEditor.native.tsx",
183 ],
184 rules: {
185 "t3code/no-mobile-uniwind-theme-escape-hatches": ["error", { allowUniwindTheme: true }],
186 },
187 },
188 // Legacy manual Effect runners tracked as debt: no net-new occurrences.
189 // Lower a ceiling when you migrate a file, and delete its entry at zero.
190 ...Object.entries({
191 "apps/server/src/orchestration/Layers/CheckpointReactor.test.ts": 42,
192 "apps/server/src/orchestration/Layers/OrchestrationEngine.test.ts": 5,
193 "apps/server/src/orchestration/Layers/OrchestrationReactor.test.ts": 4,
194 "apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts": 66,
195 "apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts": 29,
196 "apps/server/src/orchestration/Layers/ThreadDeletionReactor.test.ts": 2,
197 "apps/server/src/orchestration/commandInvariants.test.ts": 5,
198 "apps/server/src/orchestration/projector.test.ts": 20,
199 "apps/server/src/provider/Layers/CodexAdapter.test.ts": 1,
200 "apps/server/src/provider/Layers/CodexSessionRuntime.test.ts": 5,
201 "apps/server/src/provider/Layers/CursorAdapter.test.ts": 1,
202 "apps/server/src/provider/Layers/CursorProvider.test.ts": 1,
203 "apps/server/src/provider/Layers/ProviderService.test.ts": 2,
204 "apps/server/src/provider/Layers/ProviderSessionReaper.test.ts": 12,
205 "apps/server/src/provider/acp/CursorAcpSupport.test.ts": 1,
206 }).map(([file, maxOccurrences]) => {
207 const rule: ["error", { maxOccurrences: number }] = ["error", { maxOccurrences }];
208 return { files: [file], rules: { "t3code/no-manual-effect-runtime-in-tests": rule } };
209 }),
210 ],
211 options: {
212 reportUnusedDisableDirectives: "error",
213 // Revisit once Oxlint's tsgolint path can integrate with @effect/tsgo diagnostics.
214 typeAware: false,
215 typeCheck: false,
216 },
217 },
218});