Skip to content

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

Merged
slorber merged 2 commits into
facebook:masterfrom
armano2:fix/lodash
Mar 9, 2021
Merged

refactor(v2): remove duplicated lodash dependencies and import only what needed#4361
slorber merged 2 commits into
facebook:masterfrom
armano2:fix/lodash

Conversation

@armano2

@armano2 armano2 commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

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

@armano2 armano2 requested review from lex111 and slorber as code owners March 8, 2021 03:52
@facebook-github-bot

Copy link
Copy Markdown
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

netlify Bot commented Mar 8, 2021

Copy link
Copy Markdown

[V1] Deploy preview success

Built with commit 23138e6

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

@netlify

netlify Bot commented Mar 8, 2021

Copy link
Copy Markdown

Deploy preview for docusaurus-2 ready!

Built with commit 23138e6

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

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Mar 8, 2021
@facebook-github-bot

Copy link
Copy Markdown
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
Copy Markdown
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

github-actions Bot commented Mar 8, 2021

Copy link
Copy Markdown

⚡️ 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

slorber commented Mar 8, 2021

Copy link
Copy Markdown
Collaborator

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

armano2 commented Mar 8, 2021

Copy link
Copy Markdown
Contributor Author

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

slorber commented Mar 9, 2021

Copy link
Copy Markdown
Collaborator

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
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
…hat needed (facebook#4361)

Co-authored-by: slorber <lorber.sebastien@gmail.com>
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