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
Trims whitespace in the following cases (mentioned node might be a parent or a sibling):
leading whitespace if this is the first node on the same line
trailing whitespace if this is the last node on the same line
Inserts a single whitespace if the next sibling is also JSXText and not on the same line
Any whitespace tabs (alt09) is replaced with a single spacedemo
Am I missing something ... and is this already documented elsewhere (specifically 2 wasn't mentioned explicitly anywhere I could find). Need this information to help with TypeScript/TSX integration 🌹
I know this is specific to React Emit for JSX but this seemed like the more appropriate repo 😃
The idea being that indentation is not intended for output and trailing whitespace is a bad idea all-around. 2 is added because that is almost universally what you want and not having it is really really cumbersome and mistake-prone.
@syranide reading that I can only see that there is one more rule regarding tab handling. I've updated the original question with point 3, and also see demo
I'm thinking maybe we should add some kind of react.md in this repo?
I would prefer whitespace.md. Even though the thing I am discussing feels react emit specific, but I feel that not having whitespace rules specified in jsx decreases its portability.
Consider:
<div>
test
</div>
Would be weird if something things see it as test (like react) and other's see it as \ntest\n. But react.md is fine as well :)
Activity
syranide commentedon Aug 20, 2015
react/react#480 (comment), there is also the full technical reasoning react/react#480, but it may be a bit hard to digest.
The idea being that indentation is not intended for output and trailing whitespace is a bad idea all-around. 2 is added because that is almost universally what you want and not having it is really really cumbersome and mistake-prone.
basarat commentedon Aug 21, 2015
@syranide reading that I can only see that there is one more rule regarding
tabhandling. I've updated the original question with point3, and also see demoCheers 🌹
RReverser commentedon Aug 21, 2015
This question is being raised rather often, I'm thinking maybe we should add some kind of
react.mdin this repo?basarat commentedon Aug 24, 2015
I would prefer
whitespace.md. Even though the thing I am discussing feels react emit specific, but I feel that not having whitespace rules specified injsxdecreases its portability.Consider:
Would be weird if something things see it as
test(like react) and other's see it as\ntest\n. But react.md is fine as well :)syranide commentedon Aug 24, 2015
@basarat "other's see it as
\ntest\n", which ones are that?basarat commentedon Aug 24, 2015
Other implementations that might use JSX for an HTML emit