@@ -133,6 +133,9 @@ class WebpackConfig {
133
133
this . vueOptions = {
134
134
useJsx : false ,
135
135
} ;
136
+ this . eslintOptions = {
137
+ lintVue : false ,
138
+ } ;
136
139
137
140
// Features/Loaders options callbacks
138
141
this . postCssLoaderOptionsCallback = ( ) => { } ;
@@ -686,31 +689,33 @@ class WebpackConfig {
686
689
this . vueOptions = vueOptions ;
687
690
}
688
691
689
- enableEslintLoader ( eslintLoaderOptionsOrCallback = ( ) => { } ) {
692
+ enableEslintLoader ( eslintLoaderOptionsOrCallback = ( ) => { } , eslintOptions = { } ) {
690
693
this . useEslintLoader = true ;
691
694
692
695
if ( typeof eslintLoaderOptionsOrCallback === 'function' ) {
693
696
this . eslintLoaderOptionsCallback = eslintLoaderOptionsOrCallback ;
694
- return ;
695
- }
696
-
697
- if ( typeof eslintLoaderOptionsOrCallback === 'string' ) {
697
+ } else if ( typeof eslintLoaderOptionsOrCallback === 'string' ) {
698
698
logger . deprecation ( 'enableEslintLoader: Extending from a configuration is deprecated, please use a configuration file instead. See https://eslint.org/docs/user-guide/configuring for more information.' ) ;
699
699
700
700
this . eslintLoaderOptionsCallback = ( options ) => {
701
701
options . extends = eslintLoaderOptionsOrCallback ;
702
702
} ;
703
- return ;
704
- }
705
-
706
- if ( typeof eslintLoaderOptionsOrCallback === 'object' ) {
703
+ } else if ( typeof eslintLoaderOptionsOrCallback === 'object' ) {
707
704
this . eslintLoaderOptionsCallback = ( options ) => {
708
705
Object . assign ( options , eslintLoaderOptionsOrCallback ) ;
709
706
} ;
710
- return ;
707
+ } else {
708
+ throw new Error ( 'Argument 1 to enableEslintLoader() must be either a string, object or callback function.' ) ;
709
+ }
710
+
711
+ // Check allowed keys
712
+ for ( const key of Object . keys ( eslintOptions ) ) {
713
+ if ( ! ( key in this . eslintOptions ) ) {
714
+ throw new Error ( `"${ key } " is not a valid key for enableEslintLoader(). Valid keys: ${ Object . keys ( this . eslintOptions ) . join ( ', ' ) } .` ) ;
715
+ }
711
716
}
712
717
713
- throw new Error ( 'Argument 1 to enableEslintLoader() must be either a string, object or callback function.' ) ;
718
+ this . eslintOptions = eslintOptions ;
714
719
}
715
720
716
721
enableBuildNotifications ( enabled = true , notifierPluginOptionsCallback = ( ) => { } ) {
0 commit comments