@@ -16,20 +16,13 @@ var tooManyWarnings = function (detects, userConfig) {
16
16
return warningCount > 0 && warningCount > userConfig . options [ 'max-warnings' ] ;
17
17
} ;
18
18
19
- var detectPattern = function ( pattern , userConfig ) {
19
+ var detectPattern = function ( pattern ) {
20
20
var detects = lint . lintFiles ( pattern , configOptions , configPath ) ;
21
21
22
- if ( program . verbose ) {
23
- lint . outputResults ( detects , configOptions , configPath ) ;
24
- }
25
-
26
- if ( lint . errorCount ( detects ) . count || tooManyWarnings ( detects , userConfig ) ) {
27
- exitCode = 1 ;
28
- }
29
-
30
22
if ( program . exit ) {
31
23
lint . failOnError ( detects , configOptions , configPath ) ;
32
24
}
25
+ return detects ;
33
26
} ;
34
27
35
28
program
@@ -72,17 +65,28 @@ if (program.maxWarnings && program.maxWarnings !== true) {
72
65
configOptions . options [ 'max-warnings' ] = program . maxWarnings ;
73
66
}
74
67
75
- // load our config here so we only load it once for each file
76
- config = lint . getConfig ( configOptions , configPath ) ;
68
+ ( function ( ) {
69
+ // load our config here so we only load it once for each file
70
+ config = lint . getConfig ( configOptions , configPath ) ;
71
+ var results = [ ] ;
77
72
78
- if ( program . args . length === 0 ) {
79
- detectPattern ( null , config ) ;
80
- }
81
- else {
82
- program . args . forEach ( function ( path ) {
83
- detectPattern ( path , config ) ;
84
- } ) ;
85
- }
73
+ if ( program . args . length === 0 ) {
74
+ results = results . concat ( detectPattern ( null ) ) ;
75
+ }
76
+ else {
77
+ program . args . forEach ( function ( path ) {
78
+ results = results . concat ( detectPattern ( path ) ) ;
79
+ } ) ;
80
+ }
81
+
82
+ if ( program . verbose ) {
83
+ lint . outputResults ( results , configOptions , configPath ) ;
84
+ }
85
+
86
+ if ( lint . errorCount ( results ) . count || tooManyWarnings ( results , config ) ) {
87
+ exitCode = 1 ;
88
+ }
89
+ } ( ) ) ;
86
90
87
91
process . on ( 'exit' , function ( ) {
88
92
process . exit ( exitCode ) ; // eslint-disable-line no-process-exit
0 commit comments