Skip to content

Latest commit

 

History

History
70 lines (56 loc) · 1.74 KB

redundant-or-die.md

File metadata and controls

70 lines (56 loc) · 1.74 KB

redundantOrDie

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

Preview

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)
})

Language Service Configuration

See the Language Service setup guide for installation instructions.

{
  "$schema": "./node_modules/@effect/tsgo/schema.json",
  "compilerOptions": {
    "plugins": [
      {
        "name": "@effect/language-service",
        "diagnosticSeverity": {
          "redundantOrDie": "warning"
        }
      }
    ]
  }
}

Oxlint Configuration

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"
  }
}