max-mapper / standard-format

converts your code into Standard JavaScript Format
264 stars 59 forks source link

new line indentation after `&&` and `=` #105

Closed jney closed 7 years ago

jney commented 9 years ago

i'm using last standard-format (1.6.6) and i've got the following input, that i expected not to be modified

var foo =
  'very long liiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnneeeee'

var foo =
  Foo
  .bar
  .baz

foo &&
  bar

but it is indented like this :

var foo =
'very long liiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnneeeee'

var foo =
Foo
  .bar
  .baz

foo &&
bar

I'm not sure if it is the expected behaviour or a "bug"

bcomnes commented 9 years ago

We have some test cases for the indentation after a newline following the assignment operator (currently failing).

We need to add one for && I think, as well as track down the source of the issue.

nrw commented 9 years ago

i think this is related:

this input:

var load = JSON.parse(value || JSON.stringify({
  playlists: true
}))

gets reformatted like this

var load = JSON.parse(value || JSON.stringify({
    playlists: true
  }))
feross commented 7 years ago

You should use standard --fix instead of this package. standard-format isn't being actively maintained anymore.