Skip to content

run-only-in-runner

Intent: Effects run only in the program’s runner, the entry point.

// ❌ no
export const check = () => Effect.runPromise(pingDb(url))
// ✅ yes: in main.ts
NodeRuntime.runMain(
run(process.argv.slice(2)).pipe(Effect.provide(NodeServices.layer)) satisfies Effect.Effect<
void,
never
>,
)

Trigger: every reference, not just calls, to Effect.run*, NodeRuntime.runMain, BunRuntime.runMain and ManagedRuntime.make outside entry files.

Exemptions and blind spots: test files, checked by prefer-effect-vitest instead.

Why: logger, Layers and defect handling are configured in one place.

Options:

Fix: none