Skip to content

Commit 0a4df0e

Browse files
committed
Document performance implications of gitignore option
Fixes #50
1 parent 1c7f3ed commit 0a4df0e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export type Options = {
4242
/**
4343
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
4444
45+
Performance note: This option searches for all `.gitignore` files in the entire directory tree before globbing, which can be slow. For better performance, use `ignoreFiles: '.gitignore'` to only respect the root `.gitignore` file.
46+
4547
@default false
4648
*/
4749
readonly gitignore?: boolean;
@@ -51,6 +53,8 @@ export type Options = {
5153
5254
This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
5355
56+
Performance tip: Using a specific path like `'.gitignore'` is much faster than recursive patterns.
57+
5458
@default undefined
5559
*/
5660
readonly ignoreFiles?: string | readonly string[];

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ Default: `false`
8686

8787
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
8888

89+
**Performance note:** This option searches for *all* `.gitignore` files in the entire directory tree before globbing, which can be slow. For better performance, use `ignoreFiles: '.gitignore'` to only respect the root `.gitignore` file.
90+
8991
##### ignoreFiles
9092

9193
Type: `string | string[]`\
@@ -95,6 +97,8 @@ Glob patterns to look for ignore files, which are then used to ignore globbed fi
9597

9698
This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
9799

100+
**Performance tip:** Using a specific path like `'.gitignore'` is much faster than recursive patterns.
101+
98102
### globbySync(patterns, options?)
99103

100104
Returns `string[]` of matching paths.

0 commit comments

Comments
 (0)