Skip to content

Commit

Permalink
Omit ESLint warnings when there are ESLint errors (facebook#2120)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored and romaindso committed Jul 10, 2017
1 parent 995fac9 commit f28df27
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 f28df27

Please sign in to comment.