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

Reduce lodash usage. #406

Merged
merged 1 commit into from Nov 19, 2019
Merged

Reduce lodash usage. #406

merged 1 commit into from Nov 19, 2019

Conversation

XhmikosR
Copy link
Member

@XhmikosR XhmikosR commented Nov 17, 2019

use the individual packages and replace the following methods with their native counterparts:

  • assign
  • head
  • includes
  • isUndefined
  • repeat
  • uniq

Fixes #399

@coveralls
Copy link

coveralls commented Nov 18, 2019

Coverage Status

Coverage remained the same at 92.254% when pulling b660101 on XhmikosR:lodash into 7969cc0 on kristerkari:master.

Use the individual packages and replace the following methods with their native counterparts:

* assign
* head
* includes
* isUndefined
* repeat
* uniq
@kristerkari kristerkari merged commit 730a2c0 into stylelint-scss:master Nov 19, 2019
@XhmikosR XhmikosR deleted the lodash branch November 19, 2019 15:57
@stof
Copy link
Contributor

stof commented Nov 26, 2019

the lodash.* packages are unmaintained (as can be seen by their version numbers, which are far behind). Why switching to them rather than importing the sub-packages from lodash (i.e. lodash/get), which are the recommended way ?

@XhmikosR
Copy link
Member Author

@XhmikosR
Copy link
Member Author

Also they are not unmaintained.

@stof
Copy link
Contributor

stof commented Nov 26, 2019

@XhmikosR The size is why I suggested importing lodash modules, not the main index.

Regarding maintenance, lodash.get was last published 3 years ago for instance. Same is true for other packages as well (the only lodash-modularized packages released this year are the one affected by a security issue, and only that security patch was applied, not all other improvements AFAIK).
and the lodash roadmap says that they will be dropped entirely for lodash 5: https://github.com/lodash/lodash/wiki/Roadmap
the maintainer also said multiple times in comments that he consider them deprecated. see https://github.com/lodash/lodash/issues/3943#issuecomment-418998293 for instance.

@XhmikosR
Copy link
Member Author

Well, this is lodash 4.x. And if the time comes, we can just replace those with our utils.

Importing a huge package is never better.

@stof
Copy link
Contributor

stof commented Nov 26, 2019

lodash/lodash.com#214 is adding a new page on the website about the fact that they are deprecated. It is explaining why importing multiple per-method packages usually end up with a bigger bundle size than importing multiple modules from the lodash package (short story: internal lodash helpers are duplicated in each per-method package while importing from the lodash packages will import the same helpers).
When importing modular lodash, you install a big package, but you don't import a big package.

@XhmikosR
Copy link
Member Author

This is not a web app. We are not bundling anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Reduce lodash usage
4 participants