Skip to content

Commit

Permalink
add jsdoc to help hint the shape better
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Feb 21, 2024
1 parent f4159ab commit d1465bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions configs/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, 2>}
*/
function configureAsError(rules) {
return fromEntries(Object.keys(rules).map((key) => [`react/${key}`, 2]));
}
Expand All @@ -20,6 +24,12 @@ const deprecatedRules = filterRules(allRules, (rule) => rule.meta.deprecated);

module.exports = {
plugins: {
/**
* @type {{
* deprecatedRules: Record<string, import('eslint').Rule.RuleModule>,
* rules: Record<string, import('eslint').Rule.RuleModule>,
* }}
*/
react: {
deprecatedRules,
rules: allRules,
Expand Down
1 change: 1 addition & 0 deletions lib/rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/* eslint global-require: 0 */

/** @satisfies {Record<string, import('eslint').Rule.RuleModule>} */
module.exports = {
'boolean-prop-naming': require('./boolean-prop-naming'),
'button-has-type': require('./button-has-type'),
Expand Down

0 comments on commit d1465bc

Please sign in to comment.