lint-staged 16.2.5 → 16.2.6

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.
@@ -129,6 +129,7 @@ export const makeErr = (command, error, ctx) => {
129
129
  * @param {Object} options
130
130
  * @param {boolean} [options.color]
131
131
  * @param {string} options.command — Linter task
132
+ * @param {string} [options.continueOnError]
132
133
  * @param {string} [options.cwd]
133
134
  * @param {String} options.topLevelDir - Current git repo top-level path
134
135
  * @param {Boolean} options.isFn - Whether the linter task is a function
@@ -139,6 +140,7 @@ export const makeErr = (command, error, ctx) => {
139
140
  export const getSpawnedTask = ({
140
141
  color,
141
142
  command,
143
+ continueOnError = false,
142
144
  cwd = process.cwd(),
143
145
  files,
144
146
  topLevelDir,
@@ -165,7 +167,9 @@ export const getSpawnedTask = ({
165
167
 
166
168
  try {
167
169
  const subprocess = spawn(cmd, isFn ? args : args.concat(files), spawnOptions)
168
- quitInterruptCheck = interruptExecutionOnError(ctx, subprocess)
170
+ if (!continueOnError) {
171
+ quitInterruptCheck = interruptExecutionOnError(ctx, subprocess)
172
+ }
169
173
  const result = await subprocess
170
174
  if (verbose) {
171
175
  handleOutput(command, result, ctx)
@@ -173,7 +177,9 @@ export const getSpawnedTask = ({
173
177
  } catch (error) {
174
178
  throw makeErr(command, error, ctx)
175
179
  } finally {
176
- await quitInterruptCheck()
180
+ if (quitInterruptCheck) {
181
+ await quitInterruptCheck()
182
+ }
177
183
  }
178
184
  }
179
185
  }
@@ -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 ({ color, commands, cwd, files, topLevelDir, verbose }) => {
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
@@ -224,6 +224,7 @@ export const runAll = async (
224
224
  : getSpawnedTasks({
225
225
  color,
226
226
  commands: task.commands,
227
+ continueOnError,
227
228
  cwd: groupCwd,
228
229
  files: task.fileList,
229
230
  topLevelDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-staged",
3
- "version": "16.2.5",
3
+ "version": "16.2.6",
4
4
  "description": "Lint files staged by git",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "commander": "^14.0.1",
52
- "listr2": "^9.0.4",
52
+ "listr2": "^9.0.5",
53
53
  "micromatch": "^4.0.8",
54
54
  "nano-spawn": "^2.0.0",
55
55
  "pidtree": "^0.6.0",
@@ -62,7 +62,7 @@
62
62
  "@commitlint/cli": "20.1.0",
63
63
  "@commitlint/config-conventional": "20.0.0",
64
64
  "@eslint/js": "9.38.0",
65
- "@vitest/coverage-v8": "3.2.4",
65
+ "@vitest/coverage-v8": "4.0.1",
66
66
  "@vitest/eslint-plugin": "1.3.23",
67
67
  "consolemock": "1.1.0",
68
68
  "cross-env": "10.1.0",
@@ -76,7 +76,7 @@
76
76
  "prettier": "3.6.2",
77
77
  "semver": "7.7.3",
78
78
  "typescript": "5.9.3",
79
- "vitest": "3.2.4"
79
+ "vitest": "4.0.1"
80
80
  },
81
81
  "keywords": [
82
82
  "lint",