Skip to content
Browse files

added --exclude option to exclude a path and bumped version number to…

… 0.2.0
  • Loading branch information...
1 parent 3c14b12 commit 88c61dfe4e90da385151455fcdee045de9662972 @davybrion committed Aug 21, 2011
Showing with 18 additions and 5 deletions.
  1. +2 −0 CHANGELOG
  2. +10 −2 bin/jslint-all.js
  3. +5 −2 lib/runner.js
  4. +1 −1 package.json
View
2 CHANGELOG
@@ -0,0 +1,2 @@
+0.2.0
+ - added an --exclude parameter so you can provide a path to exclude from the jslint check
View
12 bin/jslint-all.js
@@ -6,6 +6,9 @@ var runner = require('../lib/runner.js'),
path = require('path');
var optionSet = {
+ // node-jslint-all options
+ 'exclude' : String, // path to exclude from the jslint check
+ // JSLint options
'adsafe' : Boolean, // true, if ADsafe rules should be enforced
'bitwise' : Boolean, // true, if bitwise operators should not be allowed
'browser' : Boolean, // true, if the standard browser globals should be predefined
@@ -45,13 +48,18 @@ if (!options.argv.remain.length) {
console.warn('No path specified!');
console.warn("Usage: " + process.argv[1] + " [--" + Object.keys(optionSet).join("] [--") + "] <path>");
process.exit(1);
-};
+}
var pathToCheck = path.resolve(path.normalize(options.argv.remain[0]));
+
+if (options.exclude) {
+ options.exclude = path.resolve(path.normalize(options.exclude));
+}
+
delete options.argv;
runner.check(pathToCheck, options, function(err, results) {
if (results.length > 0) {
consoleReporter.report(results);
process.exit(1);
- };
+ }
});
View
7 lib/runner.js
@@ -4,11 +4,14 @@ var exec = require('child_process').exec,
fileCount = 0,
results = [];
-function getJsFilesRecursively(startPath, callback) {
+function getJsFilesRecursively(startPath, exclude, callback) {
exec('find ' + startPath, function(err, stdout) {
var jsFiles = [];
stdout.split('\n').forEach(function(f) {
if (!/node_modules\//.test(f) && /.js$/.test(f)) {
+ if (exclude && f.indexOf(exclude) > -1) {
+ return;
+ }
jsFiles.push(f);
}
});
@@ -44,7 +47,7 @@ module.exports = {
}
};
- getJsFilesRecursively(path, function(err, jsFiles) {
+ getJsFilesRecursively(path, options.exclude, function(err, jsFiles) {
fileCount = jsFiles.length;
jsFiles.forEach(function(f) {
lint(f, options, postLint);
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "node-jslint-all",
"description": "A JSLint based JavaScript code quality tool",
- "version": "0.1.0",
+ "version": "0.2.0",
"author" : "Davy Brion <ralinx@davybrion.com>",
"homepage": "https://github.com/davybrion/node-jslint-all",
"repository": {

0 comments on commit 88c61df

Please sign in to comment.
Something went wrong with that request. Please try again.