Skip to content

Commit 166cbb7

Browse files
authored
refactor: use builtin Object.values instead of lodash/values (conventional-changelog#968)
* refactor: use builtin Object.values instead of lodash * chore: plugin type can be now correctly inherited
1 parent 061b0eb commit 166cbb7

File tree

6 files changed

+5
-13
lines changed

6 files changed

+5
-13
lines changed

@commitlint/ensure/src/index.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import path from 'path';
22
import globby from 'globby';
3-
import values from 'lodash/values';
43
import camelCase from 'lodash/camelCase';
54
import * as ensure from '.';
65

@@ -15,7 +14,7 @@ test('exports all checkers', async () => {
1514
});
1615

1716
test('rules export functions', () => {
18-
const actual = values(ensure);
17+
const actual = Object.values(ensure);
1918
expect(actual.every(rule => typeof rule === 'function')).toBe(true);
2019
});
2120

@commitlint/lint/src/lint.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ import isIgnored from '@commitlint/is-ignored';
33
import parse from '@commitlint/parse';
44
import defaultRules from '@commitlint/rules';
55
import toPairs from 'lodash/toPairs';
6-
import values from 'lodash/values';
76
import {buildCommitMesage} from './commit-message';
87
import {
98
LintRuleConfig,
109
LintOptions,
1110
LintRuleOutcome,
1211
Rule,
13-
Plugin,
1412
RuleSeverity
1513
} from '@commitlint/types';
1614

@@ -43,7 +41,7 @@ export default async function lint(
4341
);
4442

4543
if (opts.plugins) {
46-
values(opts.plugins).forEach((plugin: Plugin) => {
44+
Object.values(opts.plugins).forEach(plugin => {
4745
if (plugin.rules) {
4846
Object.keys(plugin.rules).forEach(ruleKey =>
4947
allRules.set(ruleKey, plugin.rules[ruleKey])

@commitlint/rules/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@
3737
"@commitlint/parse": "^8.3.4",
3838
"@commitlint/test": "8.2.0",
3939
"@commitlint/utils": "^8.3.4",
40-
"@types/lodash": "4.14.149",
4140
"conventional-changelog-angular": "5.0.6",
42-
"globby": "^11.0.0",
43-
"lodash": "^4.17.15"
41+
"globby": "^11.0.0"
4442
},
4543
"dependencies": {
4644
"@commitlint/ensure": "^8.3.4",

@commitlint/rules/src/index.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import path from 'path';
22
import globby from 'globby';
3-
import values from 'lodash/values';
43
import rules from '.';
54

65
test('exports all rules', async () => {
@@ -10,7 +9,7 @@ test('exports all rules', async () => {
109
});
1110

1211
test('rules export functions', () => {
13-
const actual = values(rules);
12+
const actual = Object.values(rules);
1413
expect(actual.every(rule => typeof rule === 'function')).toBe(true);
1514
});
1615

@packages/utils/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"@commitlint/test": "8.2.0",
4040
"execa": "0.11.0",
4141
"is-builtin-module": "3.0.0",
42-
"lodash": "^4.17.15",
4342
"meow": "4.0.1",
4443
"read-pkg": "5.2.0",
4544
"require-from-string": "2.0.2",

@packages/utils/pkg-check.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const meow = require('meow');
88
const readPkg = require('read-pkg');
99
const requireFromString = require('require-from-string');
1010
const tar = require('tar-fs');
11-
const values = require('lodash/values');
1211
const {fix} = require('@commitlint/test');
1312

1413
const builtin = require.resolve('is-builtin-module');
@@ -198,7 +197,7 @@ function getPkgBinFiles(bin) {
198197
}
199198

200199
if (typeof bin === 'object') {
201-
return values(bin).map(b => path.normalize(b));
200+
return Object.values(bin).map(b => path.normalize(b));
202201
}
203202
}
204203

0 commit comments

Comments
 (0)