From 21349c542bcef47205acb4f3caaf0dca07ed8097 Mon Sep 17 00:00:00 2001
From: Dan Abramov <dan.abramov@gmail.com>
Date: Mon, 15 May 2017 01:07:59 +0100
Subject: [PATCH] Tweak error and warning output (#2152)

* Tweak error and warning output

* Add a colon
---
 packages/react-dev-utils/eslintFormatter.js     |  2 +-
 .../react-dev-utils/formatWebpackMessages.js    | 14 +++++++++++---
 .../scripts/utils/createWebpackCompiler.js      | 17 +++++++++++------
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/packages/react-dev-utils/eslintFormatter.js b/packages/react-dev-utils/eslintFormatter.js
index b6ba56795..5077957a3 100644
--- a/packages/react-dev-utils/eslintFormatter.js
+++ b/packages/react-dev-utils/eslintFormatter.js
@@ -37,7 +37,7 @@ function formatter(results) {
         position,
         messageType,
         message.message.replace(/\.$/, ''),
-        chalk.dim(message.ruleId || ''),
+        chalk.cyan(message.ruleId || ''),
       ];
     });
 
diff --git a/packages/react-dev-utils/formatWebpackMessages.js b/packages/react-dev-utils/formatWebpackMessages.js
index f1262aad5..c48508055 100644
--- a/packages/react-dev-utils/formatWebpackMessages.js
+++ b/packages/react-dev-utils/formatWebpackMessages.js
@@ -86,9 +86,17 @@ function formatMessage(message, isError) {
     );
   }
 
-  // Prepend filename with an explanation.
-  lines[0] = chalk.underline(lines[0]) +
-    (isError ? ' contains errors.' : ' contains warnings.');
+  // Make filename nicer.
+  var slashIndex = Math.max(
+    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.
   message = lines.join('\n');
diff --git a/packages/react-scripts/scripts/utils/createWebpackCompiler.js b/packages/react-scripts/scripts/utils/createWebpackCompiler.js
index 260b36c97..8accbc0af 100644
--- a/packages/react-scripts/scripts/utils/createWebpackCompiler.js
+++ b/packages/react-scripts/scripts/utils/createWebpackCompiler.js
@@ -103,15 +103,20 @@ module.exports = function createWebpackCompiler(config, onReadyCallback) {
 
       // Teach some ESLint tricks.
       console.log(
-        'Search the ' +
-          chalk.dim('keywords') +
-          ' from the right column to learn more.'
+        chalk.dim(
+          'Search for the ' +
+            chalk.cyan('rule keywords') +
+            ' to learn more about each warning.'
+        )
       );
       console.log(
-        'To ignore, add ' +
-          chalk.yellow('// eslint-disable-next-line') +
-          ' to the line before.'
+        chalk.dim(
+          'To ignore, add ' +
+            chalk.yellow('// eslint-disable-next-line') +
+            ' to the previous line.'
+        )
       );
+      console.log();
     }
   });
 
-- 
GitLab