denoland / deno_ast

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

fix: treat jsx expr tag names as components #258

Closed marvinhagemeister closed 1 month ago

marvinhagemeister commented 1 month ago

This fixes an issue when an expression is passed as the component type like:

<Foo.Bar fooBar={2} />

// Before this PR, incorrect casing
jsx(Foo.Bar, { foobar: 2 })

// After this PR
jsx(Foo.Bar, { fooBar: 2 })

Peviously, we wouldn't always treat this as a component and thus do props casing normalization. We must never touch the casing of component props though. Since we can't reliably determine if an expression holds a component or an element, we'll always treat it as a component.

Relevant Fresh issue https://github.com/denoland/fresh/issues/2539