Comparing version 0.6.1 to 0.6.2
@@ -96,2 +96,3 @@ var fs = require('fs'), | ||
targets = options.node, | ||
extraExtensionList = options["--extra-ext"], | ||
ignoreFile, ignores; | ||
@@ -115,2 +116,4 @@ | ||
extraExtensionList = typeof extraExtensionList === "string" ? extraExtensionList : ""; | ||
if (options["--version"]) { | ||
@@ -158,4 +161,4 @@ _version(); | ||
_print(hint.hint(targets, config, reporter, ignores)); | ||
_print(hint.hint(targets, config, reporter, ignores, extraExtensionList)); | ||
} | ||
}; |
@@ -73,12 +73,11 @@ var fs = require('fs'), | ||
function _collect(filePath, files, ignore) { | ||
function _collect(filePath, files, ignore, regExtension) { | ||
if (ignore && _shouldIgnore(filePath, ignore)) { | ||
return; | ||
} | ||
if (fs.statSync(filePath).isDirectory()) { | ||
fs.readdirSync(filePath).forEach(function (item) { | ||
_collect(path.join(filePath, item), files, ignore); | ||
_collect(path.join(filePath, item), files, ignore, regExtension); | ||
}); | ||
} else if (filePath.match(/\.js$/)) { | ||
} else if (filePath.match(regExtension)) { | ||
files.push(filePath); | ||
@@ -89,9 +88,13 @@ } | ||
module.exports = { | ||
hint: function (targets, config, reporter, ignore) { | ||
hint: function (targets, config, reporter, ignore, extraExtensionList) { | ||
var files = [], | ||
results = [], | ||
data = []; | ||
data = [], | ||
regExtension; | ||
extraExtensionList = extraExtensionList || ""; | ||
regExtension = new RegExp('\\.(js' + (extraExtensionList === "" ? "" : "|" + extraExtensionList.replace(/,/g, "|").replace(/[\. ]/g, "")) + ")$"); | ||
targets.forEach(function (target) { | ||
_collect(target, files, ignore); | ||
_collect(target, files, ignore, regExtension); | ||
}); | ||
@@ -98,0 +101,0 @@ |
{ | ||
"name": "jshint", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "A CLI for JSHint", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/jshint/node-jshint", |
@@ -63,2 +63,8 @@ # node-jshint | ||
## File Extensions | ||
Default extension for files is ".js". If you want to use JSHint with other file extensions (.json), you need to pass this extra extension as an option : | ||
--extra-ext .json | ||
## Ignoring Files and Directories | ||
@@ -65,0 +71,0 @@ |
Sorry, the diff of this file is not supported yet
176814
4320
87