Skip to content

Commit

Permalink
Merge branch 'feature/coffeelint-stylish' of git://github.com/janraas…
Browse files Browse the repository at this point in the history
…ch/grunt-coffeelint into janraasch-feature/coffeelint-stylish

Conflicts:
	package.json
  • Loading branch information
Adam Biggs committed Mar 19, 2014
2 parents 38fe959 + 22588f1 commit 239807a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ grunt.initConfig({
});
````

### Loading external config

````javascript
grunt.initConfig({
...
coffeelint: {
options: {
configFile: 'coffeelint.json'
}
},
...
});
````
Task `options` take precedence over `configFile` options.

For available options see [coffeelint homepage].

[CoffeeLint]: http://www.coffeelint.org/
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"grunt": "~0.4"
},
"dependencies": {
"coffeelint": "~1.1"
"coffeelint": "~1.1",
"coffeelint-stylish": "~0.0.1"
},
"devDependencies": {
"grunt": "~0.4",
Expand Down
6 changes: 3 additions & 3 deletions tasks/coffeelint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = function(grunt) {
var coffeelint = require('coffeelint');
var reporter = require('coffeelint-stylish').reporter;

grunt.registerMultiTask('coffeelint', 'Validate files with CoffeeLint', function() {

Expand Down Expand Up @@ -27,23 +28,22 @@ module.exports = function(grunt) {
return grunt.verbose.ok();
}

reporter(file, errors);

errors.forEach(function(error) {
var status, message;

if (error.level === 'error') {
errorCount += 1;
status = "[error]".red;
} else if (error.level === 'warn') {
warnCount += 1;
status = "[warn]".yellow;
} else {
return;
}

message = file + ':' + error.lineNumber + ' ' + error.message +
' (' + error.rule + ')';

grunt.log.writeln(status + ' ' + message);
grunt.event.emit('coffeelint:' + error.level, error.level, message);
grunt.event.emit('coffeelint:any', error.level, message);
});
Expand Down

0 comments on commit 239807a

Please sign in to comment.