Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit b02da2b

Browse files
committed
Cleanup
1 parent e9fd1d1 commit b02da2b

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/friendly-errors-plugin.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ const defaultFormatters = [
2121

2222
class FriendlyErrorsWebpackPlugin {
2323

24-
constructor (options) {
25-
options = options || {};
26-
this.compilationSuccessInfo = options.compilationSuccessInfo || {};
24+
constructor(options) {
25+
options = options || {};
26+
this.compilationSuccessInfo = options.compilationSuccessInfo || {};
2727
this.onErrors = options.onErrors;
2828
this.shouldClearConsole = options.clearConsole || true;
2929
this.formatters = concat(defaultFormatters, options.additionalFormatters);
3030
this.transformers = concat(defaultTransformers, options.additionalTransformers);
3131
}
3232

33-
apply (compiler) {
33+
apply(compiler) {
3434

3535
compiler.plugin('done', stats => {
3636
this.clearConsole();
@@ -79,25 +79,26 @@ class FriendlyErrorsWebpackPlugin {
7979
}
8080

8181
displayErrors(errors, severity) {
82-
8382
const processedErrors = transformErrors(errors, this.transformers);
8483

8584
const topErrors = getMaxSeverityErrors(processedErrors);
8685
const nbErrors = topErrors.length;
8786

88-
const subtitle = severity === 'error' ? `Failed to compile with ${nbErrors} ${severity}s` : `Compiled with ${nbErrors} ${severity}s`;
87+
const subtitle = severity === 'error' ?
88+
`Failed to compile with ${nbErrors} ${severity}s` :
89+
`Compiled with ${nbErrors} ${severity}s`;
8990
output.title(severity, severity.toUpperCase(), subtitle);
9091

9192
if (this.onErrors) {
9293
this.onErrors(severity, topErrors);
9394
}
9495

9596
formatErrors(topErrors, this.formatters, severity)
96-
.forEach((chunk) => output.log(chunk));
97+
.forEach(chunk => output.log(chunk));
9798
}
9899
}
99100

100-
function getMaxSeverityErrors (errors) {
101+
function getMaxSeverityErrors(errors) {
101102
const maxSeverity = getMaxInt(errors, 'severity');
102103
return errors.filter(e => e.severity === maxSeverity);
103104
}
@@ -109,9 +110,3 @@ function getMaxInt(collection, propertyName) {
109110
}
110111

111112
module.exports = FriendlyErrorsWebpackPlugin;
112-
113-
function displayCompilationMessage (message, color) {
114-
output.log();
115-
output.log(chalk[color](message));
116-
output.log();
117-
}

src/utils/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
/**
24
* Concat and flattens non-null values.
35
* Ex: concat(1, undefined, 2, [3, 4]) = [1, 2, 3, 4]

0 commit comments

Comments
 (0)