1 | import { redBright, bold, yellow } from 'colorette'
|
2 | import inspect from 'object-inspect'
|
3 |
|
4 | import { error, info, warning } from './figures.js'
|
5 |
|
6 | export const configurationError = (opt, helpMsg, value) =>
|
7 | `${redBright(`${error} Validation Error:`)}
|
8 |
|
9 | Invalid value for '${bold(opt)}': ${bold(
|
10 | inspect(value, { inlineCharacterLimit: Number.POSITIVE_INFINITY })
|
11 | )}
|
12 |
|
13 | ${helpMsg}`
|
14 |
|
15 | export const NOT_GIT_REPO = redBright(`${error} Current directory is not a git directory!`)
|
16 |
|
17 | export const FAILED_GET_STAGED_FILES = redBright(`${error} Failed to get staged files!`)
|
18 |
|
19 | export const incorrectBraces = (before, after) =>
|
20 | yellow(
|
21 | `${warning} Detected incorrect braces with only single value: \`${before}\`. Reformatted as: \`${after}\`
|
22 | `
|
23 | )
|
24 |
|
25 | export const NO_STAGED_FILES = `${info} No staged files found.`
|
26 |
|
27 | export const NO_TASKS = `${info} No staged files match any configured task.`
|
28 |
|
29 | export const skippingBackup = (hasInitialCommit) => {
|
30 | const reason = hasInitialCommit ? '`--no-stash` was used' : 'there’s no initial commit yet'
|
31 | return yellow(`${warning} Skipping backup because ${reason}.\n`)
|
32 | }
|
33 |
|
34 | export const DEPRECATED_GIT_ADD = yellow(
|
35 | `${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.
|
36 | `
|
37 | )
|
38 |
|
39 | export const TASK_ERROR = 'Skipped because of errors from tasks.'
|
40 |
|
41 | export const SKIPPED_GIT_ERROR = 'Skipped because of previous git error.'
|
42 |
|
43 | export const GIT_ERROR = `\n ${redBright(`${error} lint-staged failed due to a git error.`)}`
|
44 |
|
45 | export const invalidOption = (name, value, message) => `${redBright(`${error} Validation Error:`)}
|
46 |
|
47 | Invalid value for option '${bold(name)}': ${bold(value)}
|
48 |
|
49 | ${message}
|
50 |
|
51 | See https://github.com/okonet/lint-staged#command-line-flags`
|
52 |
|
53 | export const PREVENTED_EMPTY_COMMIT = `
|
54 | ${yellow(`${warning} lint-staged prevented an empty git commit.
|
55 | Use the --allow-empty option to continue, or check your task configuration`)}
|
56 | `
|
57 |
|
58 | export const RESTORE_STASH_EXAMPLE = ` Any lost modifications can be restored from a git stash:
|
59 |
|
60 | > git stash list
|
61 | stash@{0}: automatic lint-staged backup
|
62 | > git stash apply --index stash@{0}
|
63 | `
|
64 |
|
65 | export const CONFIG_STDIN_ERROR = 'Error: Could not read config from stdin.'
|