Repository navigation
Expand file tree
/
Copy path.oxlintrc.json
More file actions
584 lines (584 loc) · 23.7 KB
/
Copy path.oxlintrc.json
File metadata and controls
584 lines (584 loc) · 23.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
{
"$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
"extends": ["./node_modules/@effect/tsgo/oxlint-presets/recommended.json"],
"options": {
"typeAware": true,
"denyWarnings": true
},
"ignorePatterns": [
/* Reference submodules, populated by `repos:install`. */
".repos",
/* Generated from the OpenAPI spec by `packages/api/scripts/generate.ts`. */
"packages/api/src/generated/contracts.ts",
// Generated by `supabase gen types` (see `gen:feedback-types` in apps/cli).
"apps/cli/src/shared/feedback/database.types.ts",
/* Standalone Node shim built with `bun build --target node` that does not use Effect. */
"apps/cli/src/shared/cli/bin.ts",
// Templates that run inside the user's deployed container, not in the CLI process.
"apps/cli/src/shared/compute/stacks",
/* Standalone CI automation, not Effect code. `github-scripts-ci.yml` type-checks and tests it. */
".github/scripts",
/* Static JSON fixtures served by the e2e replay server. */
"apps/cli-e2e/fixtures",
/* Test fixtures and golden snapshots. */
"**/testdata",
/* Build, coverage and docs output. */
"**/dist",
"**/coverage",
"**/.next",
"**/.source"
],
"rules": {
// `new State({ ...state, ... })` is the idiomatic Data.Class copy-with-update pattern.
"typescript/no-misused-spread": "off",
// Effect combinators like `.pipe(semaphore.withPermit)` are passed as references by
// design and don't rely on `this`.
"typescript/unbound-method": "off",
// Too strict for CLI string building; `no-base-to-string` still guards
// against `[object Object]` interpolation bugs.
"typescript/restrict-template-expressions": "off"
},
"overrides": [
{
// The CLI is the stable, shipped tool; a lint-driven rewrite of
// its existing string-building code isn't worth the churn.
"files": ["apps/cli/src/**"],
"rules": {
"typescript/no-base-to-string": "off"
}
},
{
// Management API calls go through the typed `@supabase/api` client so they emit the
// `api.operation` span; tests build stub URLs freely.
"files": ["apps/cli/src/**"],
"excludeFiles": ["**/*.test.ts"],
"jsPlugins": ["./tools/oxlint/supabase-plugin.js"],
"rules": {
"supabase/no-raw-management-api-url": "error"
}
},
{
// Ambient env reads go through `CliConfigValues` (registry names) or the shared env-option
// helpers, so a stray `process.env` can't bypass the flag > shell > .env > config order.
"files": ["apps/cli/src/**"],
"excludeFiles": [
"apps/cli/src/**/*.test.ts",
"apps/cli/src/shared/config/cli-config-provider.layer.ts",
"apps/cli/src/shared/config/cli-config-env.ts"
],
"rules": {
"no-restricted-properties": [
"error",
{
"object": "process",
"property": "env",
"message": "Read env through CliConfigValues or the shared env helpers, not process.env."
},
{
"object": "Bun",
"property": "env",
"message": "Read env through CliConfigValues or the shared env helpers, not Bun.env."
},
{
"object": "globalThis",
"property": "process",
"message": "Use the bare `process` global; reading env through globalThis.process bypasses CliConfigValues."
}
]
}
},
{
// The namespace owns paths, leases, artifact pins, and port reservations; everywhere
// in the repo, outside `src/namespace/**` itself, reaches that state through
// `StackNamespace.ts`, not by importing namespace internals directly. Repo-wide (apps/cli
// included) so a deep or relative import of a namespace module fails from any package; the
// stack package's own raw-primitive restrictions are layered on top, further down.
"files": ["**/*"],
"excludeFiles": ["packages/stack/src/namespace/**", "packages/stack/src/StackNamespace.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["**/namespace/**"],
"message": "Namespace internals are private; consume them through StackNamespace.ts."
}
]
}
]
}
},
{
// Env must not be imported past `CliConfigValues`: not `env` from node:process/bun, and
// `ambientEnvironment` only in the audited files of the next override. This rule replaces the
// repo-wide one for these files, so the namespace pattern is repeated; keep the two in sync.
"files": ["apps/cli/src/**"],
"excludeFiles": [
"apps/cli/src/**/*.test.ts",
"apps/cli/src/shared/config/cli-config-provider.layer.ts",
"apps/cli/src/shared/config/cli-config-env.ts",
"apps/cli/src/cli/complete.ts",
"apps/cli/src/command-internal/colors.ts",
"apps/cli/src/command-internal/db-config.parse.ts",
"apps/cli/src/command-internal/hostname.ts",
"apps/cli/src/command-internal/pgpass.ts",
"apps/cli/src/commands/login/login-claude-hint.ts",
"apps/cli/src/commands/start/lib/env-or-default.ts",
"apps/cli/src/commands/start/services/vector.service.ts",
"apps/cli/src/shared/functions/deploy.ts"
],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "node:process",
"importNames": ["env"],
"message": "Read env through CliConfigValues or the shared env helpers, not node:process env."
},
{
"name": "process",
"importNames": ["env"],
"message": "Read env through CliConfigValues or the shared env helpers, not process env."
},
{
"name": "bun",
"importNames": ["env"],
"message": "Read env through CliConfigValues or the shared env helpers, not Bun's env export."
}
],
"patterns": [
{
"group": ["**/cli-config-provider.layer.ts"],
"importNames": ["ambientEnvironment"],
"message": "Read env through CliConfigValues; only the audited non-registry readers may import ambientEnvironment."
},
{
"group": ["**/namespace/**"],
"message": "Namespace internals are private; consume them through StackNamespace.ts."
}
]
}
]
}
},
{
// These read terminal, libpq, docker and proxy variables, never a config registry name, so
// they may import `ambientEnvironment`; the rest of the override above still applies.
"files": [
"apps/cli/src/cli/complete.ts",
"apps/cli/src/command-internal/colors.ts",
"apps/cli/src/command-internal/db-config.parse.ts",
"apps/cli/src/command-internal/hostname.ts",
"apps/cli/src/command-internal/pgpass.ts",
"apps/cli/src/commands/login/login-claude-hint.ts",
"apps/cli/src/commands/start/lib/env-or-default.ts",
"apps/cli/src/commands/start/services/vector.service.ts",
"apps/cli/src/shared/functions/deploy.ts"
],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "node:process",
"importNames": ["env"],
"message": "Read env through CliConfigValues or the shared env helpers, not node:process env."
},
{
"name": "process",
"importNames": ["env"],
"message": "Read env through CliConfigValues or the shared env helpers, not process env."
},
{
"name": "bun",
"importNames": ["env"],
"message": "Read env through CliConfigValues or the shared env helpers, not Bun's env export."
}
],
"patterns": [
{
"group": ["**/namespace/**"],
"message": "Namespace internals are private; consume them through StackNamespace.ts."
}
]
}
]
}
},
{
// Default for the whole stack package (`src/**` and `tests/**`): on top of the repo-wide
// namespace restriction above, raw `node:fs`/`node:sqlite` are confined to namespace drivers
// and a short enumerated list of files. The excluded files are direct namespace consumers
// the facade doesn't cover or raw-primitive users; they get narrower overrides further down.
// oxlint JSON has no shared lists, so the direct-consumer files are listed here and again in
// the override that restores the raw-primitive rules for them; keep the two in sync.
"files": ["packages/stack/src/**", "packages/stack/tests/**"],
"excludeFiles": [
"packages/stack/src/namespace/**",
"packages/stack/src/StackNamespace.ts",
"packages/stack/src/Network.ts",
"packages/stack/src/Network.integration.test.ts",
"packages/stack/src/Owner.ts",
"packages/stack/src/Ports.ts",
"packages/stack/src/Ports.integration.test.ts",
"packages/stack/src/Owner.integration.test.ts",
"packages/stack/src/effect.integration.test.ts",
"packages/stack/src/port-reservation.e2e.test.ts",
"packages/stack/src/host/CommandRunner.ts",
"packages/stack/src/internal/schema-writers.ts",
"packages/stack/src/preparation/ArtifactStore.ts",
"packages/stack/src/preparation/artifacts.integration.test.ts",
"packages/stack/src/runtime/Container.ts",
"packages/stack/src/runtime/NativeProcess.ts",
"packages/stack/src/runtime/native-process.integration.test.ts",
"packages/stack/src/runtime/native-launcher.ts",
"packages/stack/src/runtime/postgres-user.ts",
"packages/stack/src/services/Catalog.ts",
"packages/stack/src/services/Database.ts",
"packages/stack/src/services/DatabaseSnapshot.ts",
"packages/stack/src/services/ProcessRecipe.ts",
"packages/stack/src/storage/DockerDatabaseStorage.ts"
],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["**/namespace/**"],
"message": "Namespace internals are private; consume them through StackNamespace.ts."
}
],
"paths": [
{
"name": "node:fs",
"message": "Raw node:fs is confined to namespace drivers and a short enumerated list of existing files; use Effect's FileSystem or a namespace driver."
},
{
"name": "node:fs/promises",
"message": "Raw node:fs/promises is confined to namespace drivers and a short enumerated list of existing files; use Effect's FileSystem or a namespace driver."
},
{
"name": "node:sqlite",
"allowTypeImports": true,
"message": "Raw node:sqlite stays in namespace/drivers (plus runtime/native-launcher.ts's standalone boundary); use a namespace driver."
},
{
"name": "bun:sqlite",
"allowTypeImports": true,
"message": "Raw bun:sqlite stays in namespace/drivers (plus runtime/native-launcher.ts's standalone boundary); use a namespace driver."
}
]
}
]
}
},
{
// `StackNamespace.ts` is the facade itself: it needs namespace imports, but is still an
// ordinary consumer of raw primitives, so those restrictions stay on.
"files": ["packages/stack/src/StackNamespace.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "node:fs",
"message": "Raw node:fs is confined to namespace drivers and a short enumerated list of existing files; use Effect's FileSystem or a namespace driver."
},
{
"name": "node:fs/promises",
"message": "Raw node:fs/promises is confined to namespace drivers and a short enumerated list of existing files; use Effect's FileSystem or a namespace driver."
},
{
"name": "node:sqlite",
"allowTypeImports": true,
"message": "Raw node:sqlite stays in namespace/drivers (plus runtime/native-launcher.ts's standalone boundary); use a namespace driver."
},
{
"name": "bun:sqlite",
"allowTypeImports": true,
"message": "Raw bun:sqlite stays in namespace/drivers (plus runtime/native-launcher.ts's standalone boundary); use a namespace driver."
}
]
}
]
}
},
{
// Inside the namespace, drivers are the only place for raw `node:fs`/`node:sqlite`; sibling
// namespace modules import each other freely, so only the raw-primitive restriction repeats
// here (the facade exception above excludes this whole directory from that one).
"files": ["packages/stack/src/namespace/**"],
"excludeFiles": [
"packages/stack/src/namespace/drivers/**",
"packages/stack/src/namespace/Namespace.integration.test.ts"
],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{ "name": "node:fs", "message": "Raw node:fs stays in namespace/drivers." },
{
"name": "node:fs/promises",
"message": "Raw node:fs/promises stays in namespace/drivers."
},
{
"name": "node:sqlite",
"allowTypeImports": true,
"message": "Raw node:sqlite stays in namespace/drivers."
},
{
"name": "bun:sqlite",
"allowTypeImports": true,
"message": "Raw bun:sqlite stays in namespace/drivers."
}
]
}
]
}
},
{
// Sqlite is the driver directory's whole purpose, so it stays allowed everywhere in it; raw
// `node:fs` is narrower, limited to `FileSystem.ts` (the no-follow lstat/rmdir driver) by
// exact filename, excluded below.
"files": ["packages/stack/src/namespace/drivers/**"],
"excludeFiles": ["packages/stack/src/namespace/drivers/FileSystem.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{ "name": "node:fs", "message": "Raw node:fs stays in drivers/FileSystem.ts." },
{
"name": "node:fs/promises",
"message": "Raw node:fs/promises stays in drivers/FileSystem.ts."
}
]
}
]
}
},
{
// Synchronous existence check between manual scheduler steps; keeps the disable comment's
// reason, only sqlite stays off-limits.
"files": ["packages/stack/src/namespace/Namespace.integration.test.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "node:sqlite",
"allowTypeImports": true,
"message": "Raw node:sqlite stays in namespace/drivers."
},
{
"name": "bun:sqlite",
"allowTypeImports": true,
"message": "Raw bun:sqlite stays in namespace/drivers."
}
]
}
]
}
},
{
// Direct namespace consumers the facade doesn't cover; none of them touch raw
// node:fs/node:sqlite themselves, so that restriction stays on.
// - Network.ts, Ports.ts (+its integration test), port-reservation.e2e.test.ts: read/reserve
// ports through PortReservations, not yet on the facade.
// - Owner.ts: needs PortReservations and owned/borrowed Paths.
// - ArtifactStore.ts, artifacts.integration.test.ts: use the sqlite-pin driver and Pin;
// artifact pins are not on the facade yet.
// - Container.ts, Database.ts, ProcessRecipe.ts, Catalog.ts: need owned/borrowed Paths
// and/or Environment.
// - NativeProcess.ts, native-process.integration.test.ts: need Environment.
// - postgres-user.ts: needs the no-follow lstatPath.
// - DockerDatabaseStorage.ts: needs Publication.
// - schema-writers.ts: needs namespace Lock and Publication; the facade reaches it through
// Registry, Catalog and Database.
"files": [
"packages/stack/src/Network.ts",
"packages/stack/src/Network.integration.test.ts",
"packages/stack/src/Owner.ts",
"packages/stack/src/Ports.ts",
"packages/stack/src/Ports.integration.test.ts",
"packages/stack/src/Owner.integration.test.ts",
"packages/stack/src/effect.integration.test.ts",
"packages/stack/src/port-reservation.e2e.test.ts",
"packages/stack/src/internal/schema-writers.ts",
"packages/stack/src/preparation/ArtifactStore.ts",
"packages/stack/src/preparation/artifacts.integration.test.ts",
"packages/stack/src/runtime/Container.ts",
"packages/stack/src/runtime/NativeProcess.ts",
"packages/stack/src/runtime/native-process.integration.test.ts",
"packages/stack/src/runtime/postgres-user.ts",
"packages/stack/src/services/Catalog.ts",
"packages/stack/src/services/Database.ts",
"packages/stack/src/services/ProcessRecipe.ts",
"packages/stack/src/storage/DockerDatabaseStorage.ts"
],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "node:fs",
"message": "Raw node:fs is confined to namespace drivers and a short enumerated list of existing files; use Effect's FileSystem or a namespace driver."
},
{
"name": "node:fs/promises",
"message": "Raw node:fs/promises is confined to namespace drivers and a short enumerated list of existing files; use Effect's FileSystem or a namespace driver."
},
{
"name": "node:sqlite",
"allowTypeImports": true,
"message": "Raw node:sqlite stays in namespace/drivers (plus runtime/native-launcher.ts's standalone boundary); use a namespace driver."
},
{
"name": "bun:sqlite",
"allowTypeImports": true,
"message": "Raw bun:sqlite stays in namespace/drivers (plus runtime/native-launcher.ts's standalone boundary); use a namespace driver."
}
]
}
]
}
},
{
// `host/CommandRunner.ts` needs Environment and borrow from the namespace, plus the
// raw `rmdir` Effect's FileSystem has no non-recursive equivalent for; sqlite stays
// off-limits.
"files": ["packages/stack/src/host/CommandRunner.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "node:sqlite",
"allowTypeImports": true,
"message": "Raw node:sqlite stays in namespace/drivers."
},
{
"name": "bun:sqlite",
"allowTypeImports": true,
"message": "Raw bun:sqlite stays in namespace/drivers."
}
]
}
]
}
},
{
// `services/DatabaseSnapshot.ts` opens its own sqlite lock file for the snapshot store, a
// concern independent of the namespace's own locking; it also needs the no-follow
// lstatPath. Raw node:fs stays off-limits.
"files": ["packages/stack/src/services/DatabaseSnapshot.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "node:fs",
"message": "Raw node:fs is confined to namespace drivers and a short enumerated list of existing files; use Effect's FileSystem or a namespace driver."
},
{
"name": "node:fs/promises",
"message": "Raw node:fs/promises is confined to namespace drivers and a short enumerated list of existing files; use Effect's FileSystem or a namespace driver."
}
]
}
]
}
},
{
// Standalone process outside the Effect runtime, launched before any service is wired up: it
// calls the sqlite-pin driver and raw node:fs/node:sqlite directly by design, so none of
// the namespace restrictions apply here.
"files": ["packages/stack/src/runtime/native-launcher.ts"],
"rules": {
"no-restricted-imports": "off"
}
},
{
// Raw node:fs where Effect's FileSystem can't do the job (each import's disable comment
// gives the reason); none of these import namespace internals or raw sqlite.
"files": [
"packages/stack/src/internal/host-process.ts",
"packages/stack/src/Sweep.integration.test.ts",
"packages/stack/src/storage/DirectoryCopy.ts",
"packages/stack/src/storage/DirectoryCopy.integration.test.ts",
"packages/stack/src/effect-timeout.integration.test.ts",
"packages/stack/src/HostProcess.ts",
"packages/stack/src/functions/serve-main-resolver.integration.test.ts",
"packages/stack/tests/effect-timeout.fixture.ts",
"packages/stack/tests/host-process-fixture.ts",
"packages/stack/tests/failing-owner-fixture.ts",
"packages/stack/tests/short-registration-poll-fixture.ts",
"packages/stack/tests/gated-docker-stop-fixture.ts",
"packages/stack/tests/release-fifo.ts",
"packages/stack/tests/watch-entry.ts"
],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["**/namespace/**"],
"message": "Namespace internals are private; consume them through StackNamespace.ts."
}
],
"paths": [
{
"name": "node:sqlite",
"allowTypeImports": true,
"message": "Raw node:sqlite stays in namespace/drivers."
},
{
"name": "bun:sqlite",
"allowTypeImports": true,
"message": "Raw bun:sqlite stays in namespace/drivers."
}
]
}
]
}
},
{
// Standalone fixture process the lease waits on, outside any Effect runtime: it takes the
// same raw sqlite lock as the lease it waits for and reports over a raw fd.
// It doesn't import namespace internals, so that restriction stays on.
"files": ["packages/stack/tests/lease-wait-fixture.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["**/namespace/**"],
"message": "Namespace internals are private; consume them through StackNamespace.ts."
}
]
}
]
}
},
{
/* The Docker Engine probe needs `node:http`'s `socketPath` for unix and npipe sockets. */
"files": ["apps/cli/src/command-internal/db-bootstrap/local-db-running.ts"],
"rules": {
"effecttsgo/node-builtin-import": "off"
}
}
]
}