@@ -61,10 +61,9 @@ module.exports.lintText = (str, opts) => {
6161
6262 if ( opts . filename ) {
6363 const filename = path . relative ( opts . cwd , opts . filename ) ;
64- const isIgnored = multimatch ( filename , opts . ignores ) . length > 0 ;
65- const isGitIgnored = ! optionsManager . getGitIgnoreFilter ( opts ) ( opts . filename ) ;
6664
67- if ( isIgnored || isGitIgnored ) {
65+ if ( multimatch ( filename , opts . ignores ) . length > 0 ||
66+ globby . gitignore . sync ( { cwd : opts . cwd , ignore : opts . ignores } ) ( opts . filename ) ) {
6867 return {
6968 errorCount : 0 ,
7069 warningCount : 0 ,
@@ -89,11 +88,11 @@ module.exports.lintFiles = (patterns, opts) => {
8988
9089 const isEmptyPatterns = patterns . length === 0 ;
9190 const defaultPattern = `**/*.{${ opts . extensions . join ( ',' ) } }` ;
92- const ignoreFilter = optionsManager . getGitIgnoreFilter ( opts ) ;
9391
94- patterns = isEmptyPatterns ? [ defaultPattern ] : arrify ( patterns ) ;
95-
96- return globby ( patterns , { ignore : opts . ignores , nodir : true , cwd : opts . cwd } ) . then ( paths => {
92+ return globby (
93+ isEmptyPatterns ? [ defaultPattern ] : arrify ( patterns ) ,
94+ { ignore : opts . ignores , gitignore : true , cwd : opts . cwd }
95+ ) . then ( paths => {
9796 // Filter out unwanted file extensions
9897 // For silly users that don't specify an extension in the glob pattern
9998 if ( ! isEmptyPatterns ) {
@@ -103,8 +102,6 @@ module.exports.lintFiles = (patterns, opts) => {
103102 } ) ;
104103 }
105104
106- paths = paths . filter ( ignoreFilter ) ;
107-
108105 if ( ! ( opts . overrides && opts . overrides . length > 0 ) ) {
109106 return runEslint ( paths , opts ) ;
110107 }
0 commit comments