lint-staged 17.0.7 → 17.0.8

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/execGit.js CHANGED
@@ -4,9 +4,6 @@ import { createDebug } from './debug.js'
4
4
 
5
5
  const debugLog = createDebug('lint-staged:execGit')
6
6
 
7
- /** @example "warning: in the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it" */
8
- const GIT_CRLF_WARNING = /^warning.*CRLF.*the next time Git touches it/i
9
-
10
7
  /**
11
8
  * Explicitly never recurse commands into submodules, overriding local/global configuration.
12
9
  * @see https://git-scm.com/docs/git-config#Documentation/git-config.txt-submodulerecurse
@@ -19,27 +16,16 @@ export const GIT_GLOBAL_OPTIONS = [...NO_SUBMODULE_RECURSE]
19
16
  /** @type {(cmd: string[], options?: { cwd?: string }) => Promise<string>} */
20
17
  export const execGit = async (cmd, options) => {
21
18
  debugLog('Running git command:', cmd)
22
- const result = exec('git', [...NO_SUBMODULE_RECURSE, ...cmd], {
19
+ const result = await exec('git', [...NO_SUBMODULE_RECURSE, ...cmd], {
23
20
  nodeOptions: {
24
21
  env: options?.env,
25
22
  cwd: options?.cwd,
26
23
  },
27
24
  })
28
25
 
29
- let output = ''
30
- for await (const line of result) {
31
- if (GIT_CRLF_WARNING.test(line)) {
32
- debugLog('Stripped Git CRLF warning: %s', line)
33
- continue
34
- }
35
-
36
- output += line + '\n'
37
- }
38
- output = output.trimEnd()
39
-
40
26
  if (result.exitCode > 0) {
41
- throw new Error(output, { cause: result })
27
+ throw new Error(result.stderr.trimEnd(), { cause: result })
42
28
  }
43
29
 
44
- return output
30
+ return result.stdout.trimEnd()
45
31
  }
@@ -249,6 +249,8 @@ export class GitWorkflow {
249
249
 
250
250
  /** The stash line starts with the short hash, so we split from space and choose the first part */
251
251
  ctx.backupHash = stashes.find((line) => line.includes(STASH))?.split(' ')[0]
252
+
253
+ await this.restoreMergeStatus(ctx)
252
254
  } else {
253
255
  /** Save stash of all changes, keeping all files as-is */
254
256
  const stashHash = await this.execGit(['stash', 'create'])
@@ -440,7 +442,6 @@ export class GitWorkflow {
440
442
  await this.execGit(['reset', '--hard', 'HEAD'])
441
443
  await this.execGit(['stash', 'apply', '--quiet', '--index', await this.getBackupStash(ctx)])
442
444
 
443
- // Restore meta information about ongoing git merge
444
445
  await this.restoreMergeStatus(ctx)
445
446
 
446
447
  // Clean out patch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-staged",
3
- "version": "17.0.7",
3
+ "version": "17.0.8",
4
4
  "description": "Lint files staged by git",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -66,20 +66,20 @@
66
66
  "@commitlint/cli": "21.0.2",
67
67
  "@commitlint/config-conventional": "21.0.2",
68
68
  "@eslint/js": "10.0.1",
69
- "@vitest/coverage-istanbul": "4.1.7",
70
- "@vitest/eslint-plugin": "1.6.18",
69
+ "@vitest/coverage-istanbul": "4.1.9",
70
+ "@vitest/eslint-plugin": "1.6.20",
71
71
  "consolemock": "1.1.0",
72
72
  "cross-env": "10.1.0",
73
- "eslint": "10.4.1",
73
+ "eslint": "10.5.0",
74
74
  "eslint-config-prettier": "10.1.8",
75
- "eslint-plugin-n": "18.0.1",
75
+ "eslint-plugin-n": "18.1.0",
76
76
  "eslint-plugin-prettier": "5.5.6",
77
77
  "eslint-plugin-simple-import-sort": "13.0.0",
78
78
  "husky": "9.1.7",
79
79
  "mock-stdin": "1.0.0",
80
- "prettier": "3.8.3",
81
- "semver": "7.8.1",
82
- "vitest": "4.1.7"
80
+ "prettier": "3.8.4",
81
+ "semver": "7.8.4",
82
+ "vitest": "4.1.9"
83
83
  },
84
84
  "keywords": [
85
85
  "lint",