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 declaration-property-value-no-unknown false negatives for typed custom properties #7078

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Jul 13, 2023

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

Closes #7061

Is there anything in the PR that needs further explanation?

I chose not to validate the contents of the syntax property in a @property rule.

It is always valid if it also works in a browser.
It might be invalid in browsers and still be processed by CSSTree as a valid syntax definition.

I think this is fine as it future proofs this rule.
We will not have to change this rule each time the restrictions here are relaxed and more of the full value definition syntax becomes allowed.

@changeset-bot
Copy link

changeset-bot bot commented Jul 13, 2023

🦋 Changeset detected

Latest commit: 7185f35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

romainmenke and others added 2 commits July 14, 2023 10:52
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
…lse-negatives-for-typed-custom-properties--philosophical-borneo-elephant-8c41a1b24a
@jeddy3
Copy link
Member

jeddy3 commented Jul 19, 2023

@romainmenke Is this intentionally a draft, or can we review it?

@romainmenke
Copy link
Member Author

romainmenke commented Jul 19, 2023

Intentionally a draft :)
I would like to do a self review after merging the previous change in this same plugin, to make sure that the combined change still makes sense.

But early feedback is always welcome if there are obvious issues/improvements

Comment on lines 131 to 141
// https://github.com/mdn/data/pull/674
// `initial-value` has a incorrect syntax definition.
// In reality everything is valid.
if (
/^initial-value$/i.test(prop) &&
decl.parent &&
isAtRule(decl.parent) &&
/^property$/i.test(decl.parent.name)
) {
return;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't cache the regexp's here because this entire block should be removed.

I don't mind optimizing the code anyway.
But I am really hoping that csstree will receive some attention in the near future.

…lse-negatives-for-typed-custom-properties--philosophical-borneo-elephant-8c41a1b24a
@romainmenke romainmenke marked this pull request as ready for review July 19, 2023 17:03
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.

@romainmenke Thanks for the Pull Request! I think this is great. 👍🏼

I've commented on a few refactoring suggestions, but they're minor things. 😃

romainmenke and others added 2 commits July 20, 2023 08:11
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
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.

Thank you. LGTM! 👍🏼

@romainmenke romainmenke merged commit a3b8d32 into main Jul 20, 2023
18 checks passed
@romainmenke romainmenke deleted the fix-declaration-property-value-no-unknown-false-negatives-for-typed-custom-properties--philosophical-borneo-elephant-8c41a1b24a branch July 20, 2023 06:46
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 declaration-property-value-no-unknown false negatives for typed custom properties
3 participants