diff --git a/README.md b/README.md index e15ea62..e735e11 100644 --- a/README.md +++ b/README.md @@ -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/ diff --git a/package.json b/package.json index 441dc7c..0834183 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "grunt": "~0.4" }, "dependencies": { - "coffeelint": "~1.1" + "coffeelint": "~1.1", + "coffeelint-stylish": "~0.0.1" }, "devDependencies": { "grunt": "~0.4", diff --git a/tasks/coffeelint.js b/tasks/coffeelint.js index bc3c249..976ceb6 100644 --- a/tasks/coffeelint.js +++ b/tasks/coffeelint.js @@ -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() { @@ -27,15 +28,15 @@ 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; } @@ -43,7 +44,6 @@ module.exports = function(grunt) { 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); });