prettier: Pipe operator with comment problem

Prettier 1.14.2 Playground link

--parser babylon

Input:


export default Component
  // |> branch(propEq('isReady', false), renderNothing)
  |> connect(
    createStructuredSelector({
      isReady,
    }),
  );

Output:

export default Component
  |> // |> branch(propEq('isReady', false), renderNothing)
  connect(
    createStructuredSelector({
      isReady
    })
  );

Expected behavior: (no change)


export default Component
  // |> branch(propEq('isReady', false), renderNothing)
  |> connect(
    createStructuredSelector({
      isReady,
    }),
  );

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

I think it should stay before the second parameter since it’s kind of a control flow operator like ?:. Also, I’d expect there to be some long chains of |>, while that is less likely to happen with *, or, given the presence of template expressions, +.