Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[assignment] proper group #4932

Merged
merged 1 commit into from Aug 3, 2018

Conversation

@vjeux
Copy link
Collaborator

commented Aug 2, 2018

If you have

a = b

we used to do

group[a = b]

which works most of the time but has the unfortunate side effect that if the left part breaks, we're going to break the = as well. So you get

{
  a
} = \n
  b

What this PR does it to add a group

group[a group[= b]]

so that if the right hand side fits in one line, it should stay that way.

Note that there's a change with a comment being move but I think that it's fine. If I remember correctly, this test was to make sure that we didn't print invalid code, not that it had to be respected (that comment position is not something we really want to support in the first place).

Fixes #4645

[assignment] proper group
If you have

```js
a = b
```

we used to do

```js
group[a = b]
```

which works most of the time but has the unfortunate side effect that if the left part breaks, we're going to break the `=` as well. So you get

```js
{
  a
} = \n
  b
```

What this PR does it to add a group

```js
group[a group[= b]]
```

so that if the right hand side fits in one line, it should stay that way.

Note that there's a change with a comment being move but I think that it's fine. If I remember correctly, this test was to make sure that we didn't print invalid code, not that it had to be respected (that comment position is not something we really want to support in the first place).

Fixes #4645
} = getPressRectOffset == null ? DEFAULT_PRESS_RECT : getPressRectOffset();

const { accessibilityModule: FooAccessibilityModule, accessibilityModule: FooAccessibilityModule, accessibilityModule: FooAccessibilityModule, accessibilityModule: FooAccessibilityModule,
} = foo || {};

This comment has been minimized.

@vjeux vjeux requested review from duailibe, j-f1 and suchipi Aug 2, 2018

@vjeux

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 2, 2018

This is impacting the rollout of Airbnb using Prettier, so would be awesome to get a point release with this fix if possible <3

@ikatyang ikatyang added this to the 1.14.1 milestone Aug 2, 2018

@skevy

This comment has been minimized.

Copy link

commented Aug 3, 2018

Thanks @vjeux! And yah, he's right. Let me know if you're able to do a point release soon! Thanks so much. :)

@vjeux vjeux merged commit 3b3240b into prettier:master Aug 3, 2018

10 checks passed

ci/circleci: build_prod Your tests passed on CircleCI!
Details
ci/circleci: checkout_code Your tests passed on CircleCI!
Details
ci/circleci: test_prod_node4 Your tests passed on CircleCI!
Details
ci/circleci: test_prod_node9 Your tests passed on CircleCI!
Details
ci/circleci: test_prod_standalone Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 80%)
Details
codecov/project 96.48% (+0%) compared to b6077e1
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
@ikatyang

This comment has been minimized.

Copy link
Member

commented Aug 8, 2018

Just released 1.14.1, sorry for the delay.

@vjeux

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 8, 2018

@ikatyang thanks so much!!

@lock lock bot locked as resolved and limited conversation to collaborators Nov 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.