Omit ESLint warnings when there are ESLint errors (#2120)

This commit is contained in:
Dan Abramov
2017-05-11 13:58:07 +01:00
committed by GitHub
parent 8d4604eb3a
commit 69590775ce

View File

@@ -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