File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -98,27 +98,28 @@ class ESLintWebpackPlugin {
98
98
return ;
99
99
}
100
100
101
- // Gather Files to lint
102
- compilation . hooks . finishModules . tap ( ESLINT_PLUGIN , ( modules ) => {
103
- /** @type {string[] } */
104
- const files = [ ] ;
101
+ /** @type {string[] } */
102
+ const files = [ ] ;
105
103
106
- // @ts -ignore
107
- for ( const { resource } of modules ) {
108
- if ( resource ) {
109
- const [ file ] = resource . split ( '?' ) ;
110
-
111
- if (
112
- file &&
113
- ! files . includes ( file ) &&
114
- isMatch ( file , wanted ) &&
115
- ! isMatch ( file , exclude )
116
- ) {
117
- files . push ( file ) ;
118
- }
104
+ // @ts -ignore
105
+ // Add the file to be linted
106
+ compilation . hooks . succeedModule . tap ( ESLINT_PLUGIN , ( { resource } ) => {
107
+ if ( resource ) {
108
+ const [ file ] = resource . split ( '?' ) ;
109
+
110
+ if (
111
+ file &&
112
+ ! files . includes ( file ) &&
113
+ isMatch ( file , wanted ) &&
114
+ ! isMatch ( file , exclude )
115
+ ) {
116
+ files . push ( file ) ;
119
117
}
120
118
}
119
+ } ) ;
121
120
121
+ // Lint all files added
122
+ compilation . hooks . finishModules . tap ( ESLINT_PLUGIN , ( ) => {
122
123
if ( files . length > 0 ) {
123
124
lint ( files ) ;
124
125
}
You can’t perform that action at this time.
0 commit comments