-
Notifications
You must be signed in to change notification settings - Fork 67
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 ignore whitespace in expressions #930
Conversation
🦋 Changeset detectedLatest commit: 5f41338 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
clean := "" | ||
if n.FirstChild != nil { | ||
clean = strings.TrimSpace(n.FirstChild.Data) | ||
} | ||
if n.FirstChild == nil || clean == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now need to check for whitespace too as the parser doesn't remove them in expressions anymore.
} else if expressionOnlyHasComment(n) { | ||
// we do not print expressions that only contain comment blocks | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't ignore expressions with only comments in the TSX output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I wonder why Nate added that check initially?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, I was wondering the same as that would unexpectedly remove TS directives like @ts-ignore
in this case.
Pinging @natemoo-re, maybe he could provide some background
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't remember the context! Guessing it was just a copy + paste from the JS output which has special handling for this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admittedly not super familiar with the logic around these parts, but this looks good to me!
Changes
Testing
Docs
N/A bug fix