question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix incorrect position for Less in declaration-no-important

See original GitHub issue

Clearly 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:

Screen Shot 2021-08-09 at 4 16 32 PM

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nwalters512commented, Aug 10, 2021
0reactions
nwalters512commented, Aug 10, 2021

I reported this upstream: https://github.com/shellscape/postcss-less/issues/163. Still trying to work on a fix for it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect Tax Return - Taxpayer Advocate Service - IRS
Some rejected returns are caused by incorrectly entering a Social Security Number or other taxpayer identification number. Usually you can correct the error...
Read more >
Declaring character encodings in HTML - W3C
Question. How should I declare the encoding of my HTML file? You should always specify the encoding used for an HTML or XML...
Read more >
The Stylistic Artistry of the Declaration of Independence
Second, once it is granted that Americans and Englishmen are two distinct peoples, the conflict between them is less likely to be seen...
Read more >
Glossary of Tax Terms - OECD
ESTIMATED ASSESSMENT -- For income tax purposes, where the records kept, particularly by small traders, are inadequate for a precise calculation of tax...
Read more >
How to Handle the Incompatible Types Error in Java - Rollbar
This error implies that the Java compiler is unable to resolve a ... and simply correcting the type declaration solves the problem (Fig....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found