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 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 February 20, 2022 17:26
@ybiquitous ybiquitous force-pushed the refactor-to-use-validateObjectWithArrayProps branch from f292d22 to 1c00330 Compare February 20, 2022 17:39
/**
* 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

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

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 February 20, 2022 17:44
@jeddy3 jeddy3 changed the title Tighten rule validations having object options Fix false negatives for invalid options in *-list Feb 20, 2022
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.

Good stuff!

LGTM.

@ybiquitous ybiquitous merged commit 39efcb6 into main Feb 20, 2022
@ybiquitous ybiquitous deleted the refactor-to-use-validateObjectWithArrayProps branch February 20, 2022 23:46
@ybiquitous
Copy link
Member Author

@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