denoland / deno_ast

Source text parsing, lexing, and AST related functionality for Deno
https://crates.io/crates/deno_ast
MIT License
146 stars 45 forks source link

fix: multiline JSX string conversion to string #167

Closed marvinhagemeister closed 10 months ago

marvinhagemeister commented 10 months ago

You learn something new every day! Turns out that contrary to standard JS string literals, JSX strings are allowed to span multiple lines.

<Foo
  description="Register a module with the third party
      registry."
/>

When we convert that to a jsx() call and the values to standard string literals we need to account for this and normalize them back to a valid JS strings.

jsx(Foo, { description="Register a module with the third party registry." });