Skip to content

refactor: use builtin Object.values instead of lodash/values #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions @commitlint/ensure/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path';
import globby from 'globby';
import values from 'lodash/values';
import camelCase from 'lodash/camelCase';
import * as ensure from '.';

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

test('rules export functions', () => {
const actual = values(ensure);
const actual = Object.values(ensure);
expect(actual.every(rule => typeof rule === 'function')).toBe(true);
});

Expand Down
4 changes: 1 addition & 3 deletions @commitlint/lint/src/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import isIgnored from '@commitlint/is-ignored';
import parse from '@commitlint/parse';
import defaultRules from '@commitlint/rules';
import toPairs from 'lodash/toPairs';
import values from 'lodash/values';
import {buildCommitMesage} from './commit-message';
import {
LintRuleConfig,
LintOptions,
LintRuleOutcome,
Rule,
Plugin,
RuleSeverity
} from '@commitlint/types';

Expand Down Expand Up @@ -43,7 +41,7 @@ export default async function lint(
);

if (opts.plugins) {
values(opts.plugins).forEach((plugin: Plugin) => {
Object.values(opts.plugins).forEach(plugin => {
if (plugin.rules) {
Object.keys(plugin.rules).forEach(ruleKey =>
allRules.set(ruleKey, plugin.rules[ruleKey])
Expand Down
4 changes: 1 addition & 3 deletions @commitlint/rules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
"@commitlint/parse": "^8.3.4",
"@commitlint/test": "8.2.0",
"@commitlint/utils": "^8.3.4",
"@types/lodash": "4.14.149",
"conventional-changelog-angular": "5.0.6",
"globby": "^11.0.0",
"lodash": "^4.17.15"
"globby": "^11.0.0"
},
"dependencies": {
"@commitlint/ensure": "^8.3.4",
Expand Down
3 changes: 1 addition & 2 deletions @commitlint/rules/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path';
import globby from 'globby';
import values from 'lodash/values';
import rules from '.';

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

test('rules export functions', () => {
const actual = values(rules);
const actual = Object.values(rules);
expect(actual.every(rule => typeof rule === 'function')).toBe(true);
});

Expand Down
1 change: 0 additions & 1 deletion @packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@commitlint/test": "8.2.0",
"execa": "0.11.0",
"is-builtin-module": "3.0.0",
"lodash": "^4.17.15",
"meow": "4.0.1",
"read-pkg": "5.2.0",
"require-from-string": "2.0.2",
Expand Down
3 changes: 1 addition & 2 deletions @packages/utils/pkg-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const meow = require('meow');
const readPkg = require('read-pkg');
const requireFromString = require('require-from-string');
const tar = require('tar-fs');
const values = require('lodash/values');
const {fix} = require('@commitlint/test');

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

if (typeof bin === 'object') {
return values(bin).map(b => path.normalize(b));
return Object.values(bin).map(b => path.normalize(b));
}
}

Expand Down