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
Add ignore: ["keyframe-selectors"]
to selector-disallowed-list
#7417
Add ignore: ["keyframe-selectors"]
to selector-disallowed-list
#7417
Conversation
🦋 Changeset detectedLatest commit: 5e3675c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
60fb3e6
to
d49fdc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattxwang Thanks for the pull request!
I think it's better to check if the rule node is inside @keyframes {}
block rather than using isKeyframeSelector()
like this:
if (ignoreKeyframeSelectors && isInsideKeyframes(ruleNode)) {
return;
}
// ...
const keyframesPattern = /^keyframes$/i;
/**
* @param {import('postcss').Node} node
* @returns {boolean}
*/
function isInsideKeyframes({ parent }) {
return Boolean(parent && isAtRule(parent) && keyframesPattern.test(parent.name));
}
If doing so, splitList
is unnecessary for ignore: ['keyframe-selectors']
. Any thoughts?
This looks similar to |
Ah, I forgot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. I've requested some changes to align the docs and tests with our conventions.
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Thanks for the feedback everyone! Have just made the requested changes - let me know what y'all think! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM 👍🏼
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Closes #7162.
Two quick questions:
I used theAm now usingisKeyframeSelector
util (used elsewhere) to heuristically guess if the item is a keyframe selector, rather than seeing if it's actually in a keyframe. Does this make sense?isKeyframeRule
instead!I assumed that there should be nothing "special" about this option's interaction withResolved by the former :)splitList
; in particular, if the list is not split, given/from/
the current implementation will still flagfrom, to
; it's only if the rule is given/from/, { splitList: true }
thatfrom, to
is properly ignored. However, it'd be simple for me to reverse this behaviour - what are our thoughts?