-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Reduce disk churn for ESLint upgrades #14098
Comments
Thanks for the heads up. I’m not sure there’s much we can do at this point — ESLint is pretty complicated and does require a bunch of dependencies. If you have specific ideas about how dependencies that could be replaced, we will happily take a look, but it’s unlikely the core team will have time to do a full investigation of each dependency to try to find alternatives. |
We can't assume that As for the |
This Cl is the output of the following command: npm run install-deps -- dedupe This is an attempt to reduce the amount of disk usage of the node_modules folder. For more information, see eslint/eslint#14098 DISABLE_THIRD_PARTY_CHECK=NPM dedupe R=jacktfranklin@chromium.org Bug: none Change-Id: If482ec6cf6ad1936aab4a7b0ff3e61bf5ea98a8f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2703961 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
As part of eslint/eslint#14098, remove the single usage of `lodash` in this repository with an inlined version of a cache set. As a result of this change, users of ESLint will no longer accidentally include a second copy of lodash in their `node_modules` tree.
@mdjermanovic Thank you for your response. I have ran I took a look at @nzakas Based on the above PR, I am assuming that there are other similar opportunities that could reduce the amount of dependencies ESLint uses. Would you be interested in such PRs, to eventually reduce the amount of files present in a |
@TimvdLippe absolutely. If you find any opportunities to reduce dependencies, please feel free to send a PR and reference this issue. |
Oops, fat-fingered the close button. |
In your package-lock.json, requirements for You currently have 5 instances installed: I think that a deduplication tool should be able to move |
I have run Then I updated to NPM 7.4.5 and I can confirm that reduces a couple more packages: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2705386/ Thanks for the guidance on that! I still think it is worthwhile to audit the current dependencies and see if there are any quick wins. For those users who are not aware of |
This should reduce the disk usage of node_modules for DevTools clones, hopefully resulting in an overall faster checkout. For more information, see eslint/eslint#14098 DISABLE_THIRD_PARTY_CHECK=NPM dedupe R=jacktfranklin@chromium.org Bug: none Change-Id: If6759c07480b8ac82b78b7730b8a5ac18bb40b86 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2705383 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
This CL contains the output of running `npm run install-deps` on NPM 7.4.5. This includes a version bump of the package-lock.json, which means all DevTools engineers who run `npm run install-deps` should use NPM 7+. Additionally, this allows `npm run dedupe` to produce a better output and remove more duplicate packages. For more information, see eslint/eslint#14098 DISABLE_THIRD_PARTY_CHECK=NPM update R=jacktfranklin@chromium.org Bug: none Change-Id: Id1ca2f33f3bb7d555dca1c0737d38bc1c7f5221c Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2705386 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
I took a look at the top 5 packages in a
eslint/lib/cli-engine/formatters/table.js Line 12 in b8aea99
node_modules would reduce from 21080 KB to 18348 KB (e.g. ~13% reduction in size). I was able to find 299 references on GitHub for this formatter: https://github.com/search?l=JSON&q=%22--format+table%22&type=Code In contrast, --format checkstyle has 877 references (https://github.com/search?q=%22--format+checkstyle%22+eslint&type=Code) and --format codeframe has 3796 references (https://github.com/search?q=%22--format+codeframe%22+eslint&type=Code). And the default formatter is of course stylish .
One option would be to deprecate The other packages ( |
Another way of looking at this is seeing which dependencies are least-used and might be easiest to remove:
|
As part of eslint/eslint#14098, remove the single usage of `lodash` in this repository with an inlined version of a cache set. As a result of this change, users of ESLint will no longer accidentally include a second copy of lodash in their `node_modules` tree.
Once we update ESLint to use |
@mdjermanovic Good catch! Yes that would be good to upgrade |
It's most likely we'll upgrade |
@mdjermanovic @nzakas Would you be open to a PR (or probably multiple PRs) to remove uses of lodash? I'm interested in trying to accomplish this. |
Issue suggesting we remove a couple of formatters: #14277 It's worth noting that we have discussed (eslint/rfcs#58) moving the |
What does that entail? A whole new repo and npm package? I might be able to extract that, but I can't directly maintain them in the future (like for the formatters), so after the extraction and publishing I'd assign repo and npm name back to you. |
@nzakas Thanks for the update! Especially after removing the built-in formatters and potentially the init command, we will soon be reaching marginal incremental returns. At that point, I think the usage of |
|
@fregante that’s correct. We need to finalize the design in an RFC, but after that, we would setup a separate repo and npm package. We could create the repo under the eslint org, you could fork it, then do a PR with the initial commit. That way, we could get all our required licensing and files and not worry about ownership transfer. @TimvdLippe I agree. I think we are well on our way with lodash. I’m not sure there’s much we can do about ajv, as that is how our configs are validated. Definitely open to ideas, though. @stephenwade nice! Thanks for keeping an eye on that. |
I've submitted #14287 to update node_modules size comparison: ~/git/eslint-test-master$ echo '{ "dependencies": { "eslint": "eslint/eslint" } }' > package.json
~/git/eslint-test-master$ npm install >/dev/null
~/git/eslint-test-master$ du -sh node_modules
22M node_modules
~/git/eslint-test-stephenwade$ echo '{ "dependencies": { "eslint": "stephenwade/eslint#remove-lodash-3" } }' > package.json
~/git/eslint-test-stephenwade$ npm install >/dev/null
~/git/eslint-test-stephenwade$ du -sh node_modules
17M node_modules
~/git$ diff -U0 <(cd eslint-test-master; du -hd1 node_modules) <(cd eslint-test-stephenwade; du -hd1 node_modules) | grep "^[-+]\d"
-4.9M node_modules/lodash
-16K node_modules/escape-string-regexp
+20K node_modules/escape-string-regexp
+28K node_modules/deep-extend
-240K node_modules/@babel
+256K node_modules/@babel
-22M node_modules
+17M node_modules |
@stephenwade |
@fregante That's great! This PR could still be merged into a minor release though, so I'm going to leave the |
Updating to a patch release doesn't change anything for the end user and just causes my PR to have conflicts 😃 |
Updating to a patch release is important for my PR because it updates |
Good news! Removing Lodash removed 44k lines in NodeJS: nodejs/node#38764 |
Nice. Great work, everyone. |
Oops! It looks like we lost track of this issue. @eslint/eslint-tsc what do we want to do here? This issue will auto-close in 7 days without an update. |
Looks like we have completed everything for this issue now, so closing. Thanks everyone for making ESLint a bit slimmer. |
The version of ESLint you are using.
7.19.0 and earlier upgrades to, for example, 7.13.0
The problem you want to solve.
ESLint upgrades cause significant file changes in
node_modules
. We have hit this problem multiple times, some statistics:https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692306
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2534873
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137384
As an effect of these ESLint upgrades, checking out repositories becomes a lot slower and disk churn increases significantly for all contributors and bots.
Please note that we are required to check in our
node_modules
for security and stability reasons. We are not allowed to make calls to external repositories in our testing infrastructure, which means we have to include the files in our repository. That said, even if you wouldn't check in your files, the effects on files changed and disk operations remain. E.g. if you gitignore yournode_modules
, ESLint upgrades would still cause significant disk churn.Your take on the correct solution to problem.
Reduce the disk churn either by dropping dependencies that cause excessive disk usage and drop dependencies that are commonly duplicated in
node_modules
trees. For example, in nearly all of our upgrades, we are observing multiple copies oflodash
in among others@eslint/eslintrc
or AST-like packages likees-abstract
.Are you willing to submit a pull request to implement this change?
I don't think this is something I can do as an external contributor, but feel free to led me/the community know if there are dependencies that could be pruned and usages can be migrated to reduce overall disk usage.
The text was updated successfully, but these errors were encountered: