This simple 'transform' enables to integrate your coffeelint with browserify. This makes for a simpler watch, and only lints what you acutally use. Especially good with watchify.
npm install browserify-coffeelint --save-dev
Just use as normal transform. Transform options are passed through as coffeelint options.
browserify -t browserify-coffeelint -t coffeeify main.coffee -o bundle.js
It automatically looks for coffeelint.json
in the default places (since 1.1.0). To generate such a file, execute:
coffeelint --makeconfig > coffeelint.json
It is also possible to set (/overide) these settings using browserify options.
Example using package.json
:
"browserify": {
"transform": [
[
"browserify-coffeelint",
{
"arrow_spacing": {
"name": "arrow_spacing",
"level": "error"
}
}
]
]
}
Example using programmatic API:
browserify = require 'browserify'
browserify_coffeelint = require 'browserify-coffeelint'
coffeeify = require 'coffeeify'
options =
arrow_spacing:
name: 'arrow_spacing'
level: 'error'
browserify()
.add 'main.coffee'
.transform browserify_coffeelint, options
.transform coffeeify
.bundle()
.pipe process.stdout
Thanks to @nmccready, it is also possible to fail on error or warning. Just pass the options doEmitErrors
or doEmitWarnings
.