Suggests Effect.tap when a flatMap or andThen callback runs an effect and returns its unchanged parameter
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | Yes |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377144 |
| Language Service name | flatMapToTap |
| Oxlint name | effecttsgo/flat-map-to-tap |
import { Effect } from "effect"
interface User {
readonly id: string
readonly name: string
}
declare const findUser: (id: string) => Effect.Effect<User>
declare const auditUser: (user: User) => Effect.Effect<void>
export const loadUser = (id: string) => findUser(id).pipe(
Effect.flatMap((user) => auditUser(user).pipe(Effect.as(user)))
/**
^^^^^^^^^^^^^^ effecttsgo(flat-map-to-tap): `Effect.tap` expresses this observation more directly than `Effect.flatMap` with a manual re-yield.
*/
)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/flat-map-to-tap": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "flatMapToTap": "warning" } } ] } }