diff --git a/CHANGELOG.md b/CHANGELOG.md index 904a29a460..7bec3e261d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange ### Fixed * [`no-unknown-property`]: support `onBeforeToggle`, `popoverTarget`, `popoverTargetAction` attributes ([#3865][] @acusti) +* [types] fix types of flat configs ([#3874][] @ljharb) +[#3874]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3874 [#3865]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3865 ## [7.37.3] - 2024.12.23 diff --git a/index.js b/index.js index 365f17446c..64ff9bbdc4 100644 --- a/index.js +++ b/index.js @@ -90,19 +90,21 @@ const configs = { 'react/jsx-uses-react': SEVERITY_OFF, }, }, + flat: /** @type {Record} */ ({ + __proto__: null, + }), }; /** @typedef {{ plugins: { react: typeof plugin }, rules: import('eslint').Linter.RulesRecord, languageOptions: { parserOptions: import('eslint').Linter.ParserOptions } }} ReactFlatConfig */ -/** @type {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat?: Record }}} */ +/** @type {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat: Record }}} */ const plugin = { deprecatedRules, rules: allRules, configs, }; -/** @type {Record} */ -configs.flat = { +Object.assign(configs.flat, { recommended: { plugins: { react: plugin }, rules: configs.recommended.rules, @@ -118,6 +120,6 @@ configs.flat = { rules: configs['jsx-runtime'].rules, languageOptions: { parserOptions: configs['jsx-runtime'].parserOptions }, }, -}; +}); module.exports = plugin;