-
-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parser: JSXMemberExpression
where property contains hyphens
#5355
Comments
TODO: React transform should throw the same babel error. |
Babel throws that error in parser. Babel REPL I don't think Babel's behavior is correct because (as you pointed out yesterday) it's valid JSX. But it's undefined whether it's valid or not as React JSX. So yes, we could raise an error in React transform, or we could accept it and transform it to |
As it turns out, this is an undocumented syntax error, confirmed by babel, tsc and babel. |
JSXMemberExpression
where property contains hyphensJSXMemberExpression
where property contains hyphens
This is now a syntax error in oxc:
|
Brilliant! Thanks for solving it. |
According to JSX spec, this is legal syntax:
<Foo.bar-qux>
(becausebar-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.
The text was updated successfully, but these errors were encountered: