returnEffectInGen

August 4, 2026 ยท View on GitHub

Warns when returning an Effect in a generator causes nested Effect<Effect<...>>

PropertyValue
CategoryAnti-pattern
Default severitysuggestion
FixableYes
Effect versionsv3, v4
Diagnostic codesTS377014
Language Service namereturnEffectInGen
Oxlint nameeffecttsgo/return-effect-in-gen

Preview

import * as Effect from "effect/Effect"

export const preview = Effect.gen(function*() {
  return Effect.succeed(1)
/**
  ^^^^^^ effecttsgo(return-effect-in-gen): This generator returns an Effect-able value directly, which produces a nested `Effect<Effect<...>>`. If the intended result is the inner Effect value, `return yield*` represents that form.
*/
})

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": {
          "returnEffectInGen": "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/return-effect-in-gen": "warn"
  }
}