Suggests Effect.result, Effect.option or Effect.either when match handlers, or a map step followed by a catch step, only reify the outcome
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | Yes |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377175 |
| Language Service name | matchToResultOrOption |
| Oxlint name | effecttsgo/match-to-result-or-option |
import { Data, Effect, Result } from "effect"
class UserNotFound extends Data.TaggedError("UserNotFound")<{
readonly id: string
}> {}
declare const fetchUser: (id: string) => Effect.Effect<{ readonly name: string }, UserNotFound>
// MUST TRIGGER: both handlers only reify the outcome, which is Effect.result
export const userResult = Effect.match(fetchUser("u1"), {
/**
^^^^^^^^^^^^ effecttsgo(match-to-result-or-option): `Effect.result` reifies the outcome directly; these `Effect.match` handlers only wrap the value and the error.
*/
onFailure: (e) => Result.fail(e),
onSuccess: (user) => Result.succeed(user)
})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/match-to-result-or-option": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "matchToResultOrOption": "warning" } } ] } }