@@ -132,6 +132,9 @@ class WebpackConfig {
132
132
this . vueOptions = {
133
133
useJsx : false ,
134
134
} ;
135
+ this . eslintOptions = {
136
+ lintVue : false ,
137
+ } ;
135
138
136
139
// Features/Loaders options callbacks
137
140
this . postCssLoaderOptionsCallback = ( ) => { } ;
@@ -663,29 +666,31 @@ class WebpackConfig {
663
666
this . vueOptions = vueOptions ;
664
667
}
665
668
666
- enableEslintLoader ( eslintLoaderOptionsOrCallback = ( ) => { } ) {
669
+ enableEslintLoader ( eslintLoaderOptionsOrCallback = ( ) => { } , eslintOptions = { } ) {
667
670
this . useEslintLoader = true ;
668
671
669
672
if ( typeof eslintLoaderOptionsOrCallback === 'function' ) {
670
673
this . eslintLoaderOptionsCallback = eslintLoaderOptionsOrCallback ;
671
- return ;
672
- }
673
-
674
- if ( typeof eslintLoaderOptionsOrCallback === 'string' ) {
674
+ } else if ( typeof eslintLoaderOptionsOrCallback === 'string' ) {
675
675
this . eslintLoaderOptionsCallback = ( options ) => {
676
676
options . extends = eslintLoaderOptionsOrCallback ;
677
677
} ;
678
- return ;
679
- }
680
-
681
- if ( typeof eslintLoaderOptionsOrCallback === 'object' ) {
678
+ } else if ( typeof eslintLoaderOptionsOrCallback === 'object' ) {
682
679
this . eslintLoaderOptionsCallback = ( options ) => {
683
680
Object . assign ( options , eslintLoaderOptionsOrCallback ) ;
684
681
} ;
685
- return ;
682
+ } else {
683
+ throw new Error ( 'Argument 1 to enableEslintLoader() must be either a string, object or callback function.' ) ;
684
+ }
685
+
686
+ // Check allowed keys
687
+ for ( const key of Object . keys ( eslintOptions ) ) {
688
+ if ( ! ( key in this . eslintOptions ) ) {
689
+ throw new Error ( `"${ key } " is not a valid key for enableEslintLoader(). Valid keys: ${ Object . keys ( this . eslintOptions ) . join ( ', ' ) } .` ) ;
690
+ }
686
691
}
687
692
688
- throw new Error ( 'Argument 1 to enableEslintLoader() must be either a string, object or callback function.' ) ;
693
+ this . eslintOptions = eslintOptions ;
689
694
}
690
695
691
696
enableBuildNotifications ( enabled = true , notifierPluginOptionsCallback = ( ) => { } ) {
0 commit comments