File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 1010'use strict' ;
1111
1212const loaderFeatures = require ( '../features' ) ;
13+ const applyOptionsCallback = require ( '../utils/apply-options-callback' ) ;
1314
1415/**
1516 * @param {WebpackConfig } webpackConfig
@@ -29,12 +30,6 @@ module.exports = {
2930 }
3031 } ;
3132
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 ) ;
3934 }
4035} ;
Original file line number Diff line number Diff line change @@ -54,4 +54,16 @@ describe('loaders/eslint', () => {
5454 expect ( Object . keys ( actualOptions ) ) . to . have . lengthOf ( 3 ) ;
5555 expect ( actualOptions . emitWarning ) . to . equal ( false ) ;
5656 } ) ;
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+ } ) ;
5769} ) ;
You can’t perform that action at this time.
0 commit comments