Lint your CoffeeScript with CoffeeLint.
Install npm package, next to your project's Gruntfile.js file:
npm install grunt-coffeelint
Add this line to your project's Gruntfile.js:
grunt.loadNpmTasks('grunt-coffeelint');
A few additional options are supported:
Type: Boolean
Default value: false
Set force to true to report CoffeeLint errors but not fail the task.
coffeelint is a multitask, so you can use it similary to lint, watch etc...
grunt.initConfig({
...
coffeelint: {
app: ['app/*.coffee', 'scripts/*.coffee']
},
...
});grunt.initConfig({
...
coffeelint: {
app: ['app/*.coffee', 'scripts/*.coffee'],
tests: {
files: {
src: ['tests/*.coffee']
},
options: {
'no_trailing_whitespace': {
'level': 'error'
}
}
}
},
...
});grunt.initConfig({
...
coffeelint: {
options: {
'no_trailing_whitespace': {
'level': 'error'
}
}
},
...
});grunt.initConfig({
...
coffeelint: {
options: {
configFile: 'coffeelint.json'
}
},
...
});Task options take precedence over configFile options.
For available options see coffeelint homepage.