Navigation Menu

Skip to content
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

Fix invalid option warnings for strings in *-list #5934

Merged
merged 1 commit into from Feb 23, 2022

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Feb 23, 2022

Which issue, if any, is this issue related to?

Closes #5933

Is there anything in the PR that needs further explanation?

This pull request does:

  • loosen up the validateObjectWithArrayProps() utility to accept also a single value not only an array. E.g.
    validateObjectWithArrayProps({ foo: [1, 2], bar: 3 }) //=> true
  • fix or update the undocumented behavior of all rules using validateObjectWithArrayProps()

*/
module.exports = function validateObjectWithArrayProps(validator) {
module.exports = function validateObjectWithArrayProps(...validators) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] I've changed the argument type for a more straightforward implementation. However, I think it's safe this utility has not been exposed.

@ybiquitous ybiquitous marked this pull request as ready for review February 23, 2022 09:17
@ybiquitous ybiquitous force-pushed the loosen-validateObjectWithArrayProps branch from 757804d to 9fa46f2 Compare February 23, 2022 09:17
Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is stellar work, thank you!

The changes to the validate utility are nice, as is the use of the new flattenArray utility in the rules.

What should the changelog entry be?

"Fixed: *-list invalid option warnings for strings"

@ybiquitous
Copy link
Member Author

"Fixed: *-list invalid option warnings for strings"

I agree with your idea. 👍🏼

@jeddy3
Copy link
Member

jeddy3 commented Feb 23, 2022

Let's merge and I'll put out a patch release.

@jeddy3 jeddy3 changed the title Loosen up validateObjectWithArrayProps() utility Fix invalid option warnings for strings in *-list Feb 23, 2022
@ybiquitous ybiquitous merged commit 8ea60bd into main Feb 23, 2022
@ybiquitous ybiquitous deleted the loosen-validateObjectWithArrayProps branch February 23, 2022 10:13
@ybiquitous
Copy link
Member Author

Changelog updated:

  • Fixed: *-list invalid option warnings for strings (#5934).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fix invalid option warning for string properties in *-list
2 participants