Skip to content

Commit

Permalink
Add failOnError option (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
iudelsmann authored and sindresorhus committed Jun 9, 2018
1 parent 1d97ae7 commit 1154917
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ Default: `-1` *(means no limit)*

Number of warnings to trigger non-zero exit code.

### failOnError

Type: `boolean`<br>
Default: `true`

Fail the build if ESLint found any errors.


## License

Expand Down
5 changes: 3 additions & 2 deletions tasks/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = grunt => {
const opts = this.options({
outputFile: false,
quiet: false,
maxWarnings: -1
maxWarnings: -1,
failOnError: true,
});

if (this.filesSrc.length === 0) {
Expand Down Expand Up @@ -56,6 +57,6 @@ module.exports = grunt => {
grunt.warn(`ESLint found too many warnings (maximum: ${opts.maxWarnings})`);
}

return report.errorCount === 0;
return opts.failOnError ? report.errorCount === 0 : 0;
});
};

0 comments on commit 1154917

Please sign in to comment.