-
Notifications
You must be signed in to change notification settings - Fork 47.8k
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
Trim whitespace from end of tags to fix linter warnings. #682
Conversation
cc @jeffmo who can help with transform-related code. Personally, I think we might want to be a bit less naive and forward look to see if we're at the end of a line. Take this for example: <div id="foo">
Hello
<span>{this.props.name}</span>
</div> It gets transformed to this before your change: React.DOM.div( {id:"foo"},
" Hello ",
React.DOM.span(null, this.props.name)
) There is a trailing space on line 2 but there’s also a space after With your change we blindly lose that space for inline children, which will probably make somebody else’s linter complain. If we’re going to change this at all, I think we should do it completely. |
I could possibly look into this, but I would recommend waiting for #480 to ship as it already touches most of JSXTransformer. |
@STRML, are you still interested in doing this? |
(Nvm, ignore this, not fixed). |
👍 |
@zpao Correct :) |
@STRML updated the pull request. |
I'm building SublimeLinter-jsxhint for proper JSX linting in Sublime Text 3. Unfortunately we get trailing whitespace issues at the end of tags with the current version of react.
Deleting the trailing whitespace at L135 fixes the linter warnings and does not affect the output.