@@ -38,6 +38,9 @@ class ESLintWebpackPlugin {
38
38
this . getContext ( compiler )
39
39
) ,
40
40
extensions : arrify ( this . options . extensions ) ,
41
+ resourceQueryExclude : arrify ( this . options . resourceQueryExclude || [ ] ) . map (
42
+ ( item ) => ( item instanceof RegExp ? item : new RegExp ( item ) )
43
+ ) ,
41
44
files : parseFiles ( this . options . files || '' , this . getContext ( compiler ) ) ,
42
45
} ;
43
46
@@ -69,7 +72,7 @@ class ESLintWebpackPlugin {
69
72
70
73
/**
71
74
* @param {Compiler } compiler
72
- * @param {Options } options
75
+ * @param {Omit< Options, 'resourceQueryExclude'> & {resourceQueryExclude: RegExp[]} } options
73
76
* @param {string[] } wanted
74
77
* @param {string[] } exclude
75
78
*/
@@ -104,13 +107,14 @@ class ESLintWebpackPlugin {
104
107
// Add the file to be linted
105
108
compilation . hooks . succeedModule . tap ( this . key , ( { resource } ) => {
106
109
if ( resource ) {
107
- const [ file ] = resource . split ( '?' ) ;
110
+ const [ file , query ] = resource . split ( '?' ) ;
108
111
109
112
if (
110
113
file &&
111
114
! files . includes ( file ) &&
112
115
isMatch ( file , wanted , { dot : true } ) &&
113
- ! isMatch ( file , exclude , { dot : true } )
116
+ ! isMatch ( file , exclude , { dot : true } ) &&
117
+ options . resourceQueryExclude . every ( ( reg ) => ! reg . test ( query ) )
114
118
) {
115
119
files . push ( file ) ;
116
120
0 commit comments