Allow `JSXIdentifier`s to begin with a symbol
See original GitHub issueFeature 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
I’m closing this issue, since it first needs to be implemented in the spec (https://github.com/facebook/jsx/issues/66)
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.