prettier icon indicating copy to clipboard operation
prettier copied to clipboard

Indent for pipeline operators

Open sosukesuzuki opened this issue 4 years ago • 3 comments

pipeline operator is a Stage-2 proposal

  • context: https://github.com/prettier/prettier/pull/11557/files#r714007093
  • ref: https://github.com/tc39/proposal-pipeline-operator

Should we add indent for pipeline?

input:

foo
|> (await %)
|> % || throw new Error(\`foo \${bar1}\`)
|> bar2(%, ", ")
|> bar3(%)
|> % + "!"
|> new Bar.Foo(%)
|> (await bar.bar(%))
|> console.log(%);

without indent(same as input):

foo
|> (await %)
|> % || throw new Error(\`foo \${bar1}\`)
|> bar2(%, ", ")
|> bar3(%)
|> % + "!"
|> new Bar.Foo(%)
|> (await bar.bar(%))
|> console.log(%);

with indent:

foo
  |> (await %)
  |> % || throw new Error(\`foo \${bar1}\`)
  |> bar2(%, ", ")
  |> bar3(%)
  |> % + "!"
  |> new Bar.Foo(%)
  |> (await bar.bar(%))
  |> console.log(%);

sosukesuzuki avatar Oct 02 '21 02:10 sosukesuzuki

/cc @fisker

sosukesuzuki avatar Oct 02 '21 02:10 sosukesuzuki

Looks good without indentation to me.

thorn0 avatar Sep 15 '22 12:09 thorn0

Missed this, I prefer add indentation.

fisker avatar Sep 15 '22 12:09 fisker