Trim whitespace from end of tags to fix linter warnings.#682
Trim whitespace from end of tags to fix linter warnings.#682STRML wants to merge 1 commit intofacebook:masterfrom STRML:trimWhiteSpace
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.