Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fails when failOnError or failOnWarning enabled #72

Merged
merged 3 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ Will always return warnings, if set to `true`.
- Type: `Boolean`
- Default: `false`

Will cause the module build to fail if there are any errors, if set to `true`.
Will cause the module build to fail and not emitted files if there are any errors, if set to `true`.

#### `failOnWarning`

- Type: `Boolean`
- Default: `false`

Will cause the module build to fail if there are any warnings, if set to `true`.
Will cause the module build to fail and not emitted files if there are any warnings, if set to `true`.

#### `quiet`

Expand Down
7 changes: 3 additions & 4 deletions src/ESLintError.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import WebpackError from 'webpack/lib/WebpackError';

export default class ESLintError extends WebpackError {
class ESLintError extends Error {
/**
* @param {string=} messages
*/
Expand All @@ -11,3 +8,5 @@ export default class ESLintError extends WebpackError {
this.stack = '';
}
}

export default ESLintError;
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ export class ESLintWebpackPlugin {

// Gather Files to lint
compilation.hooks.succeedModule.tap(ESLINT_PLUGIN, processModule);

// await and interpret results
compilation.hooks.afterSeal.tapPromise(ESLINT_PLUGIN, processResults);
compilation.compiler.hooks.emit.tapPromise(ESLINT_PLUGIN, processResults);
ricardogobbosouza marked this conversation as resolved.
Show resolved Hide resolved

async function processResults() {
const { errors, warnings, generateReportAsset } = await report();
Expand Down