From 2124d13297d0c9547ec4383160147410c30a5cfd Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 22 Feb 2024 09:29:21 +1030 Subject: [PATCH] [Fix] add a few jsdoc type annotations to work around TS inference for consumers --- configs/all.js | 10 ++++++++++ lib/rules/index.js | 1 + 2 files changed, 11 insertions(+) diff --git a/configs/all.js b/configs/all.js index c507744ac1..bcb416e295 100644 --- a/configs/all.js +++ b/configs/all.js @@ -9,6 +9,10 @@ function filterRules(rules, predicate) { return fromEntries(entries(rules).filter((entry) => predicate(entry[1]))); } +/** + * @param {object} rules - rules object mapping rule name to rule module + * @returns {Record} + */ function configureAsError(rules) { return fromEntries(Object.keys(rules).map((key) => [`react/${key}`, 2])); } @@ -20,6 +24,12 @@ const deprecatedRules = filterRules(allRules, (rule) => rule.meta.deprecated); module.exports = { plugins: { + /** + * @type {{ + * deprecatedRules: Record, + * rules: Record, + * }} + */ react: { deprecatedRules, rules: allRules, diff --git a/lib/rules/index.js b/lib/rules/index.js index 0c14f0795e..784831bba7 100644 --- a/lib/rules/index.js +++ b/lib/rules/index.js @@ -2,6 +2,7 @@ /* eslint global-require: 0 */ +/** @type {Record} */ module.exports = { 'boolean-prop-naming': require('./boolean-prop-naming'), 'button-has-type': require('./button-has-type'),