Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add selector-combinator-*list rules #3088
Can we add a couple tests for combinators without spaces and where " " is not specified as a combinator?
I'm thinking that POSSIBLY
-whitelist should assume " " is a valid combinator and add it automatically to the config? As a user, it's so common that I'm not even sure I think about it. Could be a source of confusion resulting in bug reports we have to sift through later ... (this may go against the core values of stylelint and I'm good on it either way, just wanted to throw it out there ...)
I'm going to push back a bit on allowing RegExp's ... most combinators are just a single special character (+, ~) and I don't see this feature being all that useful. Puts cognitive load on the user and maintainers for possibly not much gain. I could be convinved otherwise, I just don't see a real use for it.
That's a fair point. I originally intended to add RegExps for controlling what whitespace is allowed for descendant combinators. I've updated the tests and examples to show this, rather than use the child and piercing combinators.
I think there is a use case for not allowing the descendant combinator e.g. a completely flat specificity graph or when (exclusively) using CSS Modules'
Having said all that, perhaps it is better to split this up:
The latter two would ignore whitespace descendant combinators and not accept RegExp.
What do you think?
Fair. I'm sold on this the way it is. Having to create another rule and to handle an exception to this one seems like a waste. Maybe just make sure the README specifically mentions that " " is itself a combinator and needs to be whitelisted explicitly.
Yeah, this seems like a different concern to me. Stylistic rather than functional.
Ummm... I think you've (despite your conclusion) talked me out of not breaking the rule up.
This rule is unique amongst the
That's a good point. Keeping support for the descendant combinator in makes this rule half functional and half stylistic.
referenced this pull request
Jan 1, 2018
I agree with @CAYdenberg. RegExp here might be redundant.
I believe these rules should be functional and not about the style of code.
To avoid using RegExp and avoid stylistic concerns we could replace
That's a great idea. It does away with the need for the
I'll make the change now.
Jan 6, 2018
@CAYdenberg please, add a changelog item when PR merged https://github.com/stylelint/stylelint/blob/master/docs/developer-guide/pull-requests.md