refactor: replace lodash.uniq with simple code#4600
refactor: replace lodash.uniq with simple code#4600escapedcat merged 2 commits intoconventional-changelog:masterfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Pull request overview
This PR replaces the lodash.uniq dependency with native JavaScript Set-based deduplication to reduce external dependencies and use modern JavaScript features.
Changes:
- Removed
lodash.uniqimport and replaced usage with[...new Set(array)]pattern - Removed
lodash.uniqand@types/lodash.uniqfrom package dependencies - Updated yarn.lock to reflect dependency removal
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| @commitlint/load/src/load.ts | Replaced lodash.uniq function call with native Set deduplication for plugins array |
| @commitlint/load/package.json | Removed lodash.uniq from dependencies and @types/lodash.uniq from devDependencies |
| yarn.lock | Removed package entries for lodash.uniq and @types/lodash.uniq |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Please have a look at the comment from copilot, thanks! |
|
Thanks! |
User description
Description
Replace
lodash.uniq(array)with[...new Set(array)]. Extracted from #4596.Motivation and Context
Now we can do
[...new Set(array)]insteadlodash.uniq(array).Usage examples
Nothing
How Has This Been Tested?
I run the test in changed package (
@commitlint/load).Types of changes
Checklist:
PR Type
Enhancement
Description
Replace
lodash.uniqdependency with native Set-based deduplicationRemove
lodash.uniqpackage from dependencies and type definitionsUse
[...new Set(array)]pattern for array deduplicationDiagram Walkthrough
File Walkthrough
load.ts
Replace lodash.uniq with native Set deduplication@commitlint/load/src/load.ts
lodash.uniqimport statementuniq(extended.plugins)call with inline[...newSet(extended.plugins)]deduplicationuniqnow holds the deduplicated array resultpackage.json
Remove lodash.uniq package dependencies@commitlint/load/package.json
lodash.uniqfrom dependencies@types/lodash.uniqfrom devDependencieslodash.mergeandlodash.isplainobjectas they are still in use