Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Error: Column start (20) greater than line length (1) #176

Closed
PhiLhoSoft opened this issue Apr 26, 2016 · 11 comments
Closed

Error: Column start (20) greater than line length (1) #176

PhiLhoSoft opened this issue Apr 26, 2016 · 11 comments

Comments

@PhiLhoSoft
Copy link

PhiLhoSoft commented Apr 26, 2016

Yes, it is an error similar to the one reported in #166 where I initially posted.
As asked, I create a new issue... 😄

First, the file with a small file reproducing the problem, and the config.
Stylelint-issue.zip

I originally wrote:

Windows 7, Atom 1.7.2, atom-stylelint 2.6.0 (I uninstalled it and re-installed it just in case the upgrade went bad).
I still see the issue.

Error: Column start (20) greater than line length (1)
at Object.rangeFromLineNumber (C:\Users\plhoste.atom\packages\linter-eslint\node_modules\atom-linter\lib\index.js:194:11)
at C:\Users\plhoste.atom\packages\linter-stylelint\node_modules\lazy-req\index.js:20:26
at createRange (C:/Users/plhoste/.atom/packages/linter-stylelint/lib/index.js:41:10)
at C:/Users/plhoste/.atom/packages/linter-stylelint/lib/index.js:80:14
at Array.map (native)
at stylelint.lint.then.error.type (C:/Users/plhoste/.atom/packages/linter-stylelint/lib/index.js:76:38)

This one appeared right after I installed (back) the package and went to a .scss file.

Actually, I could pinpoint what triggers it.
It appears as soon as I put a line comment in a .scss file, after a selector.
Line comments are harmless after variable declarations, or plain CSS declarations, but fatal after a selector.

I join a sample SCSS file and my config file, hoping you can reproduce it.
(see above)

See the comment // Triggers the bug!
Remove it, no problem. Paste it back, the error above appears after a second or two.

In other words:

button
{
  color: white; // #FFF
}

is OK, while

button // boom!
{
  color: white; // #FFF
}

triggers the above error.
As a workaround, I have moved these comments before the selectors...

Thanks for your useful tool.

@davidtheclark
Copy link
Contributor

The most helpful thing is figuring out which specific rule is triggering it, if you can.

@PhiLhoSoft
Copy link
Author

PhiLhoSoft commented Apr 26, 2016

OK, by progressively cutting down the rule list, starting by the less likely to be the culprit, I got a suspect:

block-opening-brace-newline-before: "always-multi-line"

If I use the "never-multi-line" value, for example, and use the so called "one true brace" style, it doesn't crash.

Also it happens only in Scss mode, doesn't happen in .css files.

@davidtheclark
Copy link
Contributor

Awesome, thanks! It happens in SCSS files because of the way // comments are parsed. We caught a few of these but apparently there's at least one more. Can you please copy this info and paste it into an issue at stylelint?

@PhiLhoSoft
Copy link
Author

OK. I first thought it happened only with your plugin, but indeed now I can reproduce it with the command line. Well, more exactly, I get the spurious error:

sample.scss
 2:14  ×  Expected newline before "{" of a multi-line block   block-opening-brace-newline-before

Not sure why it makes your plugin to crash instead of reporting this "error".

@Arcanemagus
Copy link
Member

The problem is that stylelint is feeding invalid data back to us, in this case it's claiming that there is an error on column 20 on a line that only has 1 column (probably the wrong line is being reported back).

We have this check in there to catch when linters themselves have a bug and are feeding invalid data back to us, and it's resulted in many bugs in lots of different linters being found (and fixed!). Getting the linters working better is worth a little bit of annoyance here I would say, although we should work more on limiting the amount of times the error gets thrown.

@davidtheclark
Copy link
Contributor

Yeah. @PhiLhoSoft put in a good issue at stylelint to address this.

@PhiLhoSoft
Copy link
Author

Frankly, this kind of error has no interest for the end user...
I suggest to just log it on the console, and to avoid notifications. If possible.

@Arcanemagus
Copy link
Member

Just an FYI, this is fixed in stylelint/stylelint#1168, just waiting on a release to include it here.

@diagramatics
Copy link

Seems like Stylelint 6.3.1 has included the fix for this and you've just merged in #187. Any ETA for the next version release?

@Arcanemagus
Copy link
Member

@diagramatics Waiting on integration of the HTML CSS extraction before releasing, if #142 hasn't been fixed up by the time I wake up tomorrow that's the first thing I'll be doing.

@Arcanemagus
Copy link
Member

v2.8.0 is now published 🎉.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants