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 keyframe-selector-notation
#6164
Conversation
keyframe-selector-notation
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 Thank you for your excellent work!
I think this pull request looks almost good though I've left some trivial comments. 👍🏼
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.
Thanks for the quick comments! Let me see if I can rework the code given your suggestion.
Typo fixes and type hints Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Hm, the failed actions aren't me - it's a 503 on NPM's registry with |
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
It seems to be due to the Cloudflare outage: |
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 great! Thank you.
Let's add tests for a couple of edge-cases that are valid syntax:
- duplicate keyframe selectors, e.g.
@keyframes foo { from {} from {} to {} }
- mixed notations, e.g.
@keyframes foo { from {} 50% {} to {} }
- keyframe selectors lists, e.g.
@keyframes foo { from, to {} }
Let's add accept and reject tests for each of these.
Minor naming fix, remove unnecessary description Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Thanks @jeddy3 for the suggestion! Upon adding the test cases, I realized I didn't properly handle the selector list use-case. I've written a bit of a hacky solution that requires the selector parser, walks the tags, and then regenerates the selector; while it works, it doesn't feel like the most elegant solution. Do you have any suggestions (or places to look) for a better way to do this? |
@mattxwang Thanks for making the changes. I think it's a valid use of the selector parser. @ybiquitous may have some thoughts on the code structure as he's done lots of refactoring lately to make our code consistent across rules. |
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.
How about our transformSelector()
utility?
stylelint/lib/utils/transformSelector.js
Line 11 in a6318d4
module.exports = function transformSelector(result, node, callback) { |
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.
Thanks for making all the changes.
LGTM!
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 👍🏼
|
Closes #4065.
Not sure if I'm implementing the detect & autofix features properly; I've made some comments below. My approach is inspired by
alpha-value-notation
.