@@ -58,43 +58,43 @@ const recommendedLatestRuleConfigs: Linter.RulesRecord = {
5858const plugins = [ 'react-hooks' ] ;
5959
6060type ReactHooksFlatConfig = {
61- plugins : { react : any } ;
61+ plugins : { ' react-hooks' : typeof plugin } ;
6262 rules : Linter . RulesRecord ;
6363} ;
6464
65- const configs = {
66- recommended : {
67- plugins,
68- rules : recommendedRuleConfigs ,
69- } ,
70- 'recommended-latest' : {
71- plugins,
72- rules : recommendedLatestRuleConfigs ,
73- } ,
74- flat : { } as {
75- recommended : ReactHooksFlatConfig ;
76- 'recommended-latest' : ReactHooksFlatConfig ;
77- } ,
78- } ;
79-
8065const plugin = {
8166 meta : {
8267 name : 'eslint-plugin-react-hooks' ,
8368 version : '7.0.0' ,
8469 } ,
8570 rules,
86- configs,
71+ configs : {
72+ recommended : {
73+ plugins,
74+ rules : recommendedRuleConfigs ,
75+ } ,
76+ 'recommended-latest' : {
77+ plugins,
78+ rules : recommendedLatestRuleConfigs ,
79+ } ,
80+ flat : {
81+ recommended : {
82+ plugins : { 'react-hooks' : null as unknown as typeof plugin } ,
83+ rules : recommendedRuleConfigs ,
84+ } ,
85+ 'recommended-latest' : {
86+ plugins : { 'react-hooks' : null as unknown as typeof plugin } ,
87+ rules : recommendedLatestRuleConfigs ,
88+ } ,
89+ } as {
90+ recommended : ReactHooksFlatConfig ;
91+ 'recommended-latest' : ReactHooksFlatConfig ;
92+ } ,
93+ } ,
8794} ;
8895
89- Object . assign ( configs . flat , {
90- 'recommended-latest' : {
91- plugins : { 'react-hooks' : plugin } ,
92- rules : configs [ 'recommended-latest' ] . rules ,
93- } ,
94- recommended : {
95- plugins : { 'react-hooks' : plugin } ,
96- rules : configs . recommended . rules ,
97- } ,
98- } ) ;
96+ // Assign the plugin reference after plugin object is created
97+ plugin . configs . flat . recommended . plugins [ 'react-hooks' ] = plugin ;
98+ plugin . configs . flat [ 'recommended-latest' ] . plugins [ 'react-hooks' ] = plugin ;
9999
100100export default plugin ;
0 commit comments