Skip to content

Commit 2b3e68b

Browse files
authored
refactor: replace lodash.uniq with simple code (#4600)
* chore: replace lodash.uniq with simple code * chore: use better name
1 parent be3a280 commit 2b3e68b

3 files changed

Lines changed: 3 additions & 17 deletions

File tree

@commitlint/load/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"@commitlint/test": "^20.0.0",
4040
"@types/lodash.isplainobject": "^4.0.8",
4141
"@types/lodash.merge": "^4.6.8",
42-
"@types/lodash.uniq": "^4.5.8",
4342
"@types/node": "^18.19.17",
4443
"conventional-changelog-atom": "^4.0.0",
4544
"typescript": "^5.2.2"
@@ -53,8 +52,7 @@
5352
"cosmiconfig": "^9.0.0",
5453
"cosmiconfig-typescript-loader": "^6.1.0",
5554
"lodash.isplainobject": "^4.0.6",
56-
"lodash.merge": "^4.6.2",
57-
"lodash.uniq": "^4.5.0"
55+
"lodash.merge": "^4.6.2"
5856
},
5957
"gitHead": "e82f05a737626bb69979d14564f5ff601997f679"
6058
}

@commitlint/load/src/load.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
} from "@commitlint/types";
1818
import isPlainObject from "lodash.isplainobject";
1919
import merge from "lodash.merge";
20-
import uniq from "lodash.uniq";
2120

2221
import { loadConfig } from "./utils/load-config.js";
2322
import { loadParserOpts } from "./utils/load-parser-opts.js";
@@ -85,7 +84,8 @@ export default async function load(
8584

8685
let plugins: PluginRecords = {};
8786
if (Array.isArray(extended.plugins)) {
88-
for (const plugin of uniq(extended.plugins)) {
87+
const deduplicatedPlugins = [...new Set(extended.plugins)];
88+
for (const plugin of deduplicatedPlugins) {
8989
if (typeof plugin === "string") {
9090
plugins = await loadPlugin(
9191
plugins,

yarn.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,13 +1914,6 @@
19141914
dependencies:
19151915
"@types/lodash" "*"
19161916

1917-
"@types/lodash.uniq@^4.5.8":
1918-
version "4.5.9"
1919-
resolved "https://registry.npmjs.org/@types/lodash.uniq/-/lodash.uniq-4.5.9.tgz#9a5390422c003ca6d0219207ed6c9c38e37a783f"
1920-
integrity sha512-2Vd5avnDMNLbDSnUwwgwExKXvX9W3CN72rodT+ikGqGHXn7gVK6BM6Z+kHonbpGgCI2BzM+QDMHrkgKoofOi6A==
1921-
dependencies:
1922-
"@types/lodash" "*"
1923-
19241917
"@types/lodash.upperfirst@^4.3.8":
19251918
version "4.3.9"
19261919
resolved "https://registry.npmjs.org/@types/lodash.upperfirst/-/lodash.upperfirst-4.3.9.tgz#66e150885a67866ed8bc4331c8c305ab682a198c"
@@ -5491,11 +5484,6 @@ lodash.startcase@^4.4.0:
54915484
resolved "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz#9436e34ed26093ed7ffae1936144350915d9add8"
54925485
integrity sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==
54935486

5494-
lodash.uniq@^4.5.0:
5495-
version "4.5.0"
5496-
resolved "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
5497-
integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==
5498-
54995487
lodash.upperfirst@^4.3.1:
55005488
version "4.3.1"
55015489
resolved "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"

0 commit comments

Comments
 (0)