Skip to content

Allow JSXIdentifiers to begin with a symbol #9946

Closed

Description

@jhpratt

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.

Activity

  1. babel-bot commented on May 6, 2019

    @babel-bot
    Collaborator

    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.

  2. nicolo-ribaudo commented on May 6, 2019

    @nicolo-ribaudo
    Member

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

  3. jhpratt commented on May 6, 2019

    @jhpratt
    Author

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

  4. jhpratt commented on May 8, 2019

    @jhpratt
    Author

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

  5. nicolo-ribaudo commented on Sep 2, 2019

    @nicolo-ribaudo
    Member

    I'm closing this issue, since it first needs to be implemented in the spec (react/jsx#66)

  6. added
    outdated
    on Dec 2, 2019
  7. locked as resolved and limited conversation to collaborators on Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: upstreamoutdated

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions