gulp-coffeelint
Advanced tools
Comparing version 0.2.2 to 0.3.0
58
index.js
'use strict'; | ||
var Args, PluginError, coffeelint, coffeelintPlugin, configfinder, createPluginError, formatOutput, fs, isLiterate, params, stylish, through2; | ||
var Args, coffeelint, coffeelintPlugin, configfinder, createPluginError, formatOutput, fs, isLiterate, params, reporter, through2, _ref; | ||
@@ -8,3 +8,3 @@ fs = require('fs'); | ||
Args = require('args-js/Args'); | ||
Args = require('args-js'); | ||
@@ -15,38 +15,6 @@ coffeelint = require('coffeelint'); | ||
stylish = require('coffeelint-stylish'); | ||
reporter = require('./lib/reporter'); | ||
PluginError = (require('gulp-util')).PluginError; | ||
_ref = require('./lib/utils'), isLiterate = _ref.isLiterate, createPluginError = _ref.createPluginError, formatOutput = _ref.formatOutput; | ||
isLiterate = function(file) { | ||
return /\.(litcoffee|coffee\.md)$/.test(file); | ||
}; | ||
createPluginError = function(message) { | ||
return new PluginError('gulp-coffeelint', message); | ||
}; | ||
formatOutput = function(results, opt, literate) { | ||
var errs, warns; | ||
errs = 0; | ||
warns = 0; | ||
results.map(function(result) { | ||
var level; | ||
level = result.level; | ||
if (level === 'error') { | ||
errs++; | ||
} | ||
if (level === 'warn') { | ||
return warns++; | ||
} | ||
}); | ||
return { | ||
success: results.length === 0 ? true : false, | ||
results: results, | ||
errorCount: errs, | ||
warningCount: warns, | ||
opt: opt, | ||
literate: literate | ||
}; | ||
}; | ||
params = [ | ||
@@ -66,5 +34,5 @@ { | ||
coffeelintPlugin = function() { | ||
var e, literate, opt, optFile, rules, _ref; | ||
var e, literate, opt, optFile, rules, _ref1; | ||
try { | ||
_ref = Args(params, arguments), opt = _ref.opt, optFile = _ref.optFile, literate = _ref.literate, rules = _ref.rules; | ||
_ref1 = Args(params, arguments), opt = _ref1.opt, optFile = _ref1.optFile, literate = _ref1.literate, rules = _ref1.rules; | ||
} catch (_error) { | ||
@@ -120,16 +88,4 @@ e = _error; | ||
coffeelintPlugin.reporter = function() { | ||
var reporter; | ||
reporter = stylish.reporter; | ||
return through2.obj(function(file, enc, cb) { | ||
if (!file.coffeelint || file.coffeelint.success) { | ||
this.push(file); | ||
return cb(); | ||
} | ||
reporter(file.relative, file.coffeelint.results); | ||
this.push(file); | ||
return cb(); | ||
}); | ||
}; | ||
coffeelintPlugin.reporter = reporter; | ||
module.exports = coffeelintPlugin; |
{ | ||
"name": "gulp-coffeelint", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Lint your CoffeeScript using gulp and CoffeeLint", | ||
@@ -21,7 +21,8 @@ "keywords": [ | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"lib/*.js" | ||
], | ||
"scripts": { | ||
"prepublish": "gulp coffee --require \"coffee-script/register\"", | ||
"test": "coffeelint gulpfile.coffee index.coffee test -f ./coffeelint.json && istanbul test _mocha --report lcovonly -- ./test/*.coffee --require coffee-script/register --reporter spec", | ||
"test": "coffeelint gulpfile.coffee index.coffee lib test -f ./coffeelint.json && istanbul test _mocha --report lcovonly -- ./test/*.coffee --require coffee-script/register --reporter spec", | ||
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" | ||
@@ -28,0 +29,0 @@ }, |
@@ -23,3 +23,3 @@ # gulp-coffeelint [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![NPM version][npm-image]][npm-url] | ||
.pipe(coffeelint()) | ||
.pipe(coffeelint.reporter()) // Using `coffeelint-stylish` reporter https://npmjs.org/package/coffeelint-stylish | ||
.pipe(coffeelint.reporter()) | ||
}); | ||
@@ -66,2 +66,14 @@ ``` | ||
## Reporters | ||
### `coffeelint.reporter(name)` | ||
Assuming you would like to make use of those pretty results we have after piping through `coffeelint()` there are some bundled reporters at your service. | ||
### name | ||
Type: `String` | ||
Default: `'default'` | ||
Possible Values: `'default'`, `'fail'` | ||
The `'default'` reporter uses [coffeelint-stylish](https://npmjs.org/package/coffeelint-stylish) to output a pretty report, while the `'fail'` reporter causes the stream to emit an `error`, if `file.coffeelint.success === false`. | ||
## Contributing | ||
@@ -68,0 +80,0 @@ In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [gulp][gulp] and [npm-test](https://npmjs.org/doc/test.html). Plus, make sure to adhere to these [commit message conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.uyo6cb12dt6w). |
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
9542
5
147
101