Skip to content

Latest commit

 

History

History
68 lines (56 loc) · 1.58 KB

File metadata and controls

68 lines (56 loc) · 1.58 KB

missingLayerContext

Detects Layer values with unhandled context requirements

Property Value
Category Correctness
Default severity error
Fixable No
Effect versions v3, v4
Diagnostic codes TS377034
Language Service name missingLayerContext
Oxlint name effecttsgo/missing-layer-context

Preview

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

class A extends Context.Service<A>()("A", { make: Effect.succeed({}) }) {
  static Default = Layer.effect(this, this.make)
}
declare const layer: Layer.Layer<A, never, A>
// @ts-expect-error
export const preview: Layer.Layer<A> = layer
/**
             ^^^^^^^ effecttsgo(missing-layer-context): Missing 'A' in the expected Layer context.
*/

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": {
          "missingLayerContext": "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/missing-layer-context": "warn"
  }
}