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

the unicode definition of t.isValidIdentifier is outdated #10434

Open
JLHwung opened this issue Sep 12, 2019 · 4 comments

Comments

@JLHwung
Copy link
Contributor

commented Sep 12, 2019

Bug Report

Current Behavior
The following snippet returns false because esutils are still using Unicode 9.0.0.

Input Code

const t = require("@babel/types");

t.isValidIdentifier("\u{1B170}");

Expected behavior/code
Return true, which also aligns to babel-parser.

Environment

  • Babel version(s): v7.6.1
  • Node/npm version: Node 12
  • OS: macOS 10.14, Chrome 76
  • Monorepo: no
  • How you are using Babel: reading source code and try to get rid of esutils

Possible Solution
Consider move isIdentifierStart and isIdentifierChar from tokenizer to babel-types, and then get rid of esutils.

Additional context/Screenshots
\u{1B170} (𛅰) is a Nüshu character, encoded since Unicode 10.0.0 and has ID_Start and ID_Continue properties.

Screen Shot 2019-09-12 at 18 51 56

@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Sep 12, 2019

Hey @JLHwung! 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 Sep 12, 2019

Consider move isIdentifierStart and isIdentifierChar from tokenizer to babel-types

Since @babel/parser is often used without all the other Babel packages, adding @babel/types as a dependency would sometimes installing a new package which is as big as @babel/parser itself:
https://bundlephobia.com/result?p=@babel/parser@7.6.0
https://bundlephobia.com/result?p=@babel/types@7.6.1

@JLHwung

This comment has been minimized.

Copy link
Contributor Author

commented Sep 13, 2019

@nicolo-ribaudo True. I just realize that babel-parser has bundled all of its dependencies. What if we introduce babel-helper-identifier-validate and share between babel-types and babel-parser?

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Sep 13, 2019

It could work 👍

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