effectFnIife

August 4, 2026 ยท View on GitHub

Effect.fn or Effect.fnUntraced is called as an IIFE; use Effect.gen instead

PropertyValue
CategoryAnti-pattern
Default severitywarning
FixableYes
Effect versionsv3, v4
Diagnostic codesTS377011
Language Service nameeffectFnIife
Oxlint nameeffecttsgo/effect-fn-iife

Preview

import * as Effect from "effect/Effect"

export const preview = Effect.fn("preview")(function*() {
/**
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(effect-fn-iife): `Effect.fn` returns a reusable function that can take arguments, but it is invoked immediately here. `Effect.gen` represents the immediate-use form for this pattern with Effect.withSpan("preview") piped in the end to maintain tracing spans.
*/
  return yield* Effect.succeed(1)
/**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
})()
/**
^^^^
*/

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": {
          "effectFnIife": "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/effect-fn-iife": "warn"
  }
}