lint-staged 12.5.0 → 13.0.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 +4 -0
- package/bin/lint-staged.js +6 -6
- package/lib/chunkFiles.js +1 -1
- package/lib/dynamicImport.js +1 -1
- package/lib/execGit.js +1 -1
- package/lib/file.js +1 -1
- package/lib/generateTasks.js +1 -1
- package/lib/getStagedFiles.js +1 -1
- package/lib/gitWorkflow.js +1 -1
- package/lib/groupFilesByConfig.js +1 -1
- package/lib/index.js +1 -1
- package/lib/printTaskOutput.js +1 -1
- package/lib/resolveConfig.js +1 -1
- package/lib/resolveGitRepo.js +2 -2
- package/lib/resolveTaskFn.js +2 -2
- package/lib/runAll.js +1 -1
- package/lib/searchConfigs.js +3 -3
- package/lib/validateOptions.js +3 -2
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -64,6 +64,10 @@ See [Releases](https://github.com/okonet/lint-staged/releases).
|
|
|
64
64
|
|
|
65
65
|
### Migration
|
|
66
66
|
|
|
67
|
+
#### v13
|
|
68
|
+
|
|
69
|
+
- Since `v13.0.0` _lint-staged_ no longer supports Node.js 12. Please upgrade your Node.js version to at least `14.13.1`, or `16.0.0` onward.
|
|
70
|
+
|
|
67
71
|
#### v12
|
|
68
72
|
|
|
69
73
|
- Since `v12.0.0` _lint-staged_ is a pure ESM module, so make sure your Node.js version is at least `12.20.0`, `14.13.1`, or `16.0.0`. Read more about ESM modules from the official [Node.js Documentation site here](https://nodejs.org/api/esm.html#introduction).
|
package/bin/lint-staged.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import fs from 'fs'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
6
|
|
|
7
|
+
import { isColorSupported } from 'colorette'
|
|
7
8
|
import { Option, program } from 'commander'
|
|
8
9
|
import debug from 'debug'
|
|
9
|
-
import supportsColor from 'supports-color'
|
|
10
10
|
|
|
11
11
|
import lintStaged from '../lib/index.js'
|
|
12
12
|
import { CONFIG_STDIN_ERROR } from '../lib/messages.js'
|
|
13
13
|
|
|
14
14
|
// Force colors for packages that depend on https://www.npmjs.com/package/supports-color
|
|
15
|
-
if (
|
|
16
|
-
process.env.FORCE_COLOR =
|
|
15
|
+
if (isColorSupported) {
|
|
16
|
+
process.env.FORCE_COLOR = '1'
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// Do not terminate main Listr process on SIGINT
|
package/lib/chunkFiles.js
CHANGED
package/lib/dynamicImport.js
CHANGED
package/lib/execGit.js
CHANGED
package/lib/file.js
CHANGED
package/lib/generateTasks.js
CHANGED
package/lib/getStagedFiles.js
CHANGED
package/lib/gitWorkflow.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -109,7 +109,7 @@ const lintStaged = async (
|
|
|
109
109
|
printTaskOutput(ctx, logger)
|
|
110
110
|
return true
|
|
111
111
|
} catch (runAllError) {
|
|
112
|
-
if (runAllError
|
|
112
|
+
if (runAllError?.ctx?.errors) {
|
|
113
113
|
const { ctx } = runAllError
|
|
114
114
|
|
|
115
115
|
if (ctx.errors.has(ConfigNotFoundError)) {
|
package/lib/printTaskOutput.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export const printTaskOutput = (ctx = {}, logger) => {
|
|
7
7
|
if (!Array.isArray(ctx.output)) return
|
|
8
|
-
const log = ctx.errors
|
|
8
|
+
const log = ctx.errors?.size > 0 ? logger.error : logger.log
|
|
9
9
|
for (const line of ctx.output) {
|
|
10
10
|
log(line)
|
|
11
11
|
}
|
package/lib/resolveConfig.js
CHANGED
package/lib/resolveGitRepo.js
CHANGED
package/lib/resolveTaskFn.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { redBright, dim } from 'colorette'
|
|
2
|
-
import execa from 'execa'
|
|
2
|
+
import { execa, execaCommand } from 'execa'
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
import { parseArgsStringToArgv } from 'string-argv'
|
|
5
5
|
import pidTree from 'pidtree'
|
|
@@ -139,7 +139,7 @@ export const resolveTaskFn = ({
|
|
|
139
139
|
|
|
140
140
|
return async (ctx = getInitialState()) => {
|
|
141
141
|
const execaChildProcess = shell
|
|
142
|
-
?
|
|
142
|
+
? execaCommand(isFn ? command : `${command} ${files.join(' ')}`, execaOptions)
|
|
143
143
|
: execa(cmd, isFn ? args : args.concat(files), execaOptions)
|
|
144
144
|
|
|
145
145
|
const quitInterruptCheck = interruptExecutionOnError(ctx, execaChildProcess)
|
package/lib/runAll.js
CHANGED
package/lib/searchConfigs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @typedef {import('./index').Logger} Logger */
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import path from 'node:path'
|
|
4
4
|
|
|
5
5
|
import debug from 'debug'
|
|
6
6
|
import normalize from 'normalize-path'
|
|
@@ -15,7 +15,7 @@ const debugLog = debug('lint-staged:searchConfigs')
|
|
|
15
15
|
const EXEC_GIT = ['ls-files', '-z', '--full-name']
|
|
16
16
|
|
|
17
17
|
const filterPossibleConfigFiles = (files) =>
|
|
18
|
-
files.filter((file) => searchPlaces.includes(basename(file)))
|
|
18
|
+
files.filter((file) => searchPlaces.includes(path.basename(file)))
|
|
19
19
|
|
|
20
20
|
const numberOfLevels = (file) => file.split('/').length
|
|
21
21
|
|
|
@@ -68,7 +68,7 @@ export const searchConfigs = async (
|
|
|
68
68
|
|
|
69
69
|
/** Sort possible config files so that deepest is first */
|
|
70
70
|
const possibleConfigFiles = [...cachedFiles, ...otherFiles]
|
|
71
|
-
.map((file) => normalize(join(gitDir, file)))
|
|
71
|
+
.map((file) => normalize(path.join(gitDir, file)))
|
|
72
72
|
.filter(isInsideDirectory(cwd))
|
|
73
73
|
.sort(sortDeepestParth)
|
|
74
74
|
|
package/lib/validateOptions.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lint-staged",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Lint files staged by git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/okonet/lint-staged",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://opencollective.com/lint-staged"
|
|
15
15
|
},
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": "^
|
|
17
|
+
"node": "^14.13.1 || >=16.0.0"
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"bin": "./bin/lint-staged.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"colorette": "^2.0.16",
|
|
37
37
|
"commander": "^9.3.0",
|
|
38
38
|
"debug": "^4.3.4",
|
|
39
|
-
"execa": "^
|
|
39
|
+
"execa": "^6.1.0",
|
|
40
40
|
"lilconfig": "2.0.5",
|
|
41
41
|
"listr2": "^4.0.5",
|
|
42
42
|
"micromatch": "^4.0.5",
|
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
"object-inspect": "^1.12.2",
|
|
45
45
|
"pidtree": "^0.5.0",
|
|
46
46
|
"string-argv": "^0.3.1",
|
|
47
|
-
"
|
|
48
|
-
"yaml": "^1.10.2"
|
|
47
|
+
"yaml": "^2.1.1"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
50
|
"@babel/core": "^7.18.2",
|