Suggests Effect.timeoutOrElse when Effect.raceFirst has exactly one sleep- or delay-based timer arm
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | No |
| Effect versions | v4 |
| Diagnostic codes | TS377121 |
| Language Service name | raceFirstWithSleepToTimeout |
| Oxlint name | effecttsgo/race-first-with-sleep-to-timeout |
import { Effect } from "effect"
declare const request: Effect.Effect<string, Error>
export const result = Effect.raceFirst(
/**
^^^^^^^^^^^^^^^^ effecttsgo(race-first-with-sleep-to-timeout): This Effect first-completion race has exactly one sleep- or delay-based timer arm. `Effect.timeoutOrElse` expresses the timeout and fallback directly.
*/
request,
Effect.sleep("5 seconds").pipe(
Effect.andThen(Effect.fail(new Error("request timed out")))
)
)See the Language Service setup guide for installation instructions.
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/race-first-with-sleep-to-timeout": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "raceFirstWithSleepToTimeout": "warning" } } ] } }