Skip to content

Commit

Permalink
Fix message massaging for ESLint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Sep 17, 2018
1 parent 5ba88da commit 74e4527
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/react-dev-utils/formatWebpackMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ function formatMessage(message, isError) {
return message.indexOf('Thread Loader (Worker') === -1;
});

// Strip `ModuleWarning` head off message before parsing (because of ESLint)
// https://github.com/webpack/webpack/blob/c77030573de96b8293c69dd396492f8e2d46561e/lib/ModuleWarning.js
var moduleWarningPrefix = 'Module Warning: ';
if (lines[1].indexOf(moduleWarningPrefix) === 0) {
lines[1] = lines[1].slice(moduleWarningPrefix.length);
} else if (lines[1].match(/Module Warning \(from.*?\):/)) {
lines.splice(1, 1);
}

// Strip `ModuleError` header off message before parsing
// https://github.com/webpack/webpack/blob/c77030573de96b8293c69dd396492f8e2d46561e/lib/ModuleError.js
var moduleErrorPrefix = 'Module Error: ';
Expand Down

0 comments on commit 74e4527

Please sign in to comment.