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

PropertyValue
CategoryStyle
Default severitysuggestion
FixableYes
Effect versionsv3, v4
Diagnostic codesTS377100
Language Service nameflatMapToMap
Oxlint nameeffecttsgo/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"
  }
}