-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build: add stylelint rule to prevent usage of /deep/ #4841
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
Conversation
Adds a custom Stylelint rule to prevent usages of `/deep/` inside selectors. Relates angular#4726.
|
||
const ruleName = 'material/selector-no-deep'; | ||
const messages = stylelint.utils.ruleMessages(ruleName, { | ||
expected: selector => `Usage of the /deep/ in "${selector}" is now allowed`, |
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.
"now allowed" -> "not allowed"
if (rule.parent.type === 'rule' && | ||
isStandardSyntaxRule(rule) && | ||
isStandardSyntaxSelector(rule.selector) && | ||
rule.selector.indexOf('/deep/') > -1) { |
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.
rule.selector.includes('/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.
I'm not sure what the support for that one is in Node. It's not terribly good in browsers.
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's fine in node. I use it all the time in our dgeni tooling
Addressed the feedback @jelbourn. |
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
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds a custom Stylelint rule to prevent usages of
/deep/
inside selectors.Relates #4726.