You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that there IS a space after foo in the output, however this space will typically be linted off by no-trailing-spaces rule, and even if it's not linted out of your source code, it will be ignored by React's JSX parser, meaning the output HTML will be <div>foo</div> 100% of the time.
tl;dr
<div>foo </div> becomes <div>foo</div>
The text was updated successfully, but these errors were encountered:
In that case it seems like the autofix would need to be:
<div>{'foo '}</div>
but i'm not sure it's practical to preserve the space in situations like this; the best practice when a space is important is to put it inside a string inside curlies, for reasons like this.
@ljharb I totally agree that if your whitespace is important you should contain it in curlies. But can we really justify the autofixer breaking code, even if the code is "bad"? If yes, what do you say I apply that same logic to #1497 when handling whitespace? (it's driving me nuts trying to handle it lol)
Renders a space in HTML:
<div>foo </div>
After fix is applied, it becomes:
Note that there IS a space after
foo
in the output, however this space will typically be linted off byno-trailing-spaces
rule, and even if it's not linted out of your source code, it will be ignored by React's JSX parser, meaning the output HTML will be<div>foo</div>
100% of the time.tl;dr
<div>foo </div>
becomes<div>foo</div>
The text was updated successfully, but these errors were encountered: