Allow to break after = for strings #1142

Merged
merged 1 commit into from Apr 7, 2017

Conversation

Projects
None yet
3 participants
@vjeux
Collaborator

vjeux commented Apr 6, 2017

This is not a general fix but it solves some issues that people are seeing where prettier goes > 80 columns.

Fixes #1141
Also fixes part of #1110

@vjeux vjeux referenced this pull request Apr 6, 2017

Closed

array access then assignment #1141

src/printer.js
+ ) {
+ printed = indent(
+ options.tabWidth,
+ concat([line, printedRight])

This comment has been minimized.

@jlongster

jlongster Apr 7, 2017

Member

Couldn't this be collapsed with the previous else if? The contents are the same code.

@jlongster

jlongster Apr 7, 2017

Member

Couldn't this be collapsed with the previous else if? The contents are the same code.

This comment has been minimized.

@vjeux

vjeux Apr 7, 2017

Collaborator

Good eye! I actually copy and pasted this from the one two levels above which does hardline instead of line :)

@vjeux

vjeux Apr 7, 2017

Collaborator

Good eye! I actually copy and pasted this from the one two levels above which does hardline instead of line :)

@jlongster

This comment has been minimized.

Show comment
Hide comment
@jlongster

jlongster Apr 7, 2017

Member

If you collapse the if statements, you can merge this

Member

jlongster commented Apr 7, 2017

If you collapse the if statements, you can merge this

Allow to break after = for strings
This is not a general fix but it solves some issues that people are seeing where prettier goes > 80 columns.

Fixes #1141
Also fixes part of #1110

@vjeux vjeux merged commit 41dee70 into prettier:master Apr 7, 2017

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@bakkot

This comment has been minimized.

Show comment
Hide comment
@bakkot

bakkot Apr 7, 2017

Collaborator

Can I ask - why just for strings and binary expressions? It seems a reasonable enough place to break in general.

Collaborator

bakkot commented Apr 7, 2017

Can I ask - why just for strings and binary expressions? It seems a reasonable enough place to break in general.

@vjeux

This comment has been minimized.

Show comment
Hide comment
@vjeux

vjeux Apr 7, 2017

Collaborator

There are many cases where it looks odd:

var x =
  {
    someObject: true
  };
var x =
  someLongCall(
    a
  );
Collaborator

vjeux commented Apr 7, 2017

There are many cases where it looks odd:

var x =
  {
    someObject: true
  };
var x =
  someLongCall(
    a
  );
@bakkot

This comment has been minimized.

Show comment
Hide comment
@bakkot

bakkot Apr 7, 2017

Collaborator

Those look fine to me ¯\_(ツ)_/¯

Better than letting it get longer than 80 characters, anyway.

Collaborator

bakkot commented Apr 7, 2017

Those look fine to me ¯\_(ツ)_/¯

Better than letting it get longer than 80 characters, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment