effectFnIife
August 4, 2026 ยท View on GitHub
Effect.fn or Effect.fnUntraced is called as an IIFE; use Effect.gen instead
| Property | Value |
|---|---|
| Category | Anti-pattern |
| Default severity | warning |
| Fixable | Yes |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377011 |
| Language Service name | effectFnIife |
| Oxlint name | effecttsgo/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"
}
}