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

vite.config.ts

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