-
-
Notifications
You must be signed in to change notification settings - Fork 927
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
Fixed: selector-type-no-unknown
is now ignore /deep/
shadow-piercing descendant combinator.
#2508
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.
Tests look good.
I've made a request to use a util.
@@ -89,6 +89,7 @@ const rule = function (actual, options) { | |||
|| svgTags.indexOf(tagNameLowerCase) !== -1 | |||
|| keywordSets.nonStandardHtmlTags.has(tagNameLowerCase) | |||
|| mathMLTags.indexOf(tagNameLowerCase) !== -1 | |||
|| tagNameLowerCase === "/deep/" |
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.
Let's move this to the isStandardSyntaxTypeSelector
util. It's where we build on top of postcss-selector-parser
.
Also, let's return false
for all reference combinators, not just /deep/
i.e. return false
for anything that starts and ends with a /
.
Be sure to comment the line e.g.
// Reference combinators like `/deep/`
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.
@jeddy3 good solution.
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.
@jeddy3 one remarks: remove tests on invalid /deeeps/
(i think it is not related to this rules).
…mbinators selectors.
4a40256
to
30311a7
Compare
/cc @jeddy3 |
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
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.
One question, otherwise seems fine to me.
description: "shadow-piercing descendant combinator", | ||
}, { | ||
code: ".foo /for/ .bar {}", | ||
description: "reference combinators", |
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.
What is a "reference combinator"?
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.
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.
@davidtheclark but seem it is deprecated selector, i don't see infomation about this in other spec, btw some project use /deep/
and be good just ignore this
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.
👍
Added to changelog:
|
I still don't understand how to implement this rule in my project 😭 but i need to as we always use |
@EmilyRosina I don't believe this PR is related to the Please create a new issue, following the bug template, if you're getting an unexpected violation. |
@jeddy3 I just wanted a way to tell the linter that we want to see an error if |
You can use the {
"rules": {
"selector-combinator-blacklist": [">>>"],
}
} The |
Ah ok, so there is no way to do this straight up with stylelint atm 😞 Thanks anyway 👍 |
You can easily do it by writing a plugin. The plugin system exists for exactly these types of scenarios. |
It looked a little in-depth on first glance, but maybe it's not as bad as i think 😅 |
#2506
No, it's self explanatory.
Maybe need update docs ❓ or just add example to
valid
❓