Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 73720aa

Browse files
committed
chore: mention that newRules can be undefined
1 parent 0c7b111 commit 73720aa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/rules.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@ import ruleURI from 'eslint-rule-documentation'
66
export default class Rules {
77
/**
88
* Instantiates a Rules object, optionally with an existing list of rules
9-
* @param {Array<Array<string, any>} newRules Array of Arrays of the rule and properties
9+
* @param {Array<Array<string, any> | undefined} newRules Array of Arrays of the rule and properties
1010
*/
1111
constructor(newRules) {
12+
// TODO we should not accept undefined newRules.
1213
this.replaceRules(newRules)
1314
}
1415

1516
/**
1617
* Process the updated rules into the local Map and call further update functions
17-
* @param {Array<Array<string, any>} newRules Array of Arrays of the rule and properties
18+
* @param {Array<Array<string, any> | undefined} newRules Array of Arrays of the rule and properties
1819
*/
1920
replaceRules(newRules) {
2021
if (this.rules !== undefined) {
2122
this.rules.clear()
2223
}
2324

24-
/** @type {Map<string, any>} */
25+
/** @type {Map<string, any>} if newRules is {undefined} an empty Map is created */
2526
this.rules = new Map(newRules)
2627
}
2728

0 commit comments

Comments
 (0)