Skip to content

Commit 72c52f0

Browse files
committed
fix(fail-on-error): show eslint errors when failOnError is disabled
1 parent 4930a6f commit 72c52f0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ class ESLintWebpackPlugin {
145145
if (errors && options.failOnError) {
146146
// @ts-ignore
147147
compilation.errors.push(errors);
148+
} else if (errors && !options.failOnError) {
149+
// @ts-ignore
150+
compilation.warnings.push(errors);
148151
}
149152

150153
if (generateReportAsset) {

test/fail-on-error.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ describe('fail on error', () => {
1111
});
1212
});
1313

14+
it('should emit warnings when disabled', (done) => {
15+
const compiler = pack('error', { failOnError: false });
16+
17+
compiler.run((err, stats) => {
18+
expect(err).toBeNull();
19+
expect(stats.hasErrors()).toBe(false);
20+
expect(stats.hasWarnings()).toBe(true);
21+
done();
22+
});
23+
});
24+
1425
it('should correctly indentifies a success', (done) => {
1526
const compiler = pack('good', { failOnError: true });
1627

0 commit comments

Comments
 (0)