@@ -15,13 +15,14 @@ const compat = new FlatCompat({
1515 allConfig : js . configs . all ,
1616} ) ;
1717
18- const recommendedTsRules = new Set (
19- Object . keys ( tsEslintPlugin . configs . recommended . rules || { } ) ,
20- ) ;
21- const noopRule = {
22- meta : { type : 'problem' , docs : { } , schema : [ ] } ,
23- create : ( ) => ( { } ) ,
24- } ;
18+ const recommendedTsRulesConfig = tsEslintPlugin . configs . recommended ;
19+ const recommendedTsRulesObject = Array . isArray ( recommendedTsRulesConfig )
20+ ? recommendedTsRulesConfig . reduce (
21+ ( rules , config ) => ( { ...rules , ...( config . rules || { } ) } ) ,
22+ { } ,
23+ )
24+ : recommendedTsRulesConfig ?. rules || { } ;
25+ const recommendedTsRules = new Set ( Object . keys ( recommendedTsRulesObject ) ) ;
2526
2627function normalizeConfig ( config ) {
2728 const next = { ...config } ;
@@ -37,10 +38,7 @@ function normalizeConfig(config) {
3738 if ( ! ruleName . startsWith ( '@typescript-eslint/' ) ) {
3839 return true ;
3940 }
40- return (
41- recommendedTsRules . has ( ruleName ) ||
42- ruleName === '@typescript-eslint/ban-types'
43- ) ;
41+ return recommendedTsRules . has ( ruleName ) ;
4442 } ) ,
4543 ) ;
4644 }
@@ -66,20 +64,12 @@ export default [
6664 } ,
6765 {
6866 plugins : {
69- '@typescript-eslint' : {
70- ...tsEslintPlugin ,
71- rules : {
72- ...tsEslintPlugin . rules ,
73- 'ban-types' : noopRule ,
74- 'consistent-type-exports' : noopRule ,
75- } ,
76- } ,
67+ '@typescript-eslint' : tsEslintPlugin ,
7768 } ,
7869 } ,
7970 ...compat . config ( require ( './.eslintrc.js' ) ) . map ( normalizeConfig ) ,
8071 {
8172 rules : {
82- '@typescript-eslint/ban-types' : 'off' ,
8373 '@typescript-eslint/no-empty-object-type' : 'off' ,
8474 '@typescript-eslint/no-unsafe-function-type' : 'off' ,
8575 '@typescript-eslint/no-unused-vars' : 'off' ,
0 commit comments