Skip to content

feat(missedPipeableOpportunity): configurable output style — pipe(x, …) vs x.pipe(…) #764

Description

@jasonkuhrt

Summary

missedPipeableOpportunity only targets the method form x.pipe(a, b). Codebases whose house style is the standalone pipe(x, a, b) function form can't make this diagnostic emit their style — enabling it pushes code the opposite way, so they must leave it off and lose chain-enforcement entirely. Requesting an option to select output style.

Current behavior

packages/language-service/src/diagnostics/missedPipeableOpportunity.ts hardcodes the method form in both the message (~L235, `${subjectText}.pipe(...)`) and the fix (~L257):

const pipeNode = ts.factory.createCallExpression(
  ts.factory.createPropertyAccessExpression(pipeableSubjectNode, 'pipe'),
  undefined,
  pipeArgs,
)

Only pipeableMinArgCount is configurable; nothing controls method-vs-function.

Proposal

Add pipeableStyle: "method" | "data-first" (default "method" preserves today). When "data-first", emit pipe(subject, ...pipeArgs) — a sibling node, and pipe is already imported from effect/Function in this file. The repo already models this axis via the togglePipeStyle / pipeableToDatafirst refactors; this asks the diagnostic to honor it too.

Environment

@effect/tsgo@0.19.0, Effect v4 (4.0.0-beta.98).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions