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
Deprecate resolveNestedSelectors
option of selector-class-pattern
#7482
Comments
I think an exploratory review of all the rules is a preliminary to the deprecation. @kristerkari what's your opinion on
? |
Good point. Agree with this idea. |
When I walk through all the rules quickly, the following rules seem to be related to non-standard syntaxes like SCSS:
see #7482 (comment) Affected by a rule option: Affected by an undocumented behavior of |
Extending such rules in 3rd-parties (e.g. |
Thanks for the ping 👍 I don't mind moving things to |
@kristerkari Your concern makes sense. I can't get a nice idea for now. 😓 Probably, we should have supported the |
We typically provide secondary options, like We can change these rules to use a spec-based transformer, i.e. one that desugars to
This rule is for a hack/trick in standard CSS where you can use double-slashes to put an invalid value into the stylesheet, effectively creating an "ignore next construct" comment. It's a dodgy pattern, so we have a rule to disallow it. |
Adding an
Ah, I see it. I didn't read the rule README carefully. 😓 |
We can put together a PoC PR to test the transformer secondary option theory (branching off #7496). If it's viable, then we have a way forward that'll let us modernise our support spec compliance and also help plugin authors reuse the rules. |
What is the problem you're trying to solve?
The
resolveNestedSelectors
secondary option of theselector-class-pattern
rule can resolve Sass-like identifier concatenation (e.g.&__foo
), but this behavior is against the current rule policy of "standard CSS syntax only":stylelint/docs/developer-guide/rules.md
Lines 11 to 13 in eebb786
The CSS Nesting spec forbids such a syntax explicitly:
What solution would you like to see?
I think 3rd-party plugins like
stylelint-scss
should provide this option instead. So, I suggest deprecating the option and finally removing it in the next major version.For example:
Currently,
selector-class-pattern
supports the standard nesting withresolveNestedSelectors: false
(default). See the demo. So, I think most users would not have trouble without this option.In addition, from the point of view of a maintainer, the following code in the rule would be no longer necessary and be able to be much simpler, including a dependency on
postcss-resolve-nested-selector
:stylelint/lib/rules/selector-class-pattern/index.mjs
Lines 63 to 71 in eebb786
See also
postcss-resolve-nested-selector
is used inselector-*
#6234The text was updated successfully, but these errors were encountered: