@@ -38,6 +38,9 @@ class ESLintWebpackPlugin {
3838 this . getContext ( compiler )
3939 ) ,
4040 extensions : arrify ( this . options . extensions ) ,
41+ resourceQueryExclude : arrify ( this . options . resourceQueryExclude || [ ] ) . map (
42+ ( item ) => ( item instanceof RegExp ? item : new RegExp ( item ) )
43+ ) ,
4144 files : parseFiles ( this . options . files || '' , this . getContext ( compiler ) ) ,
4245 } ;
4346
@@ -69,7 +72,7 @@ class ESLintWebpackPlugin {
6972
7073 /**
7174 * @param {Compiler } compiler
72- * @param {Options } options
75+ * @param {Omit< Options, 'resourceQueryExclude'> & {resourceQueryExclude: RegExp[]} } options
7376 * @param {string[] } wanted
7477 * @param {string[] } exclude
7578 */
@@ -104,13 +107,14 @@ class ESLintWebpackPlugin {
104107 // Add the file to be linted
105108 compilation . hooks . succeedModule . tap ( this . key , ( { resource } ) => {
106109 if ( resource ) {
107- const [ file ] = resource . split ( '?' ) ;
110+ const [ file , query ] = resource . split ( '?' ) ;
108111
109112 if (
110113 file &&
111114 ! files . includes ( file ) &&
112115 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 ) )
114118 ) {
115119 files . push ( file ) ;
116120
0 commit comments