Suggests using Effect.asSome instead of Effect.map when the mapper only wraps the success value with Option.some
| Property | Value |
|---|---|
| Category | Style |
| Default severity | suggestion |
| Fixable | Yes |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377114 |
| Language Service name | mapSomeToAsSome |
| Oxlint name | effecttsgo/map-some-to-as-some |
import { Effect, Option } from "effect"
const numberEffect = Effect.succeed(1)
export const pipeable = numberEffect.pipe(
Effect.map(Option.some)
/**
^^^^^^^^^^ effecttsgo(map-some-to-as-some): `Effect.asSome` expresses wrapping the success value in `Option.some` directly.
*/
)
export const etaExpanded = numberEffect.pipe(
Effect.map((value) => Option.some(value))
/**
^^^^^^^^^^
*/
)
export const dataFirst = Effect.map(numberEffect, Option.some)
/**
^^^^^^^^^^
*/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/map-some-to-as-some": "warn"
}
}
{ "$schema": "./node_modules/@effect/tsgo/schema.json", "compilerOptions": { "plugins": [ { "name": "@effect/language-service", "diagnosticSeverity": { "mapSomeToAsSome": "warning" } } ] } }