Skip to content

Commit

Permalink
cleanup #147
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 11, 2016
1 parent 85c6094 commit 519ad1b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
19 changes: 12 additions & 7 deletions options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,20 @@ function groupConfigs(paths, baseOptions, overrides) {

function getIgnores(opts) {
opts.ignores = DEFAULT_IGNORE.concat(opts.ignores || []);
const gitignores = globby.sync('**/.gitignore', {ignore: opts.ignores, cwd: opts.cwd || process.cwd()});

const gitignores = globby.sync('**/.gitignore', {
ignore: opts.ignores,
cwd: opts.cwd || process.cwd()
});

const ignores = gitignores
.map(pathToGitignore => {
const patterns = parseGitignore(pathToGitignore);
const base = path.dirname(pathToGitignore);
.map(pathToGitignore => {
const patterns = parseGitignore(pathToGitignore);
const base = path.dirname(pathToGitignore);

return patterns.map(file => path.join(base, file));
})
.reduce((a, b) => a.concat(b), []);
return patterns.map(file => path.join(base, file));
})
.reduce((a, b) => a.concat(b), []);

opts.ignores = opts.ignores.concat(ignores);

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,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, including paths in .gitignore. 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
2 changes: 1 addition & 1 deletion test/bar/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
foo.js
foo.js
2 changes: 1 addition & 1 deletion test/bar/foobar/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bar.js
bar.js
2 changes: 1 addition & 1 deletion test/fixtures/gitignore/test/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
foo.js
foo.js

0 comments on commit 519ad1b

Please sign in to comment.