Commit 21349c54 authored by Dan Abramov's avatar Dan Abramov Committed by GitHub
Browse files

Tweak error and warning output (#2152)

* Tweak error and warning output

* Add a colon
parent 77087da3
Showing with 23 additions and 10 deletions
+23 -10
...@@ -37,7 +37,7 @@ function formatter(results) { ...@@ -37,7 +37,7 @@ function formatter(results) {
position, position,
messageType, messageType,
message.message.replace(/\.$/, ''), message.message.replace(/\.$/, ''),
chalk.dim(message.ruleId || ''), chalk.cyan(message.ruleId || ''),
]; ];
}); });
......
...@@ -86,9 +86,17 @@ function formatMessage(message, isError) { ...@@ -86,9 +86,17 @@ function formatMessage(message, isError) {
); );
} }
// Prepend filename with an explanation. // Make filename nicer.
lines[0] = chalk.underline(lines[0]) + var slashIndex = Math.max(
(isError ? ' contains errors.' : ' contains warnings.'); lines[0].lastIndexOf('/'),
lines[0].lastIndexOf('\\')
);
var fileName = lines[0].substring(slashIndex + 1);
var path = lines[0].substring(0, slashIndex + 1);
lines[0] = chalk.dim(isError ? 'Found errors in ' : 'Found warnings in ') +
path +
(isError ? chalk.red : chalk.yellow)(fileName) +
chalk.dim(':');
// Reassemble the message. // Reassemble the message.
message = lines.join('\n'); message = lines.join('\n');
......
...@@ -103,15 +103,20 @@ module.exports = function createWebpackCompiler(config, onReadyCallback) { ...@@ -103,15 +103,20 @@ module.exports = function createWebpackCompiler(config, onReadyCallback) {
// Teach some ESLint tricks. // Teach some ESLint tricks.
console.log( console.log(
'Search the ' + chalk.dim(
chalk.dim('keywords') + 'Search for the ' +
' from the right column to learn more.' chalk.cyan('rule keywords') +
' to learn more about each warning.'
)
); );
console.log( console.log(
'To ignore, add ' + chalk.dim(
chalk.yellow('// eslint-disable-next-line') + 'To ignore, add ' +
' to the line before.' chalk.yellow('// eslint-disable-next-line') +
' to the previous line.'
)
); );
console.log();
} }
}); });
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment