File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -667,11 +667,14 @@ class CLIEngine {
667
667
addPlugin ( name , pluginObject ) {
668
668
const {
669
669
additionalPluginPool,
670
- configArrayFactory
670
+ configArrayFactory,
671
+ lastConfigArrays
671
672
} = internalSlotsMap . get ( this ) ;
672
673
673
674
additionalPluginPool . set ( name , pluginObject ) ;
674
675
configArrayFactory . clearCache ( ) ;
676
+ lastConfigArrays . length = 1 ;
677
+ lastConfigArrays [ 0 ] = configArrayFactory . getConfigArrayForFile ( ) ;
675
678
}
676
679
677
680
/**
Original file line number Diff line number Diff line change @@ -4022,6 +4022,14 @@ describe("CLIEngine", () => {
4022
4022
4023
4023
assert ( engine . getRules ( ) . has ( "node/no-deprecated-api" ) , "node/no-deprecated-api is present" ) ;
4024
4024
} ) ;
4025
+
4026
+ it ( "should expose the rules of the plugin that is added by 'addPlugin'." , ( ) => {
4027
+ const engine = new CLIEngine ( { plugins : [ "foo" ] } ) ;
4028
+
4029
+ engine . addPlugin ( "foo" , require ( "eslint-plugin-node" ) ) ;
4030
+
4031
+ assert ( engine . getRules ( ) . has ( "foo/no-deprecated-api" ) , "foo/no-deprecated-api is present" ) ;
4032
+ } ) ;
4025
4033
} ) ;
4026
4034
4027
4035
describe ( "resolveFileGlobPatterns" , ( ) => {
You can’t perform that action at this time.
0 commit comments