Style: updated failure message to be more formal (#11369)
This commit is contained in:
1 parent
81b8726d0f
commit
284cdf4c3d
6 files changed
+19
-18
No files matched your search
@@ -0,0 +1,7 @@
|
||||
#### Updated failure message to be more informative (#11369 by @webark)
|
||||
|
||||
Updated the "Forgot to run Prettier?" to "Run Prettier to fix."
|
||||
|
||||
This keeps the same spirit of the message, but is less likely to be
|
||||
misinterpreted as it's a more formal message rather than being
|
||||
somewhat familial.
|
||||
+1
-1
@@ -69,7 +69,7 @@ Console output if some of the files require re-formatting:
|
||||
Checking formatting...
|
||||
[warn] src/fileA.js
|
||||
[warn] src/fileB.js
|
||||
[warn] Code style issues found in 2 files. Forgot to run Prettier?
|
||||
[warn] Code style issues found in 2 files. Run Prettier to fix.
|
||||
```
|
||||
|
||||
The command will return exit code `1` in the second case, which is helpful inside the CI pipelines.
|
||||
|
||||
+6
-12
@@ -488,21 +488,15 @@ async function formatFiles(context) {
|
||||
if (context.argv.check) {
|
||||
if (numberOfUnformattedFilesFound === 0) {
|
||||
context.logger.log("All matched files use Prettier code style!");
|
||||
} else if (numberOfUnformattedFilesFound === 1) {
|
||||
context.logger.warn(
|
||||
context.argv.write
|
||||
? "Code style issues fixed in the above file."
|
||||
: "Code style issues found in the above file. Forgot to run Prettier?"
|
||||
);
|
||||
} else {
|
||||
const files =
|
||||
numberOfUnformattedFilesFound === 1
|
||||
? "the above file"
|
||||
: `${numberOfUnformattedFilesFound} files`;
|
||||
context.logger.warn(
|
||||
context.argv.write
|
||||
? "Code style issues found in " +
|
||||
numberOfUnformattedFilesFound +
|
||||
" files."
|
||||
: "Code style issues found in " +
|
||||
numberOfUnformattedFilesFound +
|
||||
" files. Forgot to run Prettier?"
|
||||
? `Code style issues fixed in ${files}.`
|
||||
: `Code style issues found in ${files}. Run Prettier to fix.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
exports[`--checks should print the number of files that need formatting (stderr) 1`] = `
|
||||
"[warn] unformatted.js
|
||||
[warn] unformatted2.js
|
||||
[warn] Code style issues found in 2 files. Forgot to run Prettier?
|
||||
[warn] Code style issues found in 2 files. Run Prettier to fix.
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -16,13 +16,13 @@ exports[`--checks should print the number of files that need formatting (write)
|
||||
|
||||
exports[`--checks works in CI just as in a non-TTY mode (stderr) 1`] = `
|
||||
"[warn] unformatted.js
|
||||
[warn] Code style issues found in the above file. Forgot to run Prettier?
|
||||
[warn] Code style issues found in the above file. Run Prettier to fix.
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`--checks works in CI just as in a non-TTY mode (stderr) 2`] = `
|
||||
"[warn] unformatted.js
|
||||
[warn] Code style issues found in the above file. Forgot to run Prettier?
|
||||
[warn] Code style issues found in the above file. Run Prettier to fix.
|
||||
"
|
||||
`;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ exports[`ignore-unknown alias (stdout) 1`] = `
|
||||
|
||||
exports[`ignore-unknown check (stderr) 1`] = `
|
||||
"[warn] javascript.js
|
||||
[warn] Code style issues found in the above file. Forgot to run Prettier?
|
||||
[warn] Code style issues found in the above file. Run Prettier to fix.
|
||||
"
|
||||
`;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
exports[`--check with unknown path and no parser multiple files (stderr) 1`] = `
|
||||
"[error] No parser could be inferred for file: FOO
|
||||
[warn] foo.js
|
||||
[warn] Code style issues found in the above file. Forgot to run Prettier?
|
||||
[warn] Code style issues found in the above file. Run Prettier to fix.
|
||||
"
|
||||
`;
|
||||
|
||||
|
||||
Reference in new issue
Block a user