lint-staged 13.1.3 → 13.1.4
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/figures.js +4 -4
- package/lib/messages.js +14 -12
- package/lib/resolveTaskFn.js +4 -4
- package/lib/runAll.js +6 -6
- package/package.json +2 -2
package/lib/figures.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from 'chalk'
|
|
2
2
|
import { figures } from 'listr2'
|
|
3
3
|
|
|
4
|
-
export const info = blue(figures.arrowRight)
|
|
4
|
+
export const info = chalk.blue(figures.arrowRight)
|
|
5
5
|
|
|
6
|
-
export const error = redBright(figures.cross)
|
|
6
|
+
export const error = chalk.redBright(figures.cross)
|
|
7
7
|
|
|
8
|
-
export const warning = yellow(figures.warning)
|
|
8
|
+
export const warning = chalk.yellow(figures.warning)
|
package/lib/messages.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from 'chalk'
|
|
2
2
|
import inspect from 'object-inspect'
|
|
3
3
|
|
|
4
4
|
import { error, info, warning } from './figures.js'
|
|
5
5
|
|
|
6
6
|
export const configurationError = (opt, helpMsg, value) =>
|
|
7
|
-
`${redBright(`${error} Validation Error:`)}
|
|
7
|
+
`${chalk.redBright(`${error} Validation Error:`)}
|
|
8
8
|
|
|
9
|
-
Invalid value for '${bold(opt)}': ${bold(
|
|
9
|
+
Invalid value for '${chalk.bold(opt)}': ${chalk.bold(
|
|
10
10
|
inspect(value, { inlineCharacterLimit: Number.POSITIVE_INFINITY })
|
|
11
11
|
)}
|
|
12
12
|
|
|
13
13
|
${helpMsg}`
|
|
14
14
|
|
|
15
|
-
export const NOT_GIT_REPO = redBright(`${error} Current directory is not a git directory!`)
|
|
15
|
+
export const NOT_GIT_REPO = chalk.redBright(`${error} Current directory is not a git directory!`)
|
|
16
16
|
|
|
17
|
-
export const FAILED_GET_STAGED_FILES = redBright(`${error} Failed to get staged files!`)
|
|
17
|
+
export const FAILED_GET_STAGED_FILES = chalk.redBright(`${error} Failed to get staged files!`)
|
|
18
18
|
|
|
19
19
|
export const incorrectBraces = (before, after) =>
|
|
20
|
-
yellow(
|
|
20
|
+
chalk.yellow(
|
|
21
21
|
`${warning} Detected incorrect braces with only single value: \`${before}\`. Reformatted as: \`${after}\`
|
|
22
22
|
`
|
|
23
23
|
)
|
|
@@ -36,10 +36,10 @@ export const skippingBackup = (hasInitialCommit, diff) => {
|
|
|
36
36
|
? '`--no-stash` was used'
|
|
37
37
|
: 'there’s no initial commit yet'
|
|
38
38
|
|
|
39
|
-
return yellow(`${warning} Skipping backup because ${reason}.\n`)
|
|
39
|
+
return chalk.yellow(`${warning} Skipping backup because ${reason}.\n`)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export const DEPRECATED_GIT_ADD = yellow(
|
|
42
|
+
export const DEPRECATED_GIT_ADD = chalk.yellow(
|
|
43
43
|
`${warning} Some of your tasks use \`git add\` command. Please remove it from the config since all modifications made by tasks will be automatically added to the git commit index.
|
|
44
44
|
`
|
|
45
45
|
)
|
|
@@ -48,18 +48,20 @@ export const TASK_ERROR = 'Skipped because of errors from tasks.'
|
|
|
48
48
|
|
|
49
49
|
export const SKIPPED_GIT_ERROR = 'Skipped because of previous git error.'
|
|
50
50
|
|
|
51
|
-
export const GIT_ERROR = `\n ${redBright(`${error} lint-staged failed due to a git error.`)}`
|
|
51
|
+
export const GIT_ERROR = `\n ${chalk.redBright(`${error} lint-staged failed due to a git error.`)}`
|
|
52
52
|
|
|
53
|
-
export const invalidOption = (name, value, message) => `${redBright(
|
|
53
|
+
export const invalidOption = (name, value, message) => `${chalk.redBright(
|
|
54
|
+
`${error} Validation Error:`
|
|
55
|
+
)}
|
|
54
56
|
|
|
55
|
-
Invalid value for option '${bold(name)}': ${bold(value)}
|
|
57
|
+
Invalid value for option '${chalk.bold(name)}': ${chalk.bold(value)}
|
|
56
58
|
|
|
57
59
|
${message}
|
|
58
60
|
|
|
59
61
|
See https://github.com/okonet/lint-staged#command-line-flags`
|
|
60
62
|
|
|
61
63
|
export const PREVENTED_EMPTY_COMMIT = `
|
|
62
|
-
${yellow(`${warning} lint-staged prevented an empty git commit.
|
|
64
|
+
${chalk.yellow(`${warning} lint-staged prevented an empty git commit.
|
|
63
65
|
Use the --allow-empty option to continue, or check your task configuration`)}
|
|
64
66
|
`
|
|
65
67
|
|
package/lib/resolveTaskFn.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from 'chalk'
|
|
2
2
|
import { execa, execaCommand } from 'execa'
|
|
3
3
|
import debug from 'debug'
|
|
4
4
|
import { parseArgsStringToArgv } from 'string-argv'
|
|
@@ -32,7 +32,7 @@ const handleOutput = (command, result, ctx, isError = false) => {
|
|
|
32
32
|
const hasOutput = !!stderr || !!stdout
|
|
33
33
|
|
|
34
34
|
if (hasOutput) {
|
|
35
|
-
const outputTitle = isError ? redBright(`${error} ${command}:`) : `${info} ${command}:`
|
|
35
|
+
const outputTitle = isError ? chalk.redBright(`${error} ${command}:`) : `${info} ${command}:`
|
|
36
36
|
const output = []
|
|
37
37
|
.concat(ctx.quiet ? [] : ['', outputTitle])
|
|
38
38
|
.concat(stderr ? stderr : [])
|
|
@@ -41,7 +41,7 @@ const handleOutput = (command, result, ctx, isError = false) => {
|
|
|
41
41
|
} else if (isError) {
|
|
42
42
|
// Show generic error when task had no output
|
|
43
43
|
const tag = getTag(result)
|
|
44
|
-
const message = redBright(`\n${error} ${command} failed without output (${tag}).`)
|
|
44
|
+
const message = chalk.redBright(`\n${error} ${command} failed without output (${tag}).`)
|
|
45
45
|
if (!ctx.quiet) ctx.output.push(message)
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -116,7 +116,7 @@ const makeErr = (command, result, ctx) => {
|
|
|
116
116
|
|
|
117
117
|
handleOutput(command, result, ctx, true)
|
|
118
118
|
const tag = getTag(result)
|
|
119
|
-
return new Error(`${redBright(command)} ${dim(`[${tag}]`)}`)
|
|
119
|
+
return new Error(`${chalk.redBright(command)} ${chalk.dim(`[${tag}]`)}`)
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
package/lib/runAll.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import chalk from 'chalk'
|
|
6
6
|
import debug from 'debug'
|
|
7
7
|
import { Listr } from 'listr2'
|
|
8
8
|
import normalize from 'normalize-path'
|
|
@@ -204,7 +204,7 @@ export const runAll = async (
|
|
|
204
204
|
const fileCount = task.fileList.length
|
|
205
205
|
|
|
206
206
|
return {
|
|
207
|
-
title: `${task.pattern}${dim(
|
|
207
|
+
title: `${task.pattern}${chalk.dim(
|
|
208
208
|
` — ${fileCount} ${fileCount === 1 ? 'file' : 'files'}`
|
|
209
209
|
)}`,
|
|
210
210
|
task: async (ctx, task) =>
|
|
@@ -216,7 +216,7 @@ export const runAll = async (
|
|
|
216
216
|
skip: () => {
|
|
217
217
|
// Skip task when no files matched
|
|
218
218
|
if (fileCount === 0) {
|
|
219
|
-
return `${task.pattern}${dim(' — no files')}`
|
|
219
|
+
return `${task.pattern}${chalk.dim(' — no files')}`
|
|
220
220
|
}
|
|
221
221
|
return false
|
|
222
222
|
},
|
|
@@ -227,15 +227,15 @@ export const runAll = async (
|
|
|
227
227
|
|
|
228
228
|
listrTasks.push({
|
|
229
229
|
title:
|
|
230
|
-
`${configName}${dim(` — ${files.length} ${files.length > 1 ? 'files' : 'file'}`)}` +
|
|
231
|
-
(chunkCount > 1 ? dim(` (chunk ${index + 1}/${chunkCount})...`) : ''),
|
|
230
|
+
`${configName}${chalk.dim(` — ${files.length} ${files.length > 1 ? 'files' : 'file'}`)}` +
|
|
231
|
+
(chunkCount > 1 ? chalk.dim(` (chunk ${index + 1}/${chunkCount})...`) : ''),
|
|
232
232
|
task: (ctx, task) => task.newListr(chunkListrTasks, { concurrent, exitOnError: true }),
|
|
233
233
|
skip: () => {
|
|
234
234
|
// Skip if the first step (backup) failed
|
|
235
235
|
if (ctx.errors.has(GitError)) return SKIPPED_GIT_ERROR
|
|
236
236
|
// Skip chunk when no every task is skipped (due to no matches)
|
|
237
237
|
if (chunkListrTasks.every((task) => task.skip())) {
|
|
238
|
-
return `${configName}${dim(' — no tasks to run')}`
|
|
238
|
+
return `${configName}${chalk.dim(' — no tasks to run')}`
|
|
239
239
|
}
|
|
240
240
|
return false
|
|
241
241
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lint-staged",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.4",
|
|
4
4
|
"description": "Lint files staged by git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/okonet/lint-staged",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"test:watch": "jest --watch"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"chalk": "5.2.0",
|
|
36
37
|
"cli-truncate": "^3.1.0",
|
|
37
|
-
"colorette": "^2.0.19",
|
|
38
38
|
"commander": "^10.0.0",
|
|
39
39
|
"debug": "^4.3.4",
|
|
40
40
|
"execa": "^7.0.0",
|