Skip to content

Latest commit

 

History

History
67 lines (55 loc) · 1.67 KB

unnecessary-fail-yieldable-error.md

File metadata and controls

67 lines (55 loc) · 1.67 KB

unnecessaryFailYieldableError

Suggests yielding yieldable errors directly instead of wrapping with Effect.fail

Property Value
Category Style
Default severity suggestion
Fixable Yes
Effect versions v3, v4
Diagnostic codes TS377019
Language Service name unnecessaryFailYieldableError
Oxlint name effecttsgo/unnecessary-fail-yieldable-error

Preview

import * as Data from "effect/Data"
import * as Effect from "effect/Effect"

class Boom extends Data.TaggedError("Boom")<{}> {}
export const preview = Effect.gen(function*() {
  yield* Effect.fail(new Boom())
/**
  ^^^^^ effecttsgo(unnecessary-fail-yieldable-error): This `yield* Effect.fail(...)` passes a yieldable error value. `yield*` represents that value directly without wrapping it in `Effect.fail`.
*/
})

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": {
          "unnecessaryFailYieldableError": "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/unnecessary-fail-yieldable-error": "warn"
  }
}