Skip to content

Cleanup: Removal of lodash#32351

Merged
ndelangen merged 3 commits into
nextfrom
norbert/lodash-removal-service
Sep 3, 2025
Merged

Cleanup: Removal of lodash#32351
ndelangen merged 3 commits into
nextfrom
norbert/lodash-removal-service

Conversation

@ndelangen
Copy link
Copy Markdown
Member

@ndelangen ndelangen commented Aug 29, 2025

Related: #32347

What I did

Updated dependencies and ESLint configuration to streamline dependency management and improve linting accuracy:

  • Removed specific versions of @types/lodash and lodash from package.json and yarn.lock to reduce dependency complexity
  • Updated ESLint configuration to include lodash-es in the ban-dependencies rule for improved linting accuracy
  • Moved the eslint-disable depend/ban-dependencies comment to only wrap the specific lodash-es imports in the preview file, making the linting more precise

These changes help maintain cleaner dependency management while ensuring proper ESLint enforcement across the codebase.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

Greptile Summary

Updated On: 2025-09-02 08:53:52 UTC

This PR completes the lodash dependency removal from Storybook's codebase by cleaning up remaining references and improving ESLint enforcement. The changes include:

  1. Dependency Removal: Removes lodash and @types/lodash from code/core/package.json, completing the migration to es-toolkit alternatives that was started in the related PR Core: Fix babel-related size regression #32347

  2. Enhanced ESLint Configuration: Updates scripts/.eslintrc.cjs to ban both lodash and lodash-es modules, ensuring comprehensive prevention of future lodash usage across the codebase

  3. Precise Linting Control: Refines the ESLint disable directive in code/.storybook/preview.tsx to only wrap the specific lodash-es mock imports (lines 41-44) rather than disabling the rule for the entire file

This work fits into Storybook's broader modernization effort, where lodash functionality has been replaced with es-toolkit utilities like pick, isEqual, and toMerged. The es-toolkit library provides similar functionality with better tree-shaking capabilities and smaller bundle sizes. These changes ensure that the lodash removal is complete while maintaining necessary test mocking functionality and preventing future accidental lodash imports through improved linting rules.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it only removes unused dependencies and improves linting configuration
  • Score reflects that these are non-functional cleanup changes with no impact on runtime behavior or user-facing features
  • No files require special attention as all changes are straightforward dependency and configuration updates

@ndelangen ndelangen changed the title Update dependencies and ESLint configuration Cleanup: Removal of lodash Aug 29, 2025
@ndelangen ndelangen self-assigned this Aug 29, 2025
@ndelangen ndelangen added cleanup Minor cleanup style change that won't show up in release changelog ci:normal Run our default set of CI jobs (choose this for most PRs). labels Aug 29, 2025
@ndelangen ndelangen requested a review from JReinhold August 29, 2025 09:01
- Removed specific versions of `@types/lodash` and `lodash` from package.json and yarn.lock to streamline dependency management.
- Updated ESLint configuration to include `lodash-es` in the ban-dependencies rule for improved linting accuracy.
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Aug 29, 2025

View your CI Pipeline Execution ↗ for commit 694f7fd

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 42s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-02 22:29:24 UTC

@ndelangen ndelangen force-pushed the norbert/lodash-removal-service branch from f69fd8e to ff9a845 Compare August 29, 2025 09:05
@ndelangen ndelangen marked this pull request as ready for review September 2, 2025 08:50
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@storybook-app-bot
Copy link
Copy Markdown

Package Benchmarks

Commit: 694f7fd, ran on 2 September 2025 at 13:06:13 UTC

The following packages have significant changes to their size or dependencies:

storybook

Before After Difference
Dependency count 48 48 0
Self size 30.62 MB 30.74 MB 🚨 +117 KB 🚨
Dependency size 17.61 MB 17.61 MB 0 B
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 219 219 0
Self size 879 KB 879 KB 🚨 +90 B 🚨
Dependency size 81.81 MB 81.93 MB 🚨 +117 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 188 188 0
Self size 35 KB 35 KB 🚨 +42 B 🚨
Dependency size 76.88 MB 77.00 MB 🚨 +117 KB 🚨
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 49 49 0
Self size 1.52 MB 1.52 MB 🎉 -60 B 🎉
Dependency size 48.23 MB 48.35 MB 🚨 +117 KB 🚨
Bundle Size Analyzer node node

@ndelangen ndelangen merged commit 37c7ef8 into next Sep 3, 2025
55 of 56 checks passed
@ndelangen ndelangen deleted the norbert/lodash-removal-service branch September 3, 2025 08:12
@github-actions github-actions Bot mentioned this pull request Sep 3, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). cleanup Minor cleanup style change that won't show up in release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants