-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
Transform: Tab \t
in JSX should be trimmed
#6638
Comments
I think this should be fixed in parser (not transformer). I don't think we should have had nodes like this in the AST in the first place: JSXText {
span: Span { start: 68, end: 72 },
value: "\n\t\t\t",
} @Boshen can you confirm I am right about that? |
When I attempted to fix the issue, I suspected the parser. When I tried to fix it, I suspected the parser might be the issue. |
Re-opening as would like @Boshen's view on whether parser should be producing these If I remember right, we decided that our support for JSX is limited to React JSX (and React-like JSX, e.g. Vue), rather than attempting to follow the full "abstract" JSX spec. Therefore, even if JSX spec says these In React JSX (and ditto Vue) whitespace in these positions is not semantically meaningful. We don't use a Concrete Syntax Tree so, like other semantically-meaningless whitespace, personally I don't think this should appear in the AST. It's not purely an academic question. In typical React/Vue/etc code, our AST will contain a lot of these pointless |
The parser is correct according to the spec https://facebook.github.io/jsx/#prod-JSXText The transformer is responsible for how to deal with these whitespaces, which is also correct, because our jsx transform is correct. |
OXC playground
The text was updated successfully, but these errors were encountered: