Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move messages to separate file
- Loading branch information
Showing
3 changed files
with
63 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict' | ||
|
||
const chalk = require('chalk') | ||
const symbols = require('log-symbols') | ||
|
||
const NO_STAGED_FILES = `${symbols.info} No staged files found.` | ||
|
||
const skippingBackup = (hasInitialCommit) => { | ||
const reason = hasInitialCommit ? '`--no-stash` was used' : 'there’s no initial commit yet' | ||
return `${symbols.warning} ${chalk.yellow(`Skipping backup because ${reason}.\n`)}` | ||
} | ||
|
||
const DEPRECATED_GIT_ADD = `${symbols.warning} ${chalk.yellow( | ||
`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.` | ||
)} | ||
` | ||
|
||
const TASK_ERROR = 'Skipped because of errors from tasks.' | ||
|
||
const GIT_ERROR = 'Skipped because of previous git error.' | ||
|
||
const PREVENTED_EMPTY_COMMIT = ` | ||
${symbols.warning} ${chalk.yellow(`lint-staged prevented an empty git commit. | ||
Use the --allow-empty option to continue, or check your task configuration`)} | ||
` | ||
|
||
const RESTORE_STASH_EXAMPLE = ` Any lost modifications can be restored from a git stash: | ||
> git stash list | ||
stash@{0}: automatic lint-staged backup | ||
> git stash apply --index stash@{0} | ||
` | ||
|
||
module.exports = { | ||
NO_STAGED_FILES, | ||
skippingBackup, | ||
DEPRECATED_GIT_ADD, | ||
TASK_ERROR, | ||
GIT_ERROR, | ||
PREVENTED_EMPTY_COMMIT, | ||
RESTORE_STASH_EXAMPLE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters