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

Don't break self closing elements with no attributes #3250

Merged
merged 5 commits into from Nov 13, 2017

Conversation

Projects
None yet
3 participants
@duailibe
Member

duailibe commented Nov 11, 2017

Fix #3234

// ----------
x = (
<p>
text text text text text text text text text text text text text text text<br />text

This comment has been minimized.

@duailibe

duailibe Nov 11, 2017

Member

To help review, the print width is in the middle of <br />

n.name && n.name.comments && n.name.comments.length;
// Don't break self-closing elements with no attributes and no comments
if (n.selfClosing && (!n.attributes || !n.attributes.length) && !nameHasComments) {

This comment has been minimized.

@lydell

lydell Nov 11, 2017

Collaborator

As far as I can tell from the next if-statement, n.attributes is always an array, so there’s no need to check if it exists.

This comment has been minimized.

@duailibe

duailibe Nov 11, 2017

Member

Yeah I was just following some previous code. I never know when properties that can be empty arrays can be undefined.

duailibe added some commits Nov 11, 2017

@duailibe duailibe merged commit 482c83d into prettier:master Nov 13, 2017

3 checks passed

codecov/patch 100% of diff hit (target 80%)
Details
codecov/project 97.05% (+<.01%) compared to bddbd19
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@duailibe duailibe deleted the duailibe:jsx-br branch Nov 13, 2017

@suchipi suchipi added this to the 1.9 milestone Nov 28, 2017

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