Skip to content

parser: JSXMemberExpression where property contains hyphens #5355

@overlookmotel

Description

@overlookmotel

According to JSX spec, this is legal syntax: <Foo.bar-qux> (because bar-qux is a valid JSXIdentifier).

Currently Oxc transforms this to _jsx(Foo.bar-qux, {}):

https://oxc-project.github.io/oxc/playground/?code=3YCAAICRgICAgICAgICekQl4rrIkZg9c51vDD8rqZZS485A%2Ff3EUAIA%3D

We should transform it to _jsx(Foo["bar-qux"], {}) instead.

NB: Babel just errors out on this input, and SWC gets it wrong the same way we do, so this is not a high priority. But it's probably easier to do it now while we're already making loads of changes to how we handle JSX.

Metadata

Metadata

Assignees

Labels

A-transformerArea - Transformer / TranspilerC-bugCategory - Bug

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions