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

vite.config.ts

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