Suggests using Effect.fn for functions that return an Effect
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | Yes |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377047 |
| Language Service name | effectFnOpportunity |
| Oxlint name | effecttsgo/effect-fn-opportunity |
import * as Effect from "effect/Effect"
export const preview = () => Effect.gen(function*() {
/**
^^^^^^^ effecttsgo(effect-fn-opportunity): This expression can be rewritten in the reusable function form `Effect.fn(function*() { ... })`.
*/
return yield* Effect.succeed(1)
})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/effect-fn-opportunity": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "effectFnOpportunity": "warning" } } ] } }