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
Replace lodash 'escapeRegExp' with escape-string-regexp library #11842
Replace lodash 'escapeRegExp' with escape-string-regexp library #11842
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/25985/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 82745ff:
|
@jayaddison Updating the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that compared to _.escapeRegExp
, escape-string-regexp
also escapes -
to \\x2d
: https://github.com/sindresorhus/escape-string-regexp/blob/b3eb767656fe6dbb8c8dbf31746171cfb7b23b78/index.js#L12
Although unnecessary as this is for PCRE compatibility, I think it is acceptable to replace _.escapeRegExp
, which also applies toString
on the input -- but we never pass a non-string input to escapeRegExp
.
Thanks! |
Eh, sort of a nitpick of myself here, but I realized I should have said 'yes' to the 'dependency changes' question in the pull request description Q&A. I'll edit that in the description now (even though it's post-review and post-commit). |
Oh thanks! That table is only used by us to add PR labels, which are used in the changelog and by reviewers! |
Good to know, thanks @nicolo-ribaudo! |
* Replace lodash 'escapeRegExp' with escape-string-regexp library * Update yarn.lock
* Replace lodash 'escapeRegExp' with escape-string-regexp library * Update yarn.lock
From previous discussion about removing
lodash
dependencies, it sounds like we can use the widely-used escape-string-regexp library to replace the functionality provided bylodash/escapeRegExp
.As noted in that discussion, this module requires Node 10 or greater, and that won't be guaranteed in
babel
until version 8, so this changeset is based against thenext-8-dev
branch.