stylelint: Fix configuration comments within selector and value lists being ignored
I was told in https://github.com/rstacruz/stylelint-rscss/issues/11#issuecomment-350542523 that this is a problem in stylelint rather than stylelint-rscss.
Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?
&:checked ~ .single-steward-header, // stylelint-disable-line rscss/class-format
&:checked ~ .toggle {
//
}
still triggers an error for the first line:
Invalid element name: '.single-steward-header' rscss/class-format
ATM you have to do this instead:
// stylelint-disable
&:checked ~ .single-steward-header,
// stylelint-enable
&:checked ~ .toggle {
//
}
Which rule, if any, is this issue related to?
stylelint-disable-line
What CSS is needed to reproduce this issue?
See above.
What stylelint configuration is needed to reproduce this issue?
{
"extends": [
"stylelint-rscss/config"
]
}
Which version of stylelint are you using?
8.2.0
How are you running stylelint: CLI, PostCSS plugin, Node API?
Webpack with stylelint-webpack-plugin.
Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?
Yes, SCSS.
What did you expect to happen?
No warnings to be flagged.
What actually happened (e.g. what warnings or errors you are getting)?
The following warnings were flagged:
Invalid element name: '.single-steward-header' rscss/class-format
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 26 (19 by maintainers)
@romainmenke Thanks for describing the solution. If we can maintain backward compatibility with other syntaxes like SCSS, there will be no problems.
And for now, I don’t think supporting non-standard comments like
//is necessary. We can still use/* */comments on such non-standard syntaxes, and we should usually avoid introducing more complexity than needed. Thanks for considering a possible solution. Let’s revisit it if people would strongly request//.The direction of #7839 sounds good to me. 👍🏼
@ybiquitous We will continue to use the
Commentnode wherever possible. We also won’t change anything about things that already work.The proposed change only adds an extra step where we also check other parts of the AST for comments.
For example:
But I do share your concerns about other syntaxes. This won’t work because
// stylelint-disable-lineisn’t a standard CSS comment.It also doesn’t work today, but it is still possible surprising given that this would work with the proposed change:
@ybiquitous https://github.com/postcss/postcss/issues/1145#issuecomment-1397999466
I will once this issue is fixed. i.e. there are no bugs right now