lint-staged 15.2.10 → 15.2.11
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/getStagedFiles.js +10 -1
- package/lib/resolveTaskFn.js +9 -1
- package/package.json +14 -14
package/lib/getStagedFiles.js
CHANGED
|
@@ -5,12 +5,21 @@ import { getDiffCommand } from './getDiffCommand.js'
|
|
|
5
5
|
import { normalizePath } from './normalizePath.js'
|
|
6
6
|
import { parseGitZOutput } from './parseGitZOutput.js'
|
|
7
7
|
|
|
8
|
+
const listSubmoduleRoots = async ({ cwd }) => {
|
|
9
|
+
const lines = await execGit(['submodule', '--quiet', 'foreach', 'echo $displaypath'], { cwd })
|
|
10
|
+
return lines.split('\n').map((file) => normalizePath(path.resolve(cwd, file)))
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
export const getStagedFiles = async ({ cwd = process.cwd(), diff, diffFilter } = {}) => {
|
|
9
14
|
try {
|
|
10
15
|
const lines = await execGit(getDiffCommand(diff, diffFilter), { cwd })
|
|
11
16
|
if (!lines) return []
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
const submodules = await listSubmoduleRoots({ cwd })
|
|
19
|
+
|
|
20
|
+
return parseGitZOutput(lines)
|
|
21
|
+
.map((file) => normalizePath(path.resolve(cwd, file)))
|
|
22
|
+
.filter((file) => !submodules.includes(file))
|
|
14
23
|
} catch {
|
|
15
24
|
return null
|
|
16
25
|
}
|
package/lib/resolveTaskFn.js
CHANGED
|
@@ -8,6 +8,11 @@ import { error, info } from './figures.js'
|
|
|
8
8
|
import { getInitialState } from './state.js'
|
|
9
9
|
import { TaskError } from './symbols.js'
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @see https://github.com/sindresorhus/execa/blob/f4b8b3ab601c94d1503f1010822952758dcc6350/lib/command.js#L32-L37
|
|
13
|
+
*/
|
|
14
|
+
const escapeSpaces = (input) => input.replaceAll(' ', '\\ ')
|
|
15
|
+
|
|
11
16
|
const TASK_ERROR = 'lint-staged:taskError'
|
|
12
17
|
|
|
13
18
|
const debugLog = debug('lint-staged:resolveTaskFn')
|
|
@@ -159,7 +164,10 @@ export const resolveTaskFn = ({
|
|
|
159
164
|
|
|
160
165
|
return async (ctx = getInitialState()) => {
|
|
161
166
|
const execaChildProcess = shell
|
|
162
|
-
? execaCommand(
|
|
167
|
+
? execaCommand(
|
|
168
|
+
isFn ? command : `${command} ${files.map(escapeSpaces).join(' ')}`,
|
|
169
|
+
execaOptions
|
|
170
|
+
)
|
|
163
171
|
: execa(cmd, isFn ? args : args.concat(files), execaOptions)
|
|
164
172
|
|
|
165
173
|
const quitInterruptCheck = interruptExecutionOnError(ctx, execaChildProcess)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lint-staged",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.11",
|
|
4
4
|
"description": "Lint files staged by git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/lint-staged/lint-staged",
|
|
@@ -38,34 +38,34 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"chalk": "~5.3.0",
|
|
40
40
|
"commander": "~12.1.0",
|
|
41
|
-
"debug": "~4.
|
|
41
|
+
"debug": "~4.4.0",
|
|
42
42
|
"execa": "~8.0.1",
|
|
43
|
-
"lilconfig": "~3.1.
|
|
44
|
-
"listr2": "~8.2.
|
|
43
|
+
"lilconfig": "~3.1.3",
|
|
44
|
+
"listr2": "~8.2.5",
|
|
45
45
|
"micromatch": "~4.0.8",
|
|
46
46
|
"pidtree": "~0.6.0",
|
|
47
47
|
"string-argv": "~0.3.2",
|
|
48
|
-
"yaml": "~2.
|
|
48
|
+
"yaml": "~2.6.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@changesets/changelog-github": "0.5.0",
|
|
52
|
-
"@changesets/cli": "2.27.
|
|
53
|
-
"@commitlint/cli": "19.
|
|
54
|
-
"@commitlint/config-conventional": "19.
|
|
55
|
-
"@eslint/js": "9.
|
|
52
|
+
"@changesets/cli": "2.27.10",
|
|
53
|
+
"@commitlint/cli": "19.6.0",
|
|
54
|
+
"@commitlint/config-conventional": "19.6.0",
|
|
55
|
+
"@eslint/js": "9.16.0",
|
|
56
56
|
"consolemock": "1.1.0",
|
|
57
57
|
"cross-env": "7.0.3",
|
|
58
|
-
"eslint": "9.
|
|
58
|
+
"eslint": "9.16.0",
|
|
59
59
|
"eslint-config-prettier": "9.1.0",
|
|
60
|
-
"eslint-plugin-jest": "28.
|
|
61
|
-
"eslint-plugin-n": "17.
|
|
60
|
+
"eslint-plugin-jest": "28.9.0",
|
|
61
|
+
"eslint-plugin-n": "17.15.0",
|
|
62
62
|
"eslint-plugin-prettier": "5.2.1",
|
|
63
63
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
64
|
-
"husky": "9.1.
|
|
64
|
+
"husky": "9.1.7",
|
|
65
65
|
"jest": "29.7.0",
|
|
66
66
|
"jest-snapshot-serializer-ansi": "2.1.0",
|
|
67
67
|
"mock-stdin": "1.0.0",
|
|
68
|
-
"prettier": "3.
|
|
68
|
+
"prettier": "3.4.2",
|
|
69
69
|
"semver": "7.6.3"
|
|
70
70
|
},
|
|
71
71
|
"keywords": [
|