stylelint: Fix regression for disable commands and adjacent double-slash comments
Clearly describe the bug
This is a follow-up of #4913 which fixed parts of the regression by avoiding to merge double-slash comments separated by empty lines.
There is still a regression when a disabling comment is in a double-shash comment which is not separated from preceding comments with a empty line, as the stylelint-disable is not on the at the beginning of the comment anymore after merging.
Which rule, if any, is the bug related to?
Can be any rule as it is related to disabling comments
What code is needed to reproduce the bug?
See https://github.com/twbs/bootstrap/blob/5c25ea647bdc463df5a322c8248460a78305a1f4/scss/bootstrap-grid.scss#L24-L27 for an example
What stylelint configuration is needed to reproduce the bug?
Which version of stylelint are you using?
e.g. 13.7.1
How are you running stylelint: CLI, PostCSS plugin, Node.js API?
e.g. “CLI with stylelint "**/*.css" --config myconfig.json”
Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?
Yes, it’s related to SCSS double-slash comments
What did you expect to happen?
rules are properly disabled and re-enabled, as done in Stylelint 13.6
What actually happened (e.g. what warnings or errors did you get)?
Some of these control comments are ignored
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (18 by maintainers)
Commits related to this issue
- chore: temporarily disable broken stylelint properties https://github.com/stylelint/stylelint/issues/4937 — committed to wwnorton/design-system by sh0ji 4 years ago
I’ll try to release tomorrow.
Second option sound the best for me as well.
@stof could you combine two of your comments (https://github.com/stylelint/stylelint/issues/4937#issuecomment-691936726 and https://github.com/stylelint/stylelint/issues/4937#issuecomment-692598050) into one set of instructions how it should work. And gather all code examples mentioned here which we need to support.
It would help person, who’s going to fix this.
Or you could send pull request with fixed behavior and added tests 😃
I agree on trying the 2nd option first, so that most regressions on existing cases are solved while still preserving support for multiline description. And the rules about how to use command comments in scss should be clearly documented (
separate them from other comments with an empty line.)Then, if you want to remove the heuristics in a future major version, I think this would require to trigger some deprecation warning for cases where the heuristics enters into action to prevent merging, so that users can discover these cases (could even be something fixed automatically by adding empty lines).