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
Merged

Conversation

vjeux
Copy link
Contributor

@vjeux vjeux 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

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 prettier#4645
} = getPressRectOffset == null ? DEFAULT_PRESS_RECT : getPressRectOffset();

const { accessibilityModule: FooAccessibilityModule, accessibilityModule: FooAccessibilityModule, accessibilityModule: FooAccessibilityModule, accessibilityModule: FooAccessibilityModule,
} = foo || {};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vjeux vjeux requested review from duailibe, j-f1 and suchipi August 2, 2018 22:42
@vjeux
Copy link
Contributor Author

vjeux 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
Copy link

skevy 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. :)

@ikatyang
Copy link
Member

ikatyang commented Aug 8, 2018

Just released 1.14.1, sorry for the delay.

@vjeux
Copy link
Contributor Author

vjeux commented Aug 8, 2018

@ikatyang thanks so much!!

@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Nov 6, 2018
@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.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants