Skip to content

refactor: remove lodash dependency - #273

Merged
joris974 merged 2 commits into
mainfrom
remove-lodash
Aug 25, 2026
Merged

refactor: remove lodash dependency#273
joris974 merged 2 commits into
mainfrom
remove-lodash

Conversation

@joris974

@joris974 joris974 commented Aug 25, 2026

Copy link
Copy Markdown
Member

One less dependency

Summary

  • Every lodash usage in this repo was a single-array-function import (map, reduce, find, times, forEach, identity) called on plain arrays — no deep-clone/deep-equal/debounce or other "hard" lodash behavior anywhere.
  • Replaces each with its native Array.prototype equivalent (or an inline arrow function), across src/formatting.ts, src/path.ts, src/index.ts, src/index.test.ts, and src/test-helper.ts.
  • Drops lodash and @types/lodash from package.json/pnpm-lock.yaml.
  • Rebuilt dist/ via pnpm build per check-git-clean.sh convention.

This follows up on #270/#271, which patched lodash's import style to survive ESM resolution under Vitest — this removes the dependency outright instead.

Note: lodash still shows up in the resolved dependency tree, since @freckle/maybe and @freckle/non-empty both depend on it directly. This PR only removes parser-js's own direct dependency and usage.

Rebased onto v4.0.0 main. #275 (native Date instead of Moment) landed first, so this branch was rebased on top of it. Conflicts were in package.json, pnpm-lock.yaml, src/index.ts (the import block, where lodash sat next to the new date-fns import), and dist/index.js. src/index.test.ts merged cleanly. Test count is 82 rather than 76 because #275 added six.

Test plan

  • pnpm install — lockfile updates cleanly, lodash/@types/lodash entries removed
  • pnpm build — typechecks clean
  • pnpm test — all 82 tests pass
  • prettier --check 'src/**/*.ts' — clean

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

PR checklist

  • Version in package.json is updated according to semver policy.
  • Built dist/ reflects all changes in PR prior to merge.

@joris974
joris974 marked this pull request as ready for review August 25, 2026 16:58
@joris974
joris974 requested a review from a team as a code owner August 25, 2026 16:58
@joris974
joris974 requested review from cdmren and dverdaguer and removed request for a team and dverdaguer August 25, 2026 16:58
Every usage was a trivial single-array-function import (map, reduce,
find, times, forEach, identity) with a direct native equivalent.
Replaces them with Array.prototype methods and inline arrow functions,
and drops lodash and @types/lodash from package.json.

Note: lodash still appears in the dependency tree transitively via
@freckle/non-empty, so this only removes parser-js's own direct usage.

@cdmren cdmren left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skimmed, seems straightforward

@joris974
joris974 enabled auto-merge August 25, 2026 21:12
@joris974
joris974 merged commit 781f6a0 into main Aug 25, 2026
2 checks passed
@joris974
joris974 deleted the remove-lodash branch August 25, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants