-
Notifications
You must be signed in to change notification settings - Fork 0
/
runlint.js
executable file
·33 lines (26 loc) · 904 Bytes
/
runlint.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var util = require('util'),
child_process = require('child_process'),
configFile = './config/config-lint',
ignore = '',
root, i;
process.argv.forEach(function (val, index, array) {
if (index < 2) {
return;
}
if (val === '-c') {
configFile = process.argv[~~index + 1];
}
});
config = require(configFile).config;
function runLint(error, stdout, stderr) {
var files = stdout.trim().replace(/\n/g, ' ');
child_process.exec('node ' + __dirname + '/node_modules/nodelint/nodelint ' + files + ' --config ' + __dirname + '/' + configFile, { cwd: config.root }, function (error, stdout, stderr) {
// util.puts(stdout);
util.puts(stderr);
});
}
i = config.pathIgnore.length;
while (i--) {
ignore += ' ! -path "' + config.pathIgnore[i] + '"';
}
child_process.exec('find . -name "*.js"' + ignore, { cwd: config.root }, runLint);