Skip to content

refactor: replace all lodash.* dependencies with es-toolkit/compat#4734

Merged
escapedcat merged 1 commit intoconventional-changelog:masterfrom
debuggingfuture:refactor/replace-lodash-with-es-toolkit
Apr 27, 2026
Merged

refactor: replace all lodash.* dependencies with es-toolkit/compat#4734
escapedcat merged 1 commit intoconventional-changelog:masterfrom
debuggingfuture:refactor/replace-lodash-with-es-toolkit

Conversation

@debuggingfuture
Copy link
Copy Markdown
Contributor

Description

Replacing lodash.* with es-toolkit/compat

Replacements:

  • lodash.camelcase / kebabcase / snakecase / startcase / upperfirst → es-toolkit/compat in @commitlint/ensure (case helpers)
  • lodash.mergewith → es-toolkit/compat:
    • mergeWith (with customizer) in @commitlint/resolve-extends
    • merge (no customizer) in @commitlint/load, @commitlint/config-patternplate, and the cli test helper

Notes:

  • For strings handling, it's noted chore: update dependency husky to v1 #462 revert kasi change due to non-Latin subject-case regressions
    use of compat mode es-toolkit/compat should pass them
  • es-toolkit/compat's mergeWith always treats the last positional argument as the customizer, unlike lodash's createAssigner which detects function-typed customizers. Call sites that passed objects (no customizer) are switched to es-toolkit's variadic merge to preserve behavior.

Motivation and Context

For improving performance, minimizing dependencies and supply chain attack vectors.
Reference: https://e18e.dev/docs/replacements/lodash-underscore

How Has This Been Tested?

Test results: 1185/1185 tests across 90 files pass, including the Cyrillic / Chinese / Arabic / Hebrew / mixed-script subject-case cases that broke under kasi.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Drops six per-function lodash.* packages in favor of a single
es-toolkit dependency, using the lodash-compatible /compat surface so
behavior matches the existing tests — including the non-Latin
subject-case regressions added after the kasi revert (conventional-changelog#4621).

Replacements:

- lodash.camelcase / kebabcase / snakecase / startcase / upperfirst →
  es-toolkit/compat in @commitlint/ensure (case helpers)
- lodash.mergewith → es-toolkit/compat:
  - mergeWith (with customizer) in @commitlint/resolve-extends
  - merge (no customizer) in @commitlint/load,
    @commitlint/config-patternplate, and the cli test helper

es-toolkit/compat's mergeWith always treats the last positional
argument as the customizer, unlike lodash's createAssigner which
detects function-typed customizers. Call sites that passed objects (no
customizer) are switched to es-toolkit's variadic merge to preserve
behavior.

Test results: 1185/1185 tests across 90 files pass, including the
Cyrillic / Chinese / Arabic / Hebrew / mixed-script subject-case cases
that broke under kasi.
@escapedcat escapedcat changed the title chore: replace all lodash.* dependencies with es-toolkit/compat refactor: replace all lodash.* dependencies with es-toolkit/compat Apr 27, 2026
@escapedcat escapedcat merged commit e3d2c9d into conventional-changelog:master Apr 27, 2026
15 checks passed
@escapedcat
Copy link
Copy Markdown
Member

Thanks!

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.

2 participants