@@ -8,13 +8,13 @@ import slash from 'slash';
8
8
import { toPath } from 'unicorn-magic' ;
9
9
import { isNegativePattern } from './utilities.js' ;
10
10
11
+ const defaultIgnoredDirectories = [
12
+ '**/node_modules' ,
13
+ '**/flow-typed' ,
14
+ '**/coverage' ,
15
+ '**/.git' ,
16
+ ] ;
11
17
const ignoreFilesGlobOptions = {
12
- ignore : [
13
- '**/node_modules' ,
14
- '**/flow-typed' ,
15
- '**/coverage' ,
16
- '**/.git' ,
17
- ] ,
18
18
absolute : true ,
19
19
dot : true ,
20
20
} ;
@@ -62,12 +62,13 @@ const normalizeOptions = (options = {}) => ({
62
62
cwd : toPath ( options . cwd ) ?? process . cwd ( ) ,
63
63
suppressErrors : Boolean ( options . suppressErrors ) ,
64
64
deep : typeof options . deep === 'number' ? options . deep : Number . POSITIVE_INFINITY ,
65
+ ignore : [ ...options . ignore ?? [ ] , ...defaultIgnoredDirectories ] ,
65
66
} ) ;
66
67
67
68
export const isIgnoredByIgnoreFiles = async ( patterns , options ) => {
68
- const { cwd, suppressErrors, deep} = normalizeOptions ( options ) ;
69
+ const { cwd, suppressErrors, deep, ignore } = normalizeOptions ( options ) ;
69
70
70
- const paths = await fastGlob ( patterns , { cwd, suppressErrors, deep, ...ignoreFilesGlobOptions } ) ;
71
+ const paths = await fastGlob ( patterns , { cwd, suppressErrors, deep, ignore , ...ignoreFilesGlobOptions } ) ;
71
72
72
73
const files = await Promise . all (
73
74
paths . map ( async filePath => ( {
@@ -80,9 +81,9 @@ export const isIgnoredByIgnoreFiles = async (patterns, options) => {
80
81
} ;
81
82
82
83
export const isIgnoredByIgnoreFilesSync = ( patterns , options ) => {
83
- const { cwd, suppressErrors, deep} = normalizeOptions ( options ) ;
84
+ const { cwd, suppressErrors, deep, ignore } = normalizeOptions ( options ) ;
84
85
85
- const paths = fastGlob . sync ( patterns , { cwd, suppressErrors, deep, ...ignoreFilesGlobOptions } ) ;
86
+ const paths = fastGlob . sync ( patterns , { cwd, suppressErrors, deep, ignore , ...ignoreFilesGlobOptions } ) ;
86
87
87
88
const files = paths . map ( filePath => ( {
88
89
filePath,
0 commit comments