From 69590775cef2bf337817dfdd055c97b6f5dc3da1 Mon Sep 17 00:00:00 2001
From: Dan Abramov <dan.abramov@gmail.com>
Date: Thu, 11 May 2017 13:58:07 +0100
Subject: [PATCH] Omit ESLint warnings when there are ESLint errors (#2120)

---
 packages/react-dev-utils/formatWebpackMessages.js | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/packages/react-dev-utils/formatWebpackMessages.js b/packages/react-dev-utils/formatWebpackMessages.js
index 84d22e526..075342f2d 100644
--- a/packages/react-dev-utils/formatWebpackMessages.js
+++ b/packages/react-dev-utils/formatWebpackMessages.js
@@ -84,7 +84,7 @@ function formatMessage(message, isError) {
       "$1 '$4' does not contain an export named '$3'."
     );
   }
-  
+
   // TODO: Ideally we should write a custom ESLint formatter instead.
 
   // If the second line already includes a filename, and it's a warning,
@@ -122,6 +122,18 @@ function formatMessage(message, isError) {
     return true;
   });
 
+  var ESLINT_WARNING_LABEL = String.fromCharCode(27) +
+    '[33m' +
+    'warning' +
+    String.fromCharCode(27) +
+    '[39m';
+  // If there were errors, omit any warnings.
+  if (isError) {
+    lines = lines.filter(function(line) {
+      return line.indexOf(ESLINT_WARNING_LABEL) === -1;
+    });
+  }
+
   // Prepend filename with an explanation.
   lines[0] =
     // Underline
-- 
GitLab