gulp-coffeelint
Advanced tools
Comparing version 0.3.4 to 0.4.0
'use strict'; | ||
var createPluginError, defaultReporter, failReporter, reporter, stylish, through2; | ||
var createPluginError, defaultReporter, failOnWarningReporter, failReporter, reporter, stylish, through2; | ||
@@ -12,3 +12,5 @@ through2 = require('through2'); | ||
return through2.obj(function(file, enc, cb) { | ||
if (!file.coffeelint || file.coffeelint.success) { | ||
var c, _ref; | ||
c = file.coffeelint; | ||
if (!c || (c.errorCount === (_ref = c.warningCount) && _ref === 0)) { | ||
this.push(file); | ||
@@ -29,3 +31,3 @@ return cb(); | ||
} | ||
this.emit('error', new Error("CoffeeLint failed for " + file.relative)); | ||
this.emit('error', createPluginError("CoffeeLint failed for " + file.relative)); | ||
return cb(); | ||
@@ -35,2 +37,15 @@ }); | ||
failOnWarningReporter = function() { | ||
return through2.obj(function(file, enc, cb) { | ||
var c, _ref; | ||
c = file.coffeelint; | ||
if (!c || (c.errorCount === (_ref = c.warningCount) && _ref === 0)) { | ||
this.push(file); | ||
return cb(); | ||
} | ||
this.emit('error', createPluginError("CoffeeLint failed for " + file.relative)); | ||
return cb(); | ||
}); | ||
}; | ||
reporter = function(type) { | ||
@@ -46,2 +61,5 @@ if (type == null) { | ||
} | ||
if (type === 'failOnWarning') { | ||
return failOnWarningReporter(); | ||
} | ||
throw createPluginError("" + type + " is not a valid reporter"); | ||
@@ -48,0 +66,0 @@ }; |
@@ -29,3 +29,3 @@ 'use strict'; | ||
return { | ||
success: results.length === 0 ? true : false, | ||
success: errs === 0, | ||
results: results, | ||
@@ -32,0 +32,0 @@ errorCount: errs, |
{ | ||
"name": "gulp-coffeelint", | ||
"version": "0.3.4", | ||
"version": "0.4.0", | ||
"description": "Lint your CoffeeScript using gulp and CoffeeLint", | ||
@@ -30,7 +30,7 @@ "keywords": [ | ||
"dependencies": { | ||
"args-js": "^0.10.5", | ||
"coffeelint": "^1.4.0", | ||
"coffeelint-stylish": "^0.1.0", | ||
"coffeelint-stylish": "^0.1.1", | ||
"gulp-util": "^3.0.0", | ||
"through2": "^0.6.1", | ||
"args-js": "^0.10.1" | ||
"through2": "^0.6.1" | ||
}, | ||
@@ -37,0 +37,0 @@ "devDependencies": { |
@@ -57,3 +57,3 @@ # gulp-coffeelint [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![NPM version][npm-image]][npm-url] | ||
```javascript | ||
file.coffeelint.success = true; // or false | ||
file.coffeelint.success = true; // if no errors were found, false otherwise | ||
file.coffeelint.errorCount = 0; // number of errors returned by `coffeelint` | ||
@@ -74,8 +74,10 @@ file.coffeelint.warningCount = 0; // number of warnings returned by `coffeelint` | ||
Default: `'default'` | ||
Possible Values: `'default'`, `'fail'` | ||
Possible Values: `'default'`, `'fail'`, `'failOnWarning'` | ||
* The `'default'` reporter uses [coffeelint-stylish](https://npmjs.org/package/coffeelint-stylish) to output a pretty report to the console. See [usage example](#usage) above. | ||
* If you would like your stream to `emit` an `error` (e.g. to fail the build on a CI server), when errors or warnings are found, use the `'fail'` reporter. | ||
* If you would like your stream to `emit` an `error` (e.g. to fail the build on a CI server) when errors are found, use the `'fail'` reporter. | ||
* If you want it to throw an error on both warnings and errors, use the `'failOnWarning'` reporter | ||
This example will log errors and warnings using the [coffeelint-stylish](https://npmjs.org/package/coffeelint-stylish) reporter, then fail if `coffeelint` was not a success. | ||
@@ -82,0 +84,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10670
164
114
Updatedargs-js@^0.10.5
Updatedcoffeelint-stylish@^0.1.1