Skip to content
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

Allow `JSXIdentifier`s to begin with a symbol #9946

Open
jhpratt opened this issue May 6, 2019 · 4 comments

Comments

Projects
None yet
4 participants
@jhpratt
Copy link

commented May 6, 2019

Feature Request

Is your feature request related to a problem? Please describe.
I'd like to be able to parse <foo .bar={this.bar} @baz={this.baz} />, along with similar constructs. Currently, a JSXIdentifier cannot begin (or even contain) these symbols.

Describe the solution you'd like
An update to the parser. I can attempt to create a PR if someone can point me in the right direction.

Describe alternatives you've considered
Aside from forking the parser permanently, I don't believe there are any alternatives.

Teachability, Documentation, Adoption, Migration Strategy
This could be used for plugins like jsx-lit-html, which transforms JSX into Lit-HTML syntax. Currently, the plugin has to take a different approach that is dissimilar to Lit's syntax. I was hoping to create a similar plugin, but realized I can't even parse my proposed syntax (this being the only reason).

I don't know how closely Babel follows Facebook's current JSX spec (link). If wanted, I can file an issue there as well. I know JSX was originally created for React, but it's used by far more than just that nowadays, and this syntax change would expand the use cases even further.

@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented May 6, 2019

Hey @jhpratt! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented May 6, 2019

Yeah, this should first be discussed in the JSX spec repository

@jhpratt

This comment has been minimized.

Copy link
Author

commented May 6, 2019

Looks like this was already proposed in facebook/jsx#66 back in 2016, but was neither accepted nor declined. I've just added a comment seeking an update.

@jhpratt

This comment has been minimized.

Copy link
Author

commented May 8, 2019

@nicolo-ribaudo I presume if no response occurs on the JSX repo, that would mean this issue is a dead end, yes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.