Fix vue self-closing tags#3693
Merged
azz merged 1 commit intoprettier:masterfrom Jan 10, 2018
Merged
Conversation
Member
Author
vjeux
approved these changes
Jan 10, 2018
Contributor
vjeux
left a comment
There was a problem hiding this comment.
I had issues with self closing tags but thought I fixed them... apparently not! Good catch.
|
|
||
| // Only force a trailing newline if there were any contents. | ||
| if (n.tag === "root" && n.children.length) { | ||
| res.push(hardline); |
Contributor
There was a problem hiding this comment.
What happens if there’s already a trailing (or more) new line, is it going to add one more?
Member
Author
There was a problem hiding this comment.
It does... I tried to do a right trim on the content but it didn't work.
Contributor
There was a problem hiding this comment.
I also tried to normalize this but figured it would not be worth it. I think that the best way forward is to pretty print the first depth of html for vue files. This way we clean up the code a bit more and will handle this newline.
Member
Author
There was a problem hiding this comment.
Actually no, it works just fine as is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Looks like the way the parsing works doesn't add
endproperties to self-closing tags and their parents (all the way up?). Couldn't figure out a nice way to fix it in the parser so just did it in the printer for now.Copied in an example component from GitLabHQ.
Fixes #3692