flatMapToMap
August 4, 2026 ยท View on GitHub
Suggests using Effect.map instead of Effect.flatMap when the callback only wraps its result with Effect.succeed
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | Yes |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377100 |
| Language Service name | flatMapToMap |
| Oxlint name | effecttsgo/flat-map-to-map |
Preview
import { Effect } from "effect"
const program = Effect.succeed(1).pipe(
Effect.flatMap((value) => Effect.succeed(value + 1))
/**
^^^^^^^^^^^^^^ effecttsgo(flat-map-to-map): `Effect.map` expresses this success-value transformation more directly than `Effect.flatMap` followed by `Effect.succeed`.
*/
)
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": {
"flatMapToMap": "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/flat-map-to-map": "warn"
}
}