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

refactor(v2): remove duplicated lodash dependencies and import only what needed #4361

Merged
merged 2 commits into from
Mar 9, 2021

Conversation

armano2
Copy link
Contributor

@armano2 armano2 commented Mar 8, 2021

Motivation

I don't like duplicated packages in my projects

Lodash library is isntalled multiple times and used in incositent way there are files when in one place we are importing lodash and lodash.* instead of reusing it

import flatMap from 'lodash.flatmap';
import {mapValues, flatten, difference} from 'lodash';

This is also recommended action from lodash: https://lodash.com/per-method-packages and per method packages will no longer be available in v5

Does this PR introduce a breaking change?

  • Yes
  • No

@facebook-github-bot
Copy link
Contributor

Hi @armano2!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@netlify
Copy link

netlify bot commented Mar 8, 2021

[V1] Deploy preview success

Built with commit 23138e6

https://deploy-preview-4361--docusaurus-1.netlify.app

@netlify
Copy link

netlify bot commented Mar 8, 2021

Deploy preview for docusaurus-2 ready!

Built with commit 23138e6

https://deploy-preview-4361--docusaurus-2.netlify.app

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@github-actions
Copy link

github-actions bot commented Mar 8, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 89
🟢 Accessibility 96
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-4361--docusaurus-2.netlify.app/classic/

@slorber
Copy link
Collaborator

slorber commented Mar 8, 2021

Thanks, agree with you that we have an inconsistent and legacy lodash usage to refactor, and. would also like to move out of the per-method packages.

However I'm not sure this refactor is something we want:

image

It looks simpler to me to use named imports everywhere.

Note we are not supposed to include Lodash in client-side bundles (ESLint is supposed to prevent that), so that does not seem bad.

@armano2
Copy link
Contributor Author

armano2 commented Mar 8, 2021

However I'm not sure this refactor is something we want:

@slorber ok i updated it to named imports and aligned required version of lodash across all packages

@slorber slorber added the pr: maintenance This PR does not produce any behavior differences to end users when upgrading. label Mar 9, 2021
@slorber slorber changed the title fix: remove duplicated lodash dependencies and import only what needed refactor(v2): remove duplicated lodash dependencies and import only what needed Mar 9, 2021
# Conflicts:
#	yarn.lock
@slorber
Copy link
Collaborator

slorber commented Mar 9, 2021

thanks, LGTM 👍

@slorber slorber merged commit e6261af into facebook:master Mar 9, 2021
@armano2 armano2 deleted the fix/lodash branch March 9, 2021 12:08
@lex111 lex111 added this to the v2.0.0-alpha.71 milestone Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: maintenance This PR does not produce any behavior differences to end users when upgrading.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants