strictEffectProvide

August 4, 2026 ยท View on GitHub

Warns when using Effect.provide with layers outside of application entry points

PropertyValue
CategoryAnti-pattern
Default severityoff
FixableNo
Effect versionsv3, v4
Diagnostic codesTS377032
Language Service namestrictEffectProvide
Oxlint nameeffecttsgo/strict-effect-provide

Preview

import { Effect, Layer, Context } from "effect"

class Config extends Context.Service<Config>()("Config", { make: Effect.succeed({}) }) {
  static Default = Layer.effect(this, this.make)
}
export const preview = Effect.void.pipe(Effect.provide(Config.Default))
/**
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(strict-effect-provide): Effect.provide with a Layer should only be used at application entry points. If this is an entry point, you can safely disable this diagnostic. Otherwise, using Effect.provide may break scope lifetimes. Compose all layers at your entry point and provide them at once.
*/

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": {
          "strictEffectProvide": "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/strict-effect-provide": "warn"
  }
}