Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "fez-jshint", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"main": "src/main.js", | ||
"dependencies": { | ||
"bluebird": "~0.11.6-0", | ||
"bluebird": "~1.0.3", | ||
"jshint": "~2.4.1", | ||
@@ -8,0 +8,0 @@ "ansi": "~0.2.1" |
var Promise = require("bluebird"), | ||
jshint = require("jshint").JSHINT, | ||
JSHINT = require("jshint").JSHINT, | ||
ansi = require("ansi"), | ||
@@ -7,23 +7,32 @@ cursor = ansi(process.stdout); | ||
module.exports = function(options) { | ||
return function(inputs) { | ||
return function jshint(inputs) { | ||
return Promise.all(inputs.map(function(i) { return i.asBuffer(); })).then(function(buffers) { | ||
var failed = false; | ||
var failed = 0, | ||
successful = 0; | ||
if(buffers.length > 1) console.log("Linting..."); | ||
buffers.map(function(b) { return b.toString(); }).forEach(function(source, i) { | ||
process.stdout.write("Linting " + inputs[i].getFilename() + "......"); | ||
if(!jshint(source, options)) { | ||
failed = true; | ||
if(buffers.length === 1) process.stdout.write("Linting " + inputs[i].getFilename() + "...... "); | ||
if(!JSHINT(source, options)) { | ||
failed += 1; | ||
cursor.red(); | ||
console.log("FAIL"); | ||
cursor.reset(); | ||
jshint.errors.forEach(function(error) { | ||
console.log(" " + error.reason + " (" + error.line + ":" + error.character + ")" ); | ||
JSHINT.errors.forEach(function(error) { | ||
if(error) | ||
console.log(" " + error.reason + " (" + error.line + ":" + error.character + ")" ); | ||
}); | ||
} else { | ||
cursor.green(); | ||
console.log("OK"); | ||
cursor.reset(); | ||
if(buffers.length === 1) { | ||
cursor.green(); | ||
console.log("OK"); | ||
cursor.reset(); | ||
} | ||
successful += 1; | ||
} | ||
}); | ||
if(buffers.length > 1) console.log(successful + " passed. " + failed + " failed."); | ||
if(failed) { | ||
if(failed > 0) { | ||
throw new Error(); | ||
@@ -30,0 +39,0 @@ } |
1490
37
+ Addedbluebird@1.0.8(transitive)
- Removedbluebird@0.11.6(transitive)
Updatedbluebird@~1.0.3