Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for specifying directory in ignores #69

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
var path = require('path');
var eslint = require('eslint');
var globby = require('globby');
var dirGlob = require('dir-glob');
var optionsManager = require('./options-manager');

exports.lintText = function (str, opts) {
Expand All @@ -20,25 +21,27 @@ exports.lintFiles = function (patterns, opts) {
patterns = '**/*.{js,jsx}';
}

return globby(patterns, {ignore: opts.ignores}).then(function (paths) {
// when users are silly and don't specify an extension in the glob pattern
paths = paths.filter(function (x) {
var ext = path.extname(x);
return ext === '.js' || ext === '.jsx';
});
return dirGlob(opts.ignores).then(function (ignores) {
return globby(patterns, {ignore: ignores}).then(function (paths) {
// when users are silly and don't specify an extension in the glob pattern
paths = paths.filter(function (x) {
var ext = path.extname(x);
return ext === '.js' || ext === '.jsx';
});

if (!(opts.overrides && opts.overrides.length)) {
return runEslint(paths, opts);
}
if (!(opts.overrides && opts.overrides.length)) {
return runEslint(paths, opts);
}

var overrides = opts.overrides;
delete opts.overrides;
var overrides = opts.overrides;
delete opts.overrides;

var grouped = optionsManager.groupConfigs(paths, opts, overrides);
var grouped = optionsManager.groupConfigs(paths, opts, overrides);

return mergeReports(grouped.map(function (data) {
return runEslint(data.paths, data.opts);
}));
return mergeReports(grouped.map(function (data) {
return runEslint(data.paths, data.opts);
}));
});
});
};

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"babel-eslint": "^4.1.1",
"debug": "^2.2.0",
"deep-assign": "^1.0.0",
"dir-glob": "^1.0.1",
"eslint": "^1.10.3",
"eslint-config-xo": "^0.9.0",
"eslint-plugin-babel": "^3.0.0",
Expand Down