Skip to content

Latest commit

 

History

History
68 lines (55 loc) · 1.64 KB

catch-refail-to-tap-error.md

File metadata and controls

68 lines (55 loc) · 1.64 KB

catchRefailToTapError

Suggests Effect.tapError for catch handlers that sequence an effect and then re-fail the original error

Property Value
Category Style
Default severity suggestion
Fixable No
Effect versions v4
Diagnostic codes TS377133
Language Service name catchRefailToTapError
Oxlint name effecttsgo/catch-refail-to-tap-error

Preview

import { Effect } from "effect"

declare const save: Effect.Effect<void, Error>
declare const rollback: Effect.Effect<void>

export const program = save.pipe(
  Effect.catch(error => rollback.pipe(Effect.andThen(Effect.fail(error))))
/**
  ^^^^^^^^^^^^ effecttsgo(catch-refail-to-tap-error): Use Effect.tapError to observe the error and preserve the original failure without having to re-fail it.
*/
)

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": {
          "catchRefailToTapError": "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/catch-refail-to-tap-error": "warn"
  }
}