From 11549178aac4397f180b0a1df6f74a1db45f413d Mon Sep 17 00:00:00 2001 From: iudelsmann Date: Sat, 9 Jun 2018 03:09:52 -0300 Subject: [PATCH] Add `failOnError` option (#154) --- readme.md | 7 +++++++ tasks/eslint.js | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 0d179ad8..e87cafae 100644 --- a/readme.md +++ b/readme.md @@ -93,6 +93,13 @@ Default: `-1` *(means no limit)* Number of warnings to trigger non-zero exit code. +### failOnError + +Type: `boolean`
+Default: `true` + +Fail the build if ESLint found any errors. + ## License diff --git a/tasks/eslint.js b/tasks/eslint.js index 70ac5b74..089c6b74 100644 --- a/tasks/eslint.js +++ b/tasks/eslint.js @@ -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) { @@ -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; }); };