diff --git a/packages/react-dev-utils/formatWebpackMessages.js b/packages/react-dev-utils/formatWebpackMessages.js index 84d22e526d1..075342f2ddd 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