Skip to content

Commit e093b1d

Browse files
authored
fix(deps): update dependencies
1 parent 6066b07 commit e093b1d

22 files changed

+2076
-1916
lines changed

bin/lint-staged.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const options = {
8181
debug('Options parsed from command-line:', options)
8282

8383
lintStaged(options)
84-
.then(passed => {
84+
.then((passed) => {
8585
process.exitCode = passed ? 0 : 1
8686
})
8787
.catch(() => {

lib/chunkFiles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = function chunkFiles({ files, baseDir, maxArgLength = null, rela
3838
return [files]
3939
}
4040

41-
const normalizedFiles = files.map(file =>
41+
const normalizedFiles = files.map((file) =>
4242
normalize(relative || !baseDir ? file : path.resolve(baseDir, file))
4343
)
4444
const fileListLength = normalizedFiles.join(' ').length

lib/generateTasks.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ module.exports = function generateTasks({
2525
}) {
2626
debug('Generating linter tasks')
2727

28-
const absoluteFiles = files.map(file => normalize(path.resolve(gitDir, file)))
29-
const relativeFiles = absoluteFiles.map(file => normalize(path.relative(cwd, file)))
28+
const absoluteFiles = files.map((file) => normalize(path.resolve(gitDir, file)))
29+
const relativeFiles = absoluteFiles.map((file) => normalize(path.relative(cwd, file)))
3030

3131
return Object.entries(config).map(([pattern, commands]) => {
3232
const isParentDirPattern = pattern.startsWith('../')
@@ -35,7 +35,7 @@ module.exports = function generateTasks({
3535
relativeFiles
3636
// Only worry about children of the CWD unless the pattern explicitly
3737
// specifies that it concerns a parent directory.
38-
.filter(file => {
38+
.filter((file) => {
3939
if (isParentDirPattern) return true
4040
return !file.startsWith('..') && !path.isAbsolute(file)
4141
}),
@@ -48,7 +48,7 @@ module.exports = function generateTasks({
4848
// match both `test.js` and `subdirectory/test.js`.
4949
matchBase: !pattern.includes('/')
5050
}
51-
).map(file => normalize(relative ? file : path.resolve(cwd, file)))
51+
).map((file) => normalize(relative ? file : path.resolve(cwd, file)))
5252

5353
const task = { pattern, commands, fileList }
5454
debug('Generated task: \n%O', task)

lib/gitWorkflow.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class GitWorkflow {
8585
*/
8686
async getBackupStash(ctx) {
8787
const stashes = await this.execGit(['stash', 'list'])
88-
const index = stashes.split('\n').findIndex(line => line.includes(STASH))
88+
const index = stashes.split('\n').findIndex((line) => line.includes(STASH))
8989
if (index === -1) {
9090
ctx.gitGetBackupStashError = true
9191
throw new Error('lint-staged automatic backup is missing!')
@@ -102,7 +102,7 @@ class GitWorkflow {
102102
const deletedFiles = lsFiles
103103
.split('\n')
104104
.filter(Boolean)
105-
.map(file => path.resolve(this.gitDir, file))
105+
.map((file) => path.resolve(this.gitDir, file))
106106
debug('Found deleted files:', deletedFiles)
107107
return deletedFiles
108108
}
@@ -113,9 +113,9 @@ class GitWorkflow {
113113
async backupMergeStatus() {
114114
debug('Backing up merge state...')
115115
await Promise.all([
116-
readFile(this.mergeHeadFilename).then(buffer => (this.mergeHeadBuffer = buffer)),
117-
readFile(this.mergeModeFilename).then(buffer => (this.mergeModeBuffer = buffer)),
118-
readFile(this.mergeMsgFilename).then(buffer => (this.mergeMsgBuffer = buffer))
116+
readFile(this.mergeHeadFilename).then((buffer) => (this.mergeHeadBuffer = buffer)),
117+
readFile(this.mergeModeFilename).then((buffer) => (this.mergeModeBuffer = buffer)),
118+
readFile(this.mergeMsgFilename).then((buffer) => (this.mergeMsgBuffer = buffer))
119119
])
120120
debug('Done backing up merge state!')
121121
}
@@ -149,7 +149,7 @@ class GitWorkflow {
149149
const status = await this.execGit(['status', '--porcelain'])
150150
const partiallyStaged = status
151151
.split('\n')
152-
.filter(line => {
152+
.filter((line) => {
153153
/**
154154
* See https://git-scm.com/docs/git-status#_short_format
155155
* The first letter of the line represents current index status,
@@ -158,7 +158,7 @@ class GitWorkflow {
158158
const [index, workingTree] = line
159159
return index !== ' ' && workingTree !== ' ' && index !== '?' && workingTree !== '?'
160160
})
161-
.map(line => line.substr(3)) // Remove first three letters (index, workingTree, and a whitespace)
161+
.map((line) => line.substr(3)) // Remove first three letters (index, workingTree, and a whitespace)
162162
debug('Found partially staged files:', partiallyStaged)
163163
return partiallyStaged.length ? partiallyStaged : null
164164
}
@@ -203,7 +203,7 @@ class GitWorkflow {
203203
await this.restoreMergeStatus()
204204

205205
// If stashing resurrected deleted files, clean them out
206-
await Promise.all(this.deletedFiles.map(file => unlink(file)))
206+
await Promise.all(this.deletedFiles.map((file) => unlink(file)))
207207

208208
debug('Done backing up original state!')
209209
} catch (error) {
@@ -303,7 +303,7 @@ class GitWorkflow {
303303
await this.restoreMergeStatus()
304304

305305
// If stashing resurrected deleted files, clean them out
306-
await Promise.all(this.deletedFiles.map(file => unlink(file)))
306+
await Promise.all(this.deletedFiles.map((file) => unlink(file)))
307307

308308
// Clean out patch
309309
await unlink(this.getHiddenFilepath(PATCH_UNSTAGED))

lib/printErrors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
// istanbul ignore next
44
// Work-around for duplicated error logs, see #142
5-
const errMsg = err => (err.privateMsg != null ? err.privateMsg : err.message)
5+
const errMsg = (err) => (err.privateMsg != null ? err.privateMsg : err.message)
66

77
module.exports = function printErrors(errorInstance, logger) {
88
if (Array.isArray(errorInstance.errors)) {
9-
errorInstance.errors.forEach(lintError => {
9+
errorInstance.errors.forEach((lintError) => {
1010
logger.error(errMsg(lintError))
1111
})
1212
} else {

lib/resolveGitRepo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const fsLstat = promisify(fs.lstat)
1515
* Resolve path to the .git directory, with special handling for
1616
* submodules and worktrees
1717
*/
18-
const resolveGitConfigDir = async gitDir => {
18+
const resolveGitConfigDir = async (gitDir) => {
1919
const defaultDir = normalize(path.join(gitDir, '.git'))
2020
const stats = await fsLstat(defaultDir)
2121
// If .git is a directory, use it
@@ -28,7 +28,7 @@ const resolveGitConfigDir = async gitDir => {
2828
/**
2929
* Resolve git directory and possible submodule paths
3030
*/
31-
const resolveGitRepo = async cwd => {
31+
const resolveGitRepo = async (cwd) => {
3232
try {
3333
debugLog('Resolving git repo from `%s`', cwd)
3434

lib/resolveTaskFn.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const symbols = require('log-symbols')
88

99
const debug = require('debug')('lint-staged:task')
1010

11-
const successMsg = linter => `${symbols.success} ${linter} passed!`
11+
const successMsg = (linter) => `${symbols.success} ${linter} passed!`
1212

1313
/**
1414
* Create and returns an error instance with a given message.
@@ -81,7 +81,7 @@ module.exports = function resolveTaskFn({ command, files, gitDir, isFn, relative
8181
}
8282
debug('execaOptions:', execaOptions)
8383

84-
return async ctx => {
84+
return async (ctx) => {
8585
const promise = shell
8686
? execa.command(isFn ? command : `${command} ${files.join(' ')}`, execaOptions)
8787
: execa(cmd, isFn ? args : args.concat(files), execaOptions)

lib/runAll.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const MESSAGES = {
2929
GIT_ERROR: 'Skipped because of previous git error.'
3030
}
3131

32-
const shouldSkipApplyModifications = ctx => {
32+
const shouldSkipApplyModifications = (ctx) => {
3333
// Should be skipped in case of git errors
3434
if (ctx.gitError) {
3535
return MESSAGES.GIT_ERROR
@@ -40,14 +40,14 @@ const shouldSkipApplyModifications = ctx => {
4040
}
4141
}
4242

43-
const shouldSkipRevert = ctx => {
43+
const shouldSkipRevert = (ctx) => {
4444
// Should be skipped in case of unknown git errors
4545
if (ctx.gitError && !ctx.gitApplyEmptyCommitError && !ctx.gitRestoreUnstagedChangesError) {
4646
return MESSAGES.GIT_ERROR
4747
}
4848
}
4949

50-
const shouldSkipCleanup = ctx => {
50+
const shouldSkipCleanup = (ctx) => {
5151
// Should be skipped in case of unknown git errors
5252
if (ctx.gitError && !ctx.gitApplyEmptyCommitError && !ctx.gitRestoreUnstagedChangesError) {
5353
return MESSAGES.GIT_ERROR
@@ -149,11 +149,11 @@ const runAll = async (
149149
})
150150

151151
// Add files from task to match set
152-
task.fileList.forEach(file => {
152+
task.fileList.forEach((file) => {
153153
matchedFiles.add(file)
154154
})
155155

156-
hasDeprecatedGitAdd = subTasks.some(subTask => subTask.command === 'git add')
156+
hasDeprecatedGitAdd = subTasks.some((subTask) => subTask.command === 'git add')
157157

158158
chunkListrTasks.push({
159159
title: `Running tasks for ${task.pattern}`,
@@ -184,7 +184,7 @@ const runAll = async (
184184
// Skip if the first step (backup) failed
185185
if (ctx.gitError) return MESSAGES.GIT_ERROR
186186
// Skip chunk when no every task is skipped (due to no matches)
187-
if (chunkListrTasks.every(task => task.skip())) return 'No tasks to run.'
187+
if (chunkListrTasks.every((task) => task.skip())) return 'No tasks to run.'
188188
return false
189189
}
190190
})
@@ -199,7 +199,7 @@ const runAll = async (
199199

200200
// If all of the configured tasks should be skipped
201201
// avoid executing any lint-staged logic
202-
if (listrTasks.every(task => task.skip())) {
202+
if (listrTasks.every((task) => task.skip())) {
203203
logger.log('No staged files match any of provided globs.')
204204
return 'No tasks to run.'
205205
}
@@ -210,37 +210,37 @@ const runAll = async (
210210
[
211211
{
212212
title: 'Preparing...',
213-
task: ctx => git.prepare(ctx, shouldBackup)
213+
task: (ctx) => git.prepare(ctx, shouldBackup)
214214
},
215215
{
216216
title: 'Hiding unstaged changes to partially staged files...',
217-
task: ctx => git.hideUnstagedChanges(ctx),
218-
enabled: ctx => ctx.hasPartiallyStagedFiles
217+
task: (ctx) => git.hideUnstagedChanges(ctx),
218+
enabled: (ctx) => ctx.hasPartiallyStagedFiles
219219
},
220220
...listrTasks,
221221
{
222222
title: 'Applying modifications...',
223-
task: ctx => git.applyModifications(ctx),
223+
task: (ctx) => git.applyModifications(ctx),
224224
// Always apply back unstaged modifications when skipping backup
225-
skip: ctx => shouldBackup && shouldSkipApplyModifications(ctx)
225+
skip: (ctx) => shouldBackup && shouldSkipApplyModifications(ctx)
226226
},
227227
{
228228
title: 'Restoring unstaged changes to partially staged files...',
229-
task: ctx => git.restoreUnstagedChanges(ctx),
230-
enabled: ctx => ctx.hasPartiallyStagedFiles,
229+
task: (ctx) => git.restoreUnstagedChanges(ctx),
230+
enabled: (ctx) => ctx.hasPartiallyStagedFiles,
231231
skip: shouldSkipApplyModifications
232232
},
233233
{
234234
title: 'Reverting to original state because of errors...',
235-
task: ctx => git.restoreOriginalState(ctx),
236-
enabled: ctx =>
235+
task: (ctx) => git.restoreOriginalState(ctx),
236+
enabled: (ctx) =>
237237
shouldBackup &&
238238
(ctx.taskError || ctx.gitApplyEmptyCommitError || ctx.gitRestoreUnstagedChangesError),
239239
skip: shouldSkipRevert
240240
},
241241
{
242242
title: 'Cleaning up...',
243-
task: ctx => git.cleanup(ctx),
243+
task: (ctx) => git.cleanup(ctx),
244244
enabled: () => shouldBackup,
245245
skip: shouldSkipCleanup
246246
}

lib/validateConfig.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ const format = require('stringify-object')
88
const debug = require('debug')('lint-staged:cfg')
99

1010
const TEST_DEPRECATED_KEYS = new Map([
11-
['concurrent', key => typeof key === 'boolean'],
12-
['chunkSize', key => typeof key === 'number'],
13-
['globOptions', key => typeof key === 'object'],
14-
['linters', key => typeof key === 'object'],
15-
['ignore', key => Array.isArray(key)],
16-
['subTaskConcurrency', key => typeof key === 'number'],
17-
['renderer', key => typeof key === 'string'],
18-
['relative', key => typeof key === 'boolean']
11+
['concurrent', (key) => typeof key === 'boolean'],
12+
['chunkSize', (key) => typeof key === 'number'],
13+
['globOptions', (key) => typeof key === 'object'],
14+
['linters', (key) => typeof key === 'object'],
15+
['ignore', (key) => Array.isArray(key)],
16+
['subTaskConcurrency', (key) => typeof key === 'number'],
17+
['renderer', (key) => typeof key === 'string'],
18+
['relative', (key) => typeof key === 'boolean']
1919
])
2020

21-
const formatError = helpMsg => `● Validation Error:
21+
const formatError = (helpMsg) => `● Validation Error:
2222
2323
${helpMsg}
2424
@@ -68,7 +68,7 @@ module.exports = function validateConfig(config) {
6868

6969
if (
7070
(!Array.isArray(task) ||
71-
task.some(item => typeof item !== 'string' && typeof item !== 'function')) &&
71+
task.some((item) => typeof item !== 'string' && typeof item !== 'function')) &&
7272
typeof task !== 'string' &&
7373
typeof task !== 'function'
7474
) {

package.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
}
3535
},
3636
"dependencies": {
37-
"chalk": "^3.0.0",
38-
"commander": "^4.0.1",
37+
"chalk": "^4.0.0",
38+
"commander": "^5.0.0",
3939
"cosmiconfig": "^6.0.0",
4040
"debug": "^4.1.1",
4141
"dedent": "^0.7.0",
42-
"execa": "^3.4.0",
42+
"execa": "^4.0.0",
4343
"listr": "^0.14.3",
4444
"log-symbols": "^3.0.0",
4545
"micromatch": "^4.0.2",
@@ -49,27 +49,27 @@
4949
"stringify-object": "^3.3.0"
5050
},
5151
"devDependencies": {
52-
"@babel/core": "^7.7.4",
53-
"@babel/plugin-proposal-object-rest-spread": "^7.7.4",
54-
"@babel/preset-env": "^7.7.4",
55-
"babel-eslint": "^10.0.3",
56-
"babel-jest": "^24.9.0",
52+
"@babel/core": "^7.9.0",
53+
"@babel/plugin-proposal-object-rest-spread": "^7.9.5",
54+
"@babel/preset-env": "^7.9.5",
55+
"babel-eslint": "^10.1.0",
56+
"babel-jest": "^25.3.0",
5757
"consolemock": "^1.1.0",
58-
"eslint": "^6.7.2",
58+
"eslint": "^6.8.0",
5959
"eslint-config-okonet": "^7.0.2",
60-
"eslint-config-prettier": "^6.7.0",
61-
"eslint-plugin-flowtype": "^4.5.2",
62-
"eslint-plugin-import": "^2.18.2",
60+
"eslint-config-prettier": "^6.10.1",
61+
"eslint-plugin-flowtype": "^4.7.0",
62+
"eslint-plugin-import": "^2.20.2",
6363
"eslint-plugin-jsx-a11y": "^6.2.3",
64-
"eslint-plugin-node": "^10.0.0",
65-
"eslint-plugin-prettier": "^3.1.1",
66-
"eslint-plugin-react": "^7.17.0",
67-
"fs-extra": "^8.1.0",
68-
"husky": "^3.1.0",
69-
"jest": "^24.9.0",
64+
"eslint-plugin-node": "^11.1.0",
65+
"eslint-plugin-prettier": "^3.1.3",
66+
"eslint-plugin-react": "^7.19.0",
67+
"fs-extra": "^9.0.0",
68+
"husky": "^4.2.5",
69+
"jest": "^25.3.0",
7070
"jest-snapshot-serializer-ansi": "^1.0.0",
71-
"nanoid": "^2.1.7",
72-
"prettier": "^1.19.1"
71+
"nanoid": "^3.1.3",
72+
"prettier": "^2.0.4"
7373
},
7474
"config": {
7575
"commitizen": {

0 commit comments

Comments
 (0)