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 false negatives for invalid options in *-list #5924

Merged
merged 1 commit into from Feb 20, 2022

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Feb 20, 2022

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

None.

Is there anything in the PR that needs further explanation?

This change aims to tighten rule validations having object options like at-rule-property-required-list.

For example, when the following configuration is given,

{
	"rules": {
		"at-rule-property-required-list": {
			"font-family": [1]
		}
	}
}

a validation error should be expected,

Invalid Option: Invalid option value "{"font-family":[1]}" for rule "at-rule-property-required-list"

but actually no errors.

@ybiquitous ybiquitous force-pushed the refactor-to-use-validateObjectWithArrayProps branch from d3c9933 to f292d22 Compare Feb 20, 2022
@ybiquitous ybiquitous force-pushed the refactor-to-use-validateObjectWithArrayProps branch from f292d22 to 1c00330 Compare Feb 20, 2022
/**
* Check whether the variable is an object and all its properties are arrays of string values:
* Check whether the variable is an object and all its properties are arrays of values
* that satisfy the specified validator(s):
Copy link
Member Author

@ybiquitous ybiquitous Feb 20, 2022

Choose a reason for hiding this comment

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

[note] Fixed the inaccurate comment.


return Object.values(value).every((array) => {
if (!Array.isArray(array)) {
module.exports = function validateObjectWithArrayProps(validator) {
Copy link
Member Author

@ybiquitous ybiquitous Feb 20, 2022

Choose a reason for hiding this comment

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

[note] Giving the function name changed indentation.

@ybiquitous ybiquitous marked this pull request as ready for review Feb 20, 2022
@jeddy3 jeddy3 changed the title Tighten rule validations having object options Fix false negatives for invalid options in *-list Feb 20, 2022
jeddy3
jeddy3 approved these changes Feb 20, 2022
Copy link
Member

@jeddy3 jeddy3 left a comment

Good stuff!

LGTM.

@ybiquitous ybiquitous merged commit 39efcb6 into main Feb 20, 2022
14 checks passed
@ybiquitous ybiquitous deleted the refactor-to-use-validateObjectWithArrayProps branch Feb 20, 2022
@ybiquitous
Copy link
Member Author

@ybiquitous ybiquitous commented Feb 20, 2022

@jeddy3 Thank you! I've updated the changelog:

  • Fixed: false negatives for invalid options in *-list (#5924).

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.

None yet

2 participants