-
-
Notifications
You must be signed in to change notification settings - Fork 938
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 selector-pseudo-element-*list rules #3087
Conversation
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.
Good job, @jeddy3!
It’s been a while since I had the time to write some actual stylelint code, especially adding new rules.
Feels good, right? :)
Both rules checking CSS3 pseudo-elements only. CSS2 also has :before
and :after
pseudo-elements. I see two options: support these selectors, or add a note about this limitation to readme.
return (root, result) => { | ||
const validOptions = validateOptions(result, ruleName, { | ||
actual: blacklist, | ||
possible: [_.isString] |
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.
It should also check for _.isRegExp
according to readme. It would be great to have RegExp in tests as well. Both as a string and as RegExp.
The same comment applies to the second rule.
@hudochenkov Thanks for the feedback. I've made the changes. I'm about to head out, so I've pushed up what I've got... and there's a flow error. Any flow pros know how to fix this? Setting the type to
|
Right, so flow doesn't understand that Try using if (comparison.test) {
// now we know this is RegExp and we can CALL comparison.test
} Make sense? |
Yes, thanks very much @CAYdenberg This PR is ready for review again. |
@hudochenkov Restarted travis and now CI is green. |
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.
Good job!
@stylelint/core Ready for a 2nd review |
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
|
Closes #3014
It’s been a while since I had the time to write some actual stylelint code, especially adding new rules.
I found myself reaching for the
selector-pseudo-element-whitelist
rule on my current project, so figured I’d add it.