Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
var eslint = require('eslint');
// 'git ls-files -om --exclude-standard' to list all files that were changed then filter out non-JS files
process.chdir(__dirname);
var exitCode = eslint.cli.execute("./");
/*
* Wait for the stdout buffer to drain.
* See https://github.com/eslint/eslint/issues/317
*/
process.on("exit", function() {
process.exit(exitCode);
});
exports.eslint = function(options) {
var eslint = require('eslint').cli, args = [];
function globFiles(patterns) {
var files = [], glob = require("glob");
if (patterns instanceof Array) {
patterns.forEach(function(pattern) {
if (pattern[0] == '!') {
glob.sync(pattern.substr(1)).forEach(function(file) {
var idx = files.indexOf(file);
if (idx != -1) {
files.splice(idx, 1);
}
});
} else {
files = files.concat(glob.sync(pattern));
args.push("-c", options.config);
}
if (options.formatter) {
args.push("-f", options.formatter);
}
if (options.rulesDir) {
args.push("--rulesdir", options.rulesDir);
}
if (options.force) {
return 0;
}
return eslint.cli.execute(args.concat(files));
}
};