lint-staged 16.2.5 → 16.2.7
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/lib/getSpawnedTask.js +12 -3
- package/lib/getSpawnedTasks.js +11 -1
- package/lib/runAll.js +1 -0
- package/package.json +8 -8
package/lib/getSpawnedTask.js
CHANGED
|
@@ -30,9 +30,12 @@ const handleOutput = (command, result, ctx, isError = false) => {
|
|
|
30
30
|
const outputTitle = isError ? red(`${error} ${command}:`) : `${info} ${command}:`
|
|
31
31
|
const output = [...(ctx.quiet ? [] : ['', outputTitle]), result.output]
|
|
32
32
|
ctx.output.push(output.join('\n'))
|
|
33
|
+
return
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
if (ctx.quiet)
|
|
36
|
+
if (ctx.quiet) {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
36
39
|
|
|
37
40
|
if (result instanceof SubprocessError) {
|
|
38
41
|
ctx.output.push(red(`\n${error} ${command} failed to spawn:`), result.message, result.cause)
|
|
@@ -129,6 +132,7 @@ export const makeErr = (command, error, ctx) => {
|
|
|
129
132
|
* @param {Object} options
|
|
130
133
|
* @param {boolean} [options.color]
|
|
131
134
|
* @param {string} options.command — Linter task
|
|
135
|
+
* @param {string} [options.continueOnError]
|
|
132
136
|
* @param {string} [options.cwd]
|
|
133
137
|
* @param {String} options.topLevelDir - Current git repo top-level path
|
|
134
138
|
* @param {Boolean} options.isFn - Whether the linter task is a function
|
|
@@ -139,6 +143,7 @@ export const makeErr = (command, error, ctx) => {
|
|
|
139
143
|
export const getSpawnedTask = ({
|
|
140
144
|
color,
|
|
141
145
|
command,
|
|
146
|
+
continueOnError = false,
|
|
142
147
|
cwd = process.cwd(),
|
|
143
148
|
files,
|
|
144
149
|
topLevelDir,
|
|
@@ -165,7 +170,9 @@ export const getSpawnedTask = ({
|
|
|
165
170
|
|
|
166
171
|
try {
|
|
167
172
|
const subprocess = spawn(cmd, isFn ? args : args.concat(files), spawnOptions)
|
|
168
|
-
|
|
173
|
+
if (!continueOnError) {
|
|
174
|
+
quitInterruptCheck = interruptExecutionOnError(ctx, subprocess)
|
|
175
|
+
}
|
|
169
176
|
const result = await subprocess
|
|
170
177
|
if (verbose) {
|
|
171
178
|
handleOutput(command, result, ctx)
|
|
@@ -173,7 +180,9 @@ export const getSpawnedTask = ({
|
|
|
173
180
|
} catch (error) {
|
|
174
181
|
throw makeErr(command, error, ctx)
|
|
175
182
|
} finally {
|
|
176
|
-
|
|
183
|
+
if (quitInterruptCheck) {
|
|
184
|
+
await quitInterruptCheck()
|
|
185
|
+
}
|
|
177
186
|
}
|
|
178
187
|
}
|
|
179
188
|
}
|
package/lib/getSpawnedTasks.js
CHANGED
|
@@ -10,12 +10,21 @@ const debugLog = createDebug('lint-staged:getSpawnedTasks')
|
|
|
10
10
|
* @param {object} options
|
|
11
11
|
* @param {boolean} [options.color]
|
|
12
12
|
* @param {Array<string|Function>|string|Function} options.commands
|
|
13
|
+
* @param {string} options.continueOnError
|
|
13
14
|
* @param {string} options.cwd
|
|
14
15
|
* @param {import('./getStagedFiles.js').StagedFile[]} options.files
|
|
15
16
|
* @param {string} options.topLevelDir
|
|
16
17
|
* @param {Boolean} verbose
|
|
17
18
|
*/
|
|
18
|
-
export const getSpawnedTasks = async ({
|
|
19
|
+
export const getSpawnedTasks = async ({
|
|
20
|
+
color,
|
|
21
|
+
commands,
|
|
22
|
+
continueOnError,
|
|
23
|
+
cwd,
|
|
24
|
+
files,
|
|
25
|
+
topLevelDir,
|
|
26
|
+
verbose,
|
|
27
|
+
}) => {
|
|
19
28
|
debugLog('Creating Listr tasks for commands %o', commands)
|
|
20
29
|
const cmdTasks = []
|
|
21
30
|
|
|
@@ -48,6 +57,7 @@ export const getSpawnedTasks = async ({ color, commands, cwd, files, topLevelDir
|
|
|
48
57
|
const task = getSpawnedTask({
|
|
49
58
|
color,
|
|
50
59
|
command,
|
|
60
|
+
continueOnError,
|
|
51
61
|
cwd,
|
|
52
62
|
files: filepaths,
|
|
53
63
|
topLevelDir,
|
package/lib/runAll.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lint-staged",
|
|
3
|
-
"version": "16.2.
|
|
3
|
+
"version": "16.2.7",
|
|
4
4
|
"description": "Lint files staged by git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"tag": "npx changeset tag"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"commander": "^14.0.
|
|
52
|
-
"listr2": "^9.0.
|
|
51
|
+
"commander": "^14.0.2",
|
|
52
|
+
"listr2": "^9.0.5",
|
|
53
53
|
"micromatch": "^4.0.8",
|
|
54
54
|
"nano-spawn": "^2.0.0",
|
|
55
55
|
"pidtree": "^0.6.0",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"@changesets/cli": "2.29.7",
|
|
62
62
|
"@commitlint/cli": "20.1.0",
|
|
63
63
|
"@commitlint/config-conventional": "20.0.0",
|
|
64
|
-
"@eslint/js": "9.
|
|
65
|
-
"@vitest/coverage-v8": "
|
|
66
|
-
"@vitest/eslint-plugin": "1.3
|
|
64
|
+
"@eslint/js": "9.39.1",
|
|
65
|
+
"@vitest/coverage-v8": "4.0.10",
|
|
66
|
+
"@vitest/eslint-plugin": "1.4.3",
|
|
67
67
|
"consolemock": "1.1.0",
|
|
68
68
|
"cross-env": "10.1.0",
|
|
69
|
-
"eslint": "9.
|
|
69
|
+
"eslint": "9.39.1",
|
|
70
70
|
"eslint-config-prettier": "10.1.8",
|
|
71
71
|
"eslint-plugin-n": "17.23.1",
|
|
72
72
|
"eslint-plugin-prettier": "5.5.4",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"prettier": "3.6.2",
|
|
77
77
|
"semver": "7.7.3",
|
|
78
78
|
"typescript": "5.9.3",
|
|
79
|
-
"vitest": "
|
|
79
|
+
"vitest": "4.0.10"
|
|
80
80
|
},
|
|
81
81
|
"keywords": [
|
|
82
82
|
"lint",
|