Suggests hoisting a repeated trailing Effect.orDie from every yield in an Effect generator
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | No |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377096, TS377097 |
| Language Service name | redundantOrDie |
| Oxlint name | effecttsgo/redundant-or-die |
import { Effect } from "effect"
declare const first: Effect.Effect<number, unknown>
declare const second: Effect.Effect<string, unknown>
export const program = Effect.gen(function*() {
/**
^^^^^^^^^ effecttsgo(redundant-or-die): This generator applies `Effect.orDie` to every yielded effect. Hoist it once to the generator result: `Effect.gen(...).pipe(Effect.orDie)`, or `Effect.fn(function*(){ ... }, Effect.orDie)`.
*/
yield* first.pipe(Effect.orDie)
return yield* second.pipe(Effect.orDie)
})See the Language Service setup guide for installation instructions.
See the Oxlint setup guide for installation and patching instructions.
{
"$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
"options": {
"typeAware": true
},
"plugins": ["effecttsgo"],
"rules": {
"effecttsgo/redundant-or-die": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "redundantOrDie": "warning" } } ] } }