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
Remove remaining lodash
dependencies
#13139
Conversation
@@ -1,4 +1,4 @@ | |||
import last from "lodash/last" | |||
import last from "lo-dash/last" |
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.
This is just an input/output fixture, but it was annoying when grepping for lodash
😂
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.
lol we want to ctrl+f and find no results
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 dc0b4bd:
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45155/ |
// to ignore the log message rather than making @babel/cli crash. | ||
return; | ||
} | ||
const logSuccess = util.debounce(function () { |
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.
oh great! I wasn't sure about replacing in the earlier PR because of the trailing: true
and also logSuccess.flush();
on line 173, but looks like it covers it!
@@ -42,7 +42,7 @@ function compile(code, filename) { | |||
// sourceRoot can be overwritten | |||
{ | |||
sourceRoot: path.dirname(filename) + path.sep, | |||
...deepClone(transformOpts), | |||
...cloneDeep(transformOpts), |
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.
And the reason we probably want to keep this is because transformOpts
might have like things like functions vs. just objects given how people configure @babel/register with js?
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.
Yeah, also people can pass any JS value as plugin options.
@@ -40,7 +40,7 @@ | |||
"eslint-rule-composer": "^0.3.0" | |||
}, | |||
"devDependencies": { | |||
"eslint": "^7.5.0", | |||
"lodash": "^4.17.20" | |||
"clone-deep": "^4.0.1", |
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.
clone-deep is quite bloated package. Maybe try klona?
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.
My strategy for choosing the clone-deep
package was "Ctrl+F for clone
in our yarn.lock
file", so thanks for suggesting an alternative 😂
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.
Oh it looks like klona
requires Node.js >= 8, so until the Babel 8 release we cannot use it.
@nicolo-ribaudo Nice :) Does this mean that |
The base |
We were only using a very small number of functions from lodash, so we can avoid depending on it.
This PR still uses an external
clone-deep
implementation, but it has 10M weekly downloads (so it's battle-tested) and it's about 60% smaller thanlodash/cloneDeep
.