lint-staged 11.1.4 → 11.2.0-beta.1
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/bin/lint-staged.js +3 -3
- package/lib/figures.js +10 -0
- package/lib/messages.js +22 -20
- package/lib/resolveTaskFn.js +2 -2
- package/package.json +21 -21
package/bin/lint-staged.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
const fs = require('fs')
|
|
6
6
|
|
|
7
7
|
// Force colors for packages that depend on https://www.npmjs.com/package/supports-color
|
|
8
|
-
const
|
|
9
|
-
if (supportsColor
|
|
10
|
-
process.env.FORCE_COLOR = supportsColor.level.toString()
|
|
8
|
+
const supportsColor = require('supports-color')
|
|
9
|
+
if (supportsColor.stdout) {
|
|
10
|
+
process.env.FORCE_COLOR = supportsColor.stdout.level.toString()
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// Do not terminate main Listr process on SIGINT
|
package/lib/figures.js
ADDED
package/lib/messages.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const { error, info, warning } = require('log-symbols')
|
|
3
|
+
const { redBright, bold, yellow } = require('colorette')
|
|
5
4
|
const format = require('stringify-object')
|
|
6
5
|
|
|
6
|
+
const { error, info, warning } = require('./figures')
|
|
7
|
+
|
|
7
8
|
const configurationError = (opt, helpMsg, value) =>
|
|
8
|
-
`${
|
|
9
|
+
`${redBright(`${error} Validation Error:`)}
|
|
9
10
|
|
|
10
|
-
Invalid value for '${
|
|
11
|
+
Invalid value for '${bold(opt)}': ${bold(
|
|
11
12
|
format(value, { inlineCharacterLimit: Number.POSITIVE_INFINITY })
|
|
12
13
|
)}
|
|
13
14
|
|
|
14
15
|
${helpMsg}`
|
|
15
16
|
|
|
16
|
-
const NOT_GIT_REPO =
|
|
17
|
+
const NOT_GIT_REPO = redBright(`${error} Current directory is not a git directory!`)
|
|
17
18
|
|
|
18
|
-
const FAILED_GET_STAGED_FILES =
|
|
19
|
+
const FAILED_GET_STAGED_FILES = redBright(`${error} Failed to get staged files!`)
|
|
19
20
|
|
|
20
|
-
const incorrectBraces = (before, after) =>
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const incorrectBraces = (before, after) =>
|
|
22
|
+
yellow(
|
|
23
|
+
`${warning} Detected incorrect braces with only single value: \`${before}\`. Reformatted as: \`${after}\`
|
|
23
24
|
`
|
|
25
|
+
)
|
|
24
26
|
|
|
25
27
|
const NO_STAGED_FILES = `${info} No staged files found.`
|
|
26
28
|
|
|
@@ -28,35 +30,35 @@ const NO_TASKS = `${info} No staged files match any configured task.`
|
|
|
28
30
|
|
|
29
31
|
const skippingReset = (hasInitialCommit) => {
|
|
30
32
|
const reason = hasInitialCommit ? '`--no-reset` was used' : 'there’s no initial commit yet'
|
|
31
|
-
return `${warning}
|
|
33
|
+
return yellow(`${warning} Changes won't be reset because ${reason}.\n`)
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
const DEPRECATED_GIT_ADD =
|
|
35
|
-
|
|
36
|
-
)}
|
|
36
|
+
const DEPRECATED_GIT_ADD = yellow(
|
|
37
|
+
`${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.
|
|
37
38
|
`
|
|
39
|
+
)
|
|
38
40
|
|
|
39
|
-
const DEPRECATED_NO_STASH =
|
|
40
|
-
|
|
41
|
-
)}
|
|
41
|
+
const DEPRECATED_NO_STASH = yellow(
|
|
42
|
+
`${warning} The \`--no-stash\` option has been renamed to \`--no-reset\`.
|
|
42
43
|
`
|
|
44
|
+
)
|
|
43
45
|
|
|
44
46
|
const TASK_ERROR = 'Skipped because of errors from tasks.'
|
|
45
47
|
|
|
46
48
|
const SKIPPED_GIT_ERROR = 'Skipped because of previous git error.'
|
|
47
49
|
|
|
48
|
-
const GIT_ERROR = `\n ${error}
|
|
50
|
+
const GIT_ERROR = `\n ${redBright(`${error} lint-staged failed due to a git error.`)}`
|
|
49
51
|
|
|
50
|
-
const invalidOption = (name, value, message) => `${
|
|
52
|
+
const invalidOption = (name, value, message) => `${redBright(`${error} Validation Error:`)}
|
|
51
53
|
|
|
52
|
-
Invalid value for option '${
|
|
54
|
+
Invalid value for option '${bold(name)}': ${bold(value)}
|
|
53
55
|
|
|
54
56
|
${message}
|
|
55
57
|
|
|
56
58
|
See https://github.com/okonet/lint-staged#command-line-flags`
|
|
57
59
|
|
|
58
60
|
const PREVENTED_EMPTY_COMMIT = `
|
|
59
|
-
${warning}
|
|
61
|
+
${yellow(`${warning} lint-staged prevented an empty git commit.
|
|
60
62
|
Use the --allow-empty option to continue, or check your task configuration`)}
|
|
61
63
|
`
|
|
62
64
|
|
package/lib/resolveTaskFn.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { redBright, dim } = require('
|
|
3
|
+
const { redBright, dim } = require('colorette')
|
|
4
4
|
const execa = require('execa')
|
|
5
5
|
const debug = require('debug')('lint-staged:task')
|
|
6
6
|
const { parseArgsStringToArgv } = require('string-argv')
|
|
7
|
-
const { error, info } = require('log-symbols')
|
|
8
7
|
|
|
8
|
+
const { error, info } = require('./figures')
|
|
9
9
|
const { getInitialState } = require('./state')
|
|
10
10
|
const { TaskError } = require('./symbols')
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lint-staged",
|
|
3
|
-
"version": "11.1
|
|
3
|
+
"version": "11.2.0-beta.1",
|
|
4
4
|
"description": "Lint files staged by git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/okonet/lint-staged",
|
|
@@ -27,38 +27,38 @@
|
|
|
27
27
|
"test:watch": "jest --watch"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"commander": "^
|
|
33
|
-
"cosmiconfig": "^7.0.
|
|
34
|
-
"debug": "^4.3.
|
|
30
|
+
"cli-truncate": "2.1.0",
|
|
31
|
+
"colorette": "^1.4.0",
|
|
32
|
+
"commander": "^8.2.0",
|
|
33
|
+
"cosmiconfig": "^7.0.1",
|
|
34
|
+
"debug": "^4.3.2",
|
|
35
35
|
"enquirer": "^2.3.6",
|
|
36
|
-
"execa": "^5.
|
|
37
|
-
"listr2": "^3.
|
|
38
|
-
"log-symbols": "^4.1.0",
|
|
36
|
+
"execa": "^5.1.1",
|
|
37
|
+
"listr2": "^3.12.2",
|
|
39
38
|
"micromatch": "^4.0.4",
|
|
40
39
|
"normalize-path": "^3.0.0",
|
|
41
40
|
"please-upgrade-node": "^3.2.0",
|
|
42
41
|
"string-argv": "0.3.1",
|
|
43
|
-
"stringify-object": "
|
|
42
|
+
"stringify-object": "3.3.0",
|
|
43
|
+
"supports-color": "8.1.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@babel/core": "^7.
|
|
47
|
-
"@babel/
|
|
48
|
-
"@babel/
|
|
49
|
-
"babel-
|
|
50
|
-
"babel-jest": "^
|
|
46
|
+
"@babel/core": "^7.15.5",
|
|
47
|
+
"@babel/eslint-parser": "^7.15.7",
|
|
48
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.15.6",
|
|
49
|
+
"@babel/preset-env": "^7.15.6",
|
|
50
|
+
"babel-jest": "^27.2.4",
|
|
51
51
|
"consolemock": "^1.1.0",
|
|
52
|
-
"eslint": "^7.
|
|
52
|
+
"eslint": "^7.32.0",
|
|
53
53
|
"eslint-config-prettier": "^8.3.0",
|
|
54
|
-
"eslint-plugin-import": "^2.
|
|
54
|
+
"eslint-plugin-import": "^2.24.2",
|
|
55
55
|
"eslint-plugin-node": "^11.1.0",
|
|
56
|
-
"eslint-plugin-prettier": "^
|
|
56
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
57
57
|
"fs-extra": "^10.0.0",
|
|
58
|
-
"husky": "^
|
|
59
|
-
"jest": "^
|
|
58
|
+
"husky": "^7.0.2",
|
|
59
|
+
"jest": "^27.2.4",
|
|
60
60
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
61
|
-
"prettier": "^2.
|
|
61
|
+
"prettier": "^2.4.1"
|
|
62
62
|
},
|
|
63
63
|
"config": {
|
|
64
64
|
"commitizen": {
|