Skip to content

Commit 767edbd

Browse files
iirojokonet
authored andcommitted
refactor: remove dependency on lodash
1 parent c59cd9a commit 767edbd

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"del": "^4.1.1",
3636
"execa": "^2.0.1",
3737
"listr": "^0.14.3",
38-
"lodash": "^4.17.11",
3938
"log-symbols": "^3.0.0",
4039
"micromatch": "^4.0.2",
4140
"path-is-inside": "^1.0.2",

src/validateConfig.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
const chalk = require('chalk')
66
const format = require('stringify-object')
7-
const isArray = require('lodash/isArray')
8-
const isFunction = require('lodash/isFunction')
9-
const isObject = require('lodash/isObject')
10-
const isString = require('lodash/isString')
117

128
const debug = require('debug')('lint-staged:cfg')
139

@@ -36,7 +32,7 @@ module.exports = function validateConfig(config) {
3632

3733
const errors = []
3834

39-
if (!isObject(config)) {
35+
if (!config || typeof config !== 'object') {
4036
errors.push('Configuration should be an object!')
4137
} else {
4238
const globs = Object.keys(config)
@@ -47,9 +43,10 @@ module.exports = function validateConfig(config) {
4743

4844
globs.forEach(key => {
4945
if (
50-
(!isArray(config[key]) || config[key].some(item => !isString(item) && !isFunction(item))) &&
51-
!isString(config[key]) &&
52-
!isFunction(config[key])
46+
(!Array.isArray(config[key]) ||
47+
config[key].some(item => typeof item !== 'string' && typeof item !== 'function')) &&
48+
typeof config[key] !== 'string' &&
49+
typeof config[key] !== 'function'
5350
) {
5451
errors.push(
5552
createError(

0 commit comments

Comments
 (0)