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

Merged
merged 1 commit into from Jun 5, 2017

Conversation

3 participants
@evilebottnawi
Member

evilebottnawi commented May 7, 2017

Which issue, if any, is this issue related to?

#2110

Is there anything in the PR that needs further explanation?

No, it's self explanatory.

@evilebottnawi evilebottnawi changed the title from Fixed: ignore less guards in `selector-descendant-combinator-no-non-s… to Fixed: ignore less guards in `selector-descendant-combinator-no-non-space`. May 7, 2017

@jeddy3

This comment has been minimized.

Member

jeddy3 commented May 8, 2017

Does this heuristic introduce a false negative for this valid CSS?

when     a { }

Where when is an unknown, yet valid, type selector.

@evilebottnawi

This comment has been minimized.

Member

evilebottnawi commented May 9, 2017

@jeddy3 hm, right, let's add more complexly check

@evilebottnawi evilebottnawi force-pushed the issue-2110 branch from d802938 to 2ee2510 May 13, 2017

@evilebottnawi

This comment has been minimized.

Member

evilebottnawi commented May 13, 2017

/cc @jeddy3

@jeddy3

This comment has been minimized.

Member

jeddy3 commented May 13, 2017

Thanks. Can we add get truthy tests in the util for a when {} and when a {} please?

@evilebottnawi

This comment has been minimized.

Member

evilebottnawi commented May 13, 2017

/cc @jeddy3 done

@jeddy3

jeddy3 approved these changes May 13, 2017

LGTM

@@ -37,6 +37,11 @@ module.exports = function (rule/*: Object*/)/*: boolean*/ {
return false
}
// Less guards
if ((/when.*?\(.*?\)/).test(selector)) {

This comment has been minimized.

@davidtheclark

davidtheclark May 13, 2017

Contributor

only a whitespace can separate when and (, right? when\s+\(.*?\)

This comment has been minimized.

@evilebottnawi

evilebottnawi May 15, 2017

Member

@davidtheclark no, allow use when not (@variable = true)

This comment has been minimized.

@davidtheclark

davidtheclark May 15, 2017

Contributor

I think the regexp should account for this limited scenario, instead of allowing for any arbitrary characters between when and (.

This comment has been minimized.

@evilebottnawi

evilebottnawi May 15, 2017

Member

@davidtheclark in theory allow when not not (@variable = true) (does not make sense)

This comment has been minimized.

@davidtheclark

davidtheclark May 15, 2017

Contributor

@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.

This comment has been minimized.

@evilebottnawi

evilebottnawi May 15, 2017

Member

@davidtheclark What solution is better to use here?

This comment has been minimized.

@davidtheclark

davidtheclark May 16, 2017

Contributor

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.

@evilebottnawi evilebottnawi force-pushed the issue-2110 branch from 5267965 to a6efe2c Jun 1, 2017

@evilebottnawi

This comment has been minimized.

Member

evilebottnawi commented Jun 1, 2017

@davidtheclark

👍

@jeddy3 jeddy3 merged commit 5796ac4 into master Jun 5, 2017

4 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.01%) to 95.479%
Details

@jeddy3 jeddy3 deleted the issue-2110 branch Jun 5, 2017

@jeddy3

This comment has been minimized.

Member

jeddy3 commented Jun 5, 2017

Changelog:

  • Fixed: selector-descendant-combinator-no-non-space now ignores Less guards (#2557).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment