oxc-project / oxc

⚓ A collection of JavaScript tools written in Rust.
https://oxc.rs
MIT License
11.87k stars 426 forks source link

Transform: Tab `\t` in JSX should be trimmed #6638

Open magic-akari opened 12 hours ago

magic-akari commented 12 hours ago

OXC playground

overlookmotel commented 8 hours ago

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?

magic-akari commented 5 hours ago

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. But upon examining the AST outputs from both TypeScript and Babel, I discovered that they were both present in the AST.

When I tried to fix it, I suspected the parser might be the issue. However, after reviewing the AST outputs from both TypeScript and Babel, I realized that they arre preserved in the AST.