classSelfMismatch

August 4, 2026 ยท View on GitHub

Ensures Self type parameter matches the class name in Context/Service/Tag/Schema classes

PropertyValue
CategoryCorrectness
Default severityerror
FixableYes
Effect versionsv3, v4
Diagnostic codesTS377046
Language Service nameclassSelfMismatch
Oxlint nameeffecttsgo/class-self-mismatch

Preview

import * as Effect from "effect/Effect"

interface ServiceShape { value: number }

export class InvalidContextTag
  extends Effect.Tag("ValidContextTag")<ValidContextTag, ServiceShape>() {}
/**
                                        ^^^^^^^^^^^^^^^ effecttsgo(class-self-mismatch): The `Self` type parameter for this class should be `InvalidContextTag`.
*/

declare class ValidContextTag {}

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": {
          "classSelfMismatch": "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/class-self-mismatch": "warn"
  }
}