-
-
Notifications
You must be signed in to change notification settings - Fork 929
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: ignore less guards in selector-descendant-combinator-no-non-space
.
#2557
Conversation
selector-descendant-combinator-no-non-space
.
Does this heuristic introduce a false negative for this valid CSS? when a { } Where |
@jeddy3 hm, right, let's add more complexly check |
d802938
to
2ee2510
Compare
/cc @jeddy3 |
Thanks. Can we add get |
2ee2510
to
5267965
Compare
/cc @jeddy3 done |
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
lib/utils/isStandardSyntaxRule.js
Outdated
@@ -37,6 +37,11 @@ module.exports = function (rule/*: Object*/)/*: boolean*/ { | |||
return false | |||
} | |||
|
|||
// Less guards | |||
if ((/when.*?\(.*?\)/).test(selector)) { |
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.
only a whitespace can separate when
and (
, right? when\s+\(.*?\)
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 no, allow use when not (@variable = true)
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 think the regexp should account for this limited scenario, instead of allowing for any arbitrary characters between when
and (
.
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 in theory allow when not not (@variable = true)
(does not make sense)
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.
@evilebottnawi: You can make the regexp as complicated as you think necessary — but I think it's not great to make it so simple that it might raise false positives.
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 What solution is better to use here?
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 /when\s+(not\s+)*\(/
? I think it will just take writing tests for what should and should not work and fiddling with the regexp until that's what happens.
5267965
to
a6efe2c
Compare
/cc @davidtheclark |
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.
👍
Changelog:
|
#2110
No, it's self explanatory.