Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.62 KB

global-error-in-effect-failure.md

File metadata and controls

63 lines (51 loc) · 1.62 KB

globalErrorInEffectFailure

Warns when the global Error type is used in an Effect failure channel

Property Value
Category Anti-pattern
Default severity warning
Fixable No
Effect versions v3, v4
Diagnostic codes TS377023
Language Service name globalErrorInEffectFailure
Oxlint name effecttsgo/global-error-in-effect-failure

Preview

import { Effect } from "effect"

export const preview = Effect.fail(new Error("boom"))
/**
                                   ^^^^^^^^^^^^^^^^^ effecttsgo(global-error-in-effect-failure): Global 'Error' loses type safety as untagged errors merge together in the Effect failure channel. Consider using a tagged error and optionally wrapping the original in a 'cause' property.
*/

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": {
          "globalErrorInEffectFailure": "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/global-error-in-effect-failure": "warn"
  }
}