Suggests using Runtime or Effect.runWith methods instead of Effect.run inside Effect contexts
| Property | Value |
|---|---|
| Category | Anti-pattern |
| Default severity | suggestion |
| Fixable | Yes |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377024, TS377025, TS377074, TS377160 |
| Language Service name | runEffectInsideEffect |
| Oxlint name | effecttsgo/run-effect-inside-effect |
import { Effect } from "effect"
export const preview = Effect.gen(function*() {
const run = () => Effect.runSync(Effect.succeed(1))
/**
^^^^^^^^^^^^^^ effecttsgo(run-effect-inside-effect): `Effect.runSync` is called inside an Effect with a separate services invocation. In this context, child Effects run with the surrounding services, which can be accessed through `Effect.context` and `Effect.runSyncWith`.
*/
return run()
})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/run-effect-inside-effect": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "runEffectInsideEffect": "warning" } } ] } }