Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 1.62 KB

promise-in-effect-success.md

File metadata and controls

65 lines (52 loc) · 1.62 KB

promiseInEffectSuccess

Detects Promise types in Effect success channels where they are not awaited

Property Value
Category Correctness
Default severity warning
Fixable No
Effect versions v3, v4
Diagnostic codes TS377108
Language Service name promiseInEffectSuccess
Oxlint name effecttsgo/promise-in-effect-success

Preview

import { Effect } from "effect"

declare const save: (value: number) => Promise<void>

export const preview = Effect.succeed(1).pipe(Effect.map(save))
/**
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(promise-in-effect-success): The Effect success channel contains a Promise that is not awaited. Use Effect.promise or Effect.tryPromise to represent async work.
*/

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": {
          "promiseInEffectSuccess": "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/promise-in-effect-success": "warn"
  }
}