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

Ignore paths from .gitignore #147

Merged
merged 17 commits into from
Oct 11, 2016
Merged
5 changes: 5 additions & 0 deletions options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const deepAssign = require('deep-assign');
const multimatch = require('multimatch');
const resolveFrom = require('resolve-from');
const pathExists = require('path-exists');
const parseGitignore = require('parse-gitignore');

const DEFAULT_IGNORE = [
'**/node_modules/**',
Expand Down Expand Up @@ -195,6 +196,10 @@ function preprocess(opts) {
opts = mergeWithPkgConf(opts);
opts = normalizeOpts(opts);
opts.ignores = DEFAULT_IGNORE.concat(opts.ignores || []);

const gitignore = parseGitignore('.gitignore');
opts.ignores = opts.ignores.concat(gitignore || []);
Copy link
Contributor

@kevva kevva Oct 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a function instead, getIgnores or something, that we then can export like we've done with the other ones.

opts.ignores = getIgnores(opts.ignores);


return opts;
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
"resolve-cwd": "^1.0.0",
"resolve-from": "^2.0.0",
"update-notifier": "^1.0.0",
"xo-init": "^0.3.0"
"xo-init": "^0.3.0",
"parse-gitignore": "^0.3.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be listed alphabetically.

},
"devDependencies": {
"ava": "*",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Additional global variables your code accesses during execution.

Type: `Array`

Some [paths](https://github.com/sindresorhus/xo/blob/master/options-manager.js) are ignored by default. Additional ignores can be added here.
Some [paths](https://github.com/sindresorhus/xo/blob/master/options-manager.js) are ignored by default, including paths in .gitignore. Additional ignores can be added here.

### space

Expand Down