Skip to content

Commit 6a6c9c9

Browse files
committed
[types] fix types of flat configs
1 parent 82a196a commit 6a6c9c9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,21 @@ const configs = {
9090
'react/jsx-uses-react': SEVERITY_OFF,
9191
},
9292
},
93+
flat: /** @type {Record<string, ReactFlatConfig>} */ ({
94+
__proto__: null,
95+
}),
9396
};
9497

9598
/** @typedef {{ plugins: { react: typeof plugin }, rules: import('eslint').Linter.RulesRecord, languageOptions: { parserOptions: import('eslint').Linter.ParserOptions } }} ReactFlatConfig */
9699

97-
/** @type {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat?: Record<string, ReactFlatConfig> }}} */
100+
/** @type {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat: Record<string, ReactFlatConfig> }}} */
98101
const plugin = {
99102
deprecatedRules,
100103
rules: allRules,
101104
configs,
102105
};
103106

104-
/** @type {Record<string, ReactFlatConfig>} */
105-
configs.flat = {
107+
Object.assign(configs.flat, {
106108
recommended: {
107109
plugins: { react: plugin },
108110
rules: configs.recommended.rules,
@@ -118,6 +120,6 @@ configs.flat = {
118120
rules: configs['jsx-runtime'].rules,
119121
languageOptions: { parserOptions: configs['jsx-runtime'].parserOptions },
120122
},
121-
};
123+
});
122124

123125
module.exports = plugin;

0 commit comments

Comments
 (0)