Fix incorrect position for Less in declaration-no-important
See original GitHub issueClearly describe the bug
For files with specifically formatted comments, the declaration-no-import
rule reports errors at the incorrect location in the document. Here’s one example:
Which rule, if any, is the bug related to?
I was able to reproduce with declaration-no-import
, though I can’t rule out that something similar doesn’t happen with other rules.
What code is needed to reproduce the bug?
.tab {
// 'tis a comment with an apostrophe!
outline-width: 0 !important;
}
/** 'tis another comment with an apostrophe! */
This is about as minimal as I could get and still reproduce it. A few things to note:
- The problem does not occur if the first comment is changed from a LESS double-slash comment to
/* ... */
- The problem does not occur if the single quote (
'
) is removed from either comment
What stylelint configuration is needed to reproduce the bug?
{
"rules": {
"declaration-no-important": true
}
}
Which version of stylelint are you using?
13.13.1
How are you running stylelint: CLI, PostCSS plugin, Node.js API?
For the reproduction, I invoked the stylelint CLI with stylelint path/to/file.less
Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?
Yes, it appears to be related to LESS double-slash comments (// ...
)
What did you expect to happen?
I expected the declaration-no-important
rule to flag an error on the !important
keyword on line 3.
What actually happened (e.g. what warnings or errors did you get)?
The error was flagged on the word “with” on line 2.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top GitHub Comments
Aaaaaand my attempt at a fix: https://github.com/shellscape/postcss-less/pull/164
I reported this upstream: https://github.com/shellscape/postcss-less/issues/163. Still trying to work on a fix for it!