New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor to improve types and docs for *-list
rules
#5936
Conversation
@@ -80,7 +80,7 @@ testRule({ | |||
ruleName, | |||
skipBasicChecks: true, | |||
|
|||
config: ['keyframes'], | |||
config: 'keyframes', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[note] This change aims to test a single primary option value.
const rule = (primary) => { | ||
// To allow for just a string as a parameter (not only arrays of strings) | ||
const primaryValues = [primary].flat(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[note] validateOptions
allows both a single value and an array, so it's better to call .flat()
after the validation.
message: messages.rejected('>'), | ||
}, | ||
], | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[note] This new test case aims to just check a single primary value.
* @param {string} value | ||
* @param {string} comparison | ||
* | ||
* @param {unknown} comparison |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[note] testAgainst()
uses isString()
, so it accepts the unknown
argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic cleanup and refactor, thank you!
LGTM.
Follow-up of #5934
When I was looking into the problem of #5933 and #5934, I felt to check the
*-list
rules again.So, this pull request aims to improve the docs and type of that rules for consistency and clarity.
It doesn't change the existing behavior.