File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -226,15 +226,25 @@ class FlatCompat {
226226 throw new TypeError ( "Missing parameter 'allConfig' in FlatCompat constructor." ) ;
227227 }
228228
229- return allConfig ;
229+ // remove name property if it exists
230+ const config = { ...allConfig } ;
231+
232+ delete config . name ;
233+
234+ return config ;
230235 } ,
231236 getEslintRecommendedConfig ( ) {
232237
233238 if ( ! recommendedConfig ) {
234239 throw new TypeError ( "Missing parameter 'recommendedConfig' in FlatCompat constructor." ) ;
235240 }
236241
237- return recommendedConfig ;
242+ // remove name property if it exists
243+ const config = { ...recommendedConfig } ;
244+
245+ delete config . name ;
246+
247+ return config ;
238248 }
239249 } ) ;
240250 }
Original file line number Diff line number Diff line change @@ -1027,6 +1027,28 @@ describe("FlatCompat", () => {
10271027 } , / M i s s i n g p a r a m e t e r ' r e c o m m e n d e d C o n f i g ' / gu) ;
10281028 } ) ;
10291029
1030+ it ( "should remove name property from eslint:all and eslint:recommended configs" , ( ) => {
1031+ const compatWithNames = new FlatCompat ( {
1032+ baseDirectory : getFixturePath ( "config" ) ,
1033+ recommendedConfig : {
1034+ name : "eslint:recommended" ,
1035+ settings : { "eslint:recommended" : true }
1036+ } ,
1037+ allConfig : {
1038+ name : "eslint:all" ,
1039+ settings : { "eslint:all" : true }
1040+ }
1041+ } ) ;
1042+
1043+ const allResult = compatWithNames . extends ( "eslint:all" ) ;
1044+ const recommendedResult = compatWithNames . extends ( "eslint:recommended" ) ;
1045+
1046+ assert . strictEqual ( allResult . length , 1 ) ;
1047+ assert . isTrue ( allResult [ 0 ] . settings [ "eslint:all" ] ) ;
1048+
1049+ assert . strictEqual ( recommendedResult . length , 1 ) ;
1050+ assert . isTrue ( recommendedResult [ 0 ] . settings [ "eslint:recommended" ] ) ;
1051+ } ) ;
10301052 } ) ;
10311053
10321054 describe ( "plugins()" , ( ) => {
You can’t perform that action at this time.
0 commit comments