lint-staged 9.4.1 → 9.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/makeCmdTasks.js +8 -4
package/package.json
CHANGED
package/src/makeCmdTasks.js
CHANGED
|
@@ -28,15 +28,19 @@ module.exports = async function makeCmdTasks({ commands, files, gitDir, shell })
|
|
|
28
28
|
// Create a matching command array with [file] in place of file names
|
|
29
29
|
let mockCommands
|
|
30
30
|
if (isFn) {
|
|
31
|
-
const mockFileList = Array(
|
|
31
|
+
const mockFileList = Array(files.length).fill('[file]')
|
|
32
32
|
const resolved = command(mockFileList)
|
|
33
33
|
mockCommands = Array.isArray(resolved) ? resolved : [resolved]
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
commands.forEach((command, i) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
let title = isFn ? '[Function]' : command
|
|
38
|
+
if (isFn && mockCommands[i]) {
|
|
39
|
+
// If command is a function, use the matching mock command as title,
|
|
40
|
+
// but since might include multiple [file] arguments, shorten to one
|
|
41
|
+
title = mockCommands[i].replace(/\[file\].*\[file\]/, '[file]')
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
const task = { title, task: resolveTaskFn({ gitDir, isFn, command, files, shell }) }
|
|
41
45
|
tasks.push(task)
|
|
42
46
|
})
|