Skip to content

Commit

Permalink
Omit ESLint warnings when there are ESLint errors (#2120)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored May 11, 2017
1 parent 8d4604e commit 6959077
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/react-dev-utils/formatWebpackMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6959077

Please sign in to comment.