File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 10
10
'use strict' ;
11
11
12
12
const loaderFeatures = require ( '../features' ) ;
13
+ const applyOptionsCallback = require ( '../utils/apply-options-callback' ) ;
13
14
14
15
/**
15
16
* @param {WebpackConfig } webpackConfig
@@ -29,12 +30,6 @@ module.exports = {
29
30
}
30
31
} ;
31
32
32
- webpackConfig . eslintLoaderOptionsCallback . apply (
33
- // use eslintLoaderOptions as the this variable
34
- eslintLoaderOptions ,
35
- [ eslintLoaderOptions ]
36
- ) ;
37
-
38
- return eslintLoaderOptions ;
33
+ return applyOptionsCallback ( webpackConfig . eslintLoaderOptionsCallback , eslintLoaderOptions ) ;
39
34
}
40
35
} ;
Original file line number Diff line number Diff line change @@ -54,4 +54,16 @@ describe('loaders/eslint', () => {
54
54
expect ( Object . keys ( actualOptions ) ) . to . have . lengthOf ( 3 ) ;
55
55
expect ( actualOptions . emitWarning ) . to . equal ( false ) ;
56
56
} ) ;
57
+
58
+ it ( 'getOptions() with a callback that returns an object' , ( ) => {
59
+ const config = createConfig ( ) ;
60
+ config . enableEslintLoader ( ( options ) => {
61
+ options . custom_option = 'foo' ;
62
+
63
+ return { foo : true } ;
64
+ } ) ;
65
+
66
+ const actualOptions = eslintLoader . getOptions ( config ) ;
67
+ expect ( actualOptions ) . to . deep . equals ( { foo : true } ) ;
68
+ } ) ;
57
69
} ) ;
You can’t perform that action at this time.
0 commit comments