Skip to content

throw a TypeError if identifier validation fails#10621

Merged
nicolo-ribaudo merged 2 commits intobabel:masterfrom
dentrado:patch-1
Nov 2, 2019
Merged

throw a TypeError if identifier validation fails#10621
nicolo-ribaudo merged 2 commits intobabel:masterfrom
dentrado:patch-1

Conversation

@dentrado
Copy link
Copy Markdown
Contributor

Q                       A
Fixed Issues?
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? No
Documentation PR Link
Any Dependency Changes? No
License MIT

I noticed that t.identifier(name) accepts invalid identifiers, this PR fixes that bug. Thanks to @JLHwung for finding the reason so quickly!

@buildsize
Copy link
Copy Markdown

buildsize bot commented Nov 1, 2019

File name Previous Size New Size Change
babel-preset-env.js 2.77 MB 2.77 MB 815 bytes (0%)
babel-preset-env.min.js 1.67 MB 1.67 MB 399 bytes (0%)
babel.js 2.95 MB 2.95 MB 817 bytes (0%)
babel.min.js 1.63 MB 1.63 MB 400 bytes (0%)
test262.tap 4.84 MB [deleted]

1 similar comment
@buildsize
Copy link
Copy Markdown

buildsize bot commented Nov 1, 2019

File name Previous Size New Size Change
babel-preset-env.js 2.77 MB 2.77 MB 815 bytes (0%)
babel-preset-env.min.js 1.67 MB 1.67 MB 399 bytes (0%)
babel.js 2.95 MB 2.95 MB 817 bytes (0%)
babel.min.js 1.63 MB 1.63 MB 400 bytes (0%)
test262.tap 4.84 MB [deleted]

@nicolo-ribaudo nicolo-ribaudo added pkg: types PR: Spec Compliance 👓 A type of pull request used for our changelog categories labels Nov 1, 2019
Copy link
Copy Markdown
Member

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

I've had to depend on and import esutils in a few projects because this was never exposed. Yay!

@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Nov 1, 2019

@jridgewell We do have plan to refactor it. In the near future babel-types will not depend on esutils anymore, instead it will reuse the big identifier name regex in babel-parser.

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: types PR: Spec Compliance 👓 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants