@@ -27,14 +27,14 @@ const deprecatedRules = filterRules(allRules, (rule) => rule.meta.deprecated);
27
27
28
28
/** @type {['react'] } */
29
29
// for legacy config system
30
- const plugins = [
31
- 'react' ,
32
- ] ;
30
+ const plugins = [ 'react' ] ;
33
31
34
32
// TODO: with TS 4.5+, inline this
35
33
const SEVERITY_ERROR = /** @type {2 } */ ( 2 ) ;
36
34
const SEVERITY_OFF = /** @type {0 } */ ( 0 ) ;
37
35
36
+ /** @typedef {'recommended' | 'all' | 'jsx-runtime' } AvailableFlatConfigs */
37
+
38
38
const configs = {
39
39
recommended : {
40
40
plugins,
@@ -90,21 +90,19 @@ const configs = {
90
90
'react/jsx-uses-react' : SEVERITY_OFF ,
91
91
} ,
92
92
} ,
93
- flat : /** @type {Record<string, ReactFlatConfig> } */ ( {
94
- __proto__ : null ,
95
- } ) ,
93
+ flat : /** @type {{Record<AvailableFlatConfigs, ReactFlatConfig>} } */ ( { } ) ,
96
94
} ;
97
95
98
- /** @typedef {{ plugins: { react: typeof plugin }, rules: import('eslint').Linter.RulesRecord, languageOptions: { parserOptions: import('eslint').Linter.ParserOptions } } } ReactFlatConfig */
96
+ /** @typedef {{plugins: {react: typeof plugin}, rules: import('eslint').Linter.RulesRecord, languageOptions: {parserOptions: import('eslint').Linter.ParserOptions} } } ReactFlatConfig */
99
97
100
- /** @type {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat: Record<string, ReactFlatConfig> }} } */
98
+ /** @type {{deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs} }} */
101
99
const plugin = {
102
100
deprecatedRules,
103
101
rules : allRules ,
104
102
configs,
105
103
} ;
106
104
107
- Object . assign ( configs . flat , {
105
+ configs . flat = {
108
106
recommended : {
109
107
plugins : { react : plugin } ,
110
108
rules : configs . recommended . rules ,
@@ -120,6 +118,6 @@ Object.assign(configs.flat, {
120
118
rules : configs [ 'jsx-runtime' ] . rules ,
121
119
languageOptions : { parserOptions : configs [ 'jsx-runtime' ] . parserOptions } ,
122
120
} ,
123
- } ) ;
121
+ } ;
124
122
125
123
module . exports = plugin ;
0 commit comments