@depup/lint-staged 16.3.3-depup.0 → 16.4.0-depup.0
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/README.md +2 -2
- package/lib/generateTasks.js +6 -28
- package/lib/matchFiles.js +22 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/lint-staged
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [lint-staged](https://www.npmjs.com/package/lint-staged) @ 16.
|
|
17
|
-
| Processed | 2026-03-
|
|
16
|
+
| Original | [lint-staged](https://www.npmjs.com/package/lint-staged) @ 16.4.0 |
|
|
17
|
+
| Processed | 2026-03-14 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 1 |
|
|
20
20
|
|
package/lib/generateTasks.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
|
|
3
|
-
import micromatch from 'micromatch'
|
|
4
|
-
|
|
5
3
|
import { createDebug } from './debug.js'
|
|
4
|
+
import { matchFiles } from './matchFiles.js'
|
|
6
5
|
import { normalizePath } from './normalizePath.js'
|
|
7
6
|
|
|
8
7
|
const debugLog = createDebug('lint-staged:generateTasks')
|
|
@@ -30,36 +29,15 @@ export const generateTasks = ({ config, cwd = process.cwd(), files, relative = f
|
|
|
30
29
|
|
|
31
30
|
// Only worry about children of the CWD unless the pattern explicitly
|
|
32
31
|
// specifies that it concerns a parent directory.
|
|
33
|
-
const
|
|
32
|
+
const includedFiles = relativeFiles.filter((file) => {
|
|
34
33
|
if (isParentDirPattern) return true
|
|
35
34
|
return !file.filepath.startsWith('..') && !path.isAbsolute(file.filepath)
|
|
36
35
|
})
|
|
37
36
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
cwd,
|
|
43
|
-
dot: true,
|
|
44
|
-
// If the pattern doesn't look like a path, enable `matchBase` to
|
|
45
|
-
// match against filenames in every directory. This makes `*.js`
|
|
46
|
-
// match both `test.js` and `subdirectory/test.js`.
|
|
47
|
-
matchBase: !pattern.includes('/'),
|
|
48
|
-
posixSlashes: true,
|
|
49
|
-
strictBrackets: true,
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
const fileList = filteredFiles.flatMap((file) =>
|
|
54
|
-
matches.includes(file.filepath)
|
|
55
|
-
? [
|
|
56
|
-
{
|
|
57
|
-
filepath: normalizePath(relative ? file.filepath : path.resolve(cwd, file.filepath)),
|
|
58
|
-
status: file.status,
|
|
59
|
-
},
|
|
60
|
-
]
|
|
61
|
-
: []
|
|
62
|
-
)
|
|
37
|
+
const fileList = matchFiles(includedFiles, pattern, cwd).map((file) => ({
|
|
38
|
+
filepath: normalizePath(relative ? file.filepath : path.resolve(cwd, file.filepath)),
|
|
39
|
+
status: file.status,
|
|
40
|
+
}))
|
|
63
41
|
|
|
64
42
|
const task = { pattern, commands, fileList }
|
|
65
43
|
debugLog('Generated task: \n%O', task)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import picomatch from 'picomatch'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Match list of files against a pattern.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} pattern
|
|
7
|
+
* @param {import('./getStagedFiles.js').StagedFile[]} files
|
|
8
|
+
*/
|
|
9
|
+
export const matchFiles = (files, pattern, cwd = process.cwd()) => {
|
|
10
|
+
const isMatch = picomatch(pattern, {
|
|
11
|
+
cwd,
|
|
12
|
+
dot: true,
|
|
13
|
+
// If the pattern doesn't look like a path, enable `matchBase` to
|
|
14
|
+
// match against filenames in every directory. This makes `*.js`
|
|
15
|
+
// match both `test.js` and `subdirectory/test.js`.
|
|
16
|
+
matchBase: !pattern.includes('/'),
|
|
17
|
+
posixSlashes: true,
|
|
18
|
+
strictBrackets: true,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return files.filter((file) => isMatch(file.filepath))
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/lint-staged",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.4.0-depup.0",
|
|
4
4
|
"description": "[DepUp] Lint files staged by git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"commander": "^14.0.3",
|
|
52
52
|
"listr2": "^10.2.1",
|
|
53
|
-
"
|
|
53
|
+
"picomatch": "^4.0.3",
|
|
54
54
|
"string-argv": "^0.3.2",
|
|
55
|
-
"tinyexec": "^1.0.
|
|
55
|
+
"tinyexec": "^1.0.4",
|
|
56
56
|
"yaml": "^2.8.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@changesets/changelog-github": "0.
|
|
60
|
-
"@changesets/cli": "2.
|
|
61
|
-
"@commitlint/cli": "20.4.
|
|
62
|
-
"@commitlint/config-conventional": "20.4.
|
|
59
|
+
"@changesets/changelog-github": "0.6.0",
|
|
60
|
+
"@changesets/cli": "2.30.0",
|
|
61
|
+
"@commitlint/cli": "20.4.4",
|
|
62
|
+
"@commitlint/config-conventional": "20.4.4",
|
|
63
63
|
"@eslint/js": "10.0.1",
|
|
64
64
|
"@vitest/coverage-v8": "4.0.18",
|
|
65
65
|
"@vitest/eslint-plugin": "1.6.9",
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
},
|
|
104
104
|
"depsUpdated": 1,
|
|
105
105
|
"originalPackage": "lint-staged",
|
|
106
|
-
"originalVersion": "16.
|
|
107
|
-
"processedAt": "2026-03-
|
|
106
|
+
"originalVersion": "16.4.0",
|
|
107
|
+
"processedAt": "2026-03-14T12:14:14.786Z",
|
|
108
108
|
"smokeTest": "passed"
|
|
109
109
|
}
|
|
110
110
|
}
|