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

Refactor atrule statement in unit-no-unknown #5515

Conversation

sylwia-lask
Copy link
Contributor

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

PR is related to discussion in #5500 - introduce isStandardAtRule.

Is there anything in the PR that needs further explanation?

No, it's self-explanatory.

Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

@sylwia-lask Thanks for creating the PR! I've commented on a refactoring suggestion, so can you check it out?

@@ -129,7 +130,7 @@ function rule(actual, options) {
}

root.walkAtRules((atRule) => {
if (!/^media$/i.test(atRule.name) && !atRule.variable) {
if (!/^media$/i.test(atRule.name) && !isStandardSyntaxAtRule(atRule)) {
Copy link
Member

Choose a reason for hiding this comment

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

[suggestion] Can we move the position of /^media$/i as below? I think it's more readable. 😃

		root.walkAtRules(/^media$/i, (atRule) => {
			if (!isStandardSyntaxAtRule(atRule)) {

Copy link
Member

Choose a reason for hiding this comment

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

Yep, we should be using the walk* filter when available. I think most rules do, but it looks like this one must have slipped through at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ybiquitous @jeddy3 thanks a lot guys for your review :)

@sylwia-lask sylwia-lask force-pushed the refactor-atrule-statement-in-unit-no-unknown branch from 5d49cdf to d93de00 Compare September 6, 2021 20:20
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

@sylwia-lask Thanks. LGTM! 😄

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.

@sylwia-lask Looks great, thank you!

@jeddy3 jeddy3 merged commit 3c89928 into stylelint:v14 Sep 7, 2021
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

3 participants