acornjs / acorn-jsx

Alternative, faster React.js JSX parser
MIT License
651 stars 74 forks source link

String Literals with newline not as expected #119

Closed paranoidjk closed 4 years ago

paranoidjk commented 4 years ago

Demo JSX Code

image

AST Result

test in https://astexplorer.net/

image

Expect Result

according to https://reactjs.org/docs/jsx-in-depth.html image

RReverser commented 4 years ago

This is a parser, not a React-specific transpiler. It intentionally returns the original text in case some other implementation of JSX wants to preserve those spaces.

paranoidjk commented 4 years ago

@RReverser Thanks for your quick answer, i try it in babel repl, loooks like it works fine

image

I just wonder if the acorn jsx parser don't do this, who did this job?