mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-01-13 09:00:30 +08:00
Omit ESLint warnings when there are ESLint errors (#2120)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user