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

Error: Column start (15) greater than line length (13) #166

Closed
smlombardi opened this issue Apr 20, 2016 · 29 comments
Closed

Error: Column start (15) greater than line length (13) #166

smlombardi opened this issue Apr 20, 2016 · 29 comments

Comments

@smlombardi
Copy link

The very first time I tried to use this:

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

I had to disable it.

@Arcanemagus
Copy link
Member

Can you please share your stylelint configuration, as well as the file you were editing (in a state that triggers that warning!).

This is almost certainly a bug in stylelint itself, so tracking this down will help everyone 😉.

@davidtheclark
Copy link
Contributor

davidtheclark commented Apr 20, 2016

@smlombardi Are you on Windows? There is a known Windows bug in some rules that might cause this: stylelint/stylelint#1081. We are trying to address it. Figuring out which rules cause the problem will speed up the fix. Thanks.

@Arcanemagus
Copy link
Member

@davidtheclark The paths in the stack trace are from OSX I believe, but they might still be editing a CRLF file.

@davidtheclark
Copy link
Contributor

True.

@smlombardi
Copy link
Author

On OSX. File uses Unix LF. I don't have a stylelint config yet, I set the package to use Standard for starters. I will try and get the exact file I tested on.

@smlombardi
Copy link
Author

I don't know if this is related, but I installed it on my other MBP and when I open a scss file and try to force an error by deleting a semicolon I get this

screen shot 2016-04-20 at 6 09 56 pm

@davidtheclark
Copy link
Contributor

Huh ... I just installed the latest linter-stylelint version, use stylelint-config-standard in my own config, and don't have the same Atom problems. Please double-check which versions of each part you are using.

@Arcanemagus
Copy link
Member

@smlombardi Without the files that are triggering these errors it's rather difficult to diagnose this. Whenever you see an error pop up can you save the file in that state and then attach it here?

If the files are unable to be shared publicly you can direct message them to me on Atom's Slack.

@smlombardi
Copy link
Author

smlombardi commented Apr 20, 2016

The file above is http://cl.ly/00450N331f24/_leftMenu.scss

This is Atom 1.8b2. Here's the sequence:

apr-20-2016 18-24-40

It correctly flags some errors, but then I delete a semi and the error is thrown.

@Arcanemagus
Copy link
Member

Looks like that later one is a bug in stylelint:
image

Can you report that on their issue tracker to get that tracked down further? Here is a file that contains a reproduceable environment: linter-stylelint_GH166.zip

If you have a file that can reproduce the first issue we can start the process of tracking that down as well!

@davidtheclark
Copy link
Contributor

@smlombardi I think the "Unexpected space" issue is being caused by a dependency of stylelint stumbling on the nested selectors. I'll try to see what can be done.

@davidtheclark
Copy link
Contributor

Actually, on looking closer, I'd suggest that this "Unexpected space" thing might not be a bug at all. I believe that without that semicolon you're providing is invalid, unparseable syntax, so it's going to error.

@smlombardi
Copy link
Author

Well, isn't a missing semicolon a common programmer error? scss-lint handles it, reports the error without an error dialog. For that reason I frequently use deleting a semicolon as a quick way to test that a linter is properly installed on my part.

@smlombardi
Copy link
Author

smlombardi commented Apr 21, 2016

http://cl.ly/1X2R2Q1C0p36/documentation.scss is a file that gives the error originally reported (at least on my work MBP). I deleted the semicolon at the end of line 27. stylelint and scss-lint report the error in the status bar correctly. I put the semicolon back and I get

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

and the line where the error was is still underlined and the error remains in the statusbar, although it's now fixed.

@Arcanemagus
Copy link
Member

Marking this as closed since both bugs are in stylelint and have been reported there.

@smlombardi
Copy link
Author

If this is fixed in stylelint 6.0.3, when does it get pulled into the Atom linter?

@Arcanemagus
Copy link
Member

It's fixed in v6.1.0, which I'm just about to merge here 😉.

@Arcanemagus
Copy link
Member

FYI, the changelog lists when new versions of stylelint are included here.

@Arcanemagus
Copy link
Member

@smlombardi I've just released v2.6.0 of this package which includes stylelint v6.1.0. This should fix that issue for you 😉.

@smlombardi
Copy link
Author

Outstanding!

@PhiLhoSoft
Copy link

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.
Stylelint-issue.zip

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

@smlombardi
Copy link
Author

This still happens while editing a scss file...

screen shot 2016-04-25 at 2 31 32 pm

@Arcanemagus
Copy link
Member

@smlombardi Does stylelint@6.2.0 report the same thing?

@PhiLhoSoft as each of these errors can be caused by any number of things can you please file a new issue so we can track down your specific case of why stylelint is sending bad column data to linter-stylelint?

@PhiLhoSoft
Copy link

OK, no problem.
Even though my report is more related to the original issue that the latest reported by @smlombardi... 😄

For the record, I also saw these space errors, while typing a new rule (with 6.2.0), but was not able to reproduce it.

@smlombardi
Copy link
Author

This is a real pain. Every time I type a new rule in a selector, every character after I type the colon triggers an error.

screen shot 2016-04-26 at 9 29 31 am

@Arcanemagus
Copy link
Member

@davidtheclark Is this a bug in stylelint that that message is being thrown back with no line? The only way that message should show is if the stylelint Promise throws an error, and that error has no line associated with it.

@davidtheclark
Copy link
Contributor

It's worth raising in stylelint and seeing if we can reproduce it from the CLI. I think that what's happening is that postcss-selector-parser is throwing this error because it's running into some non-standard SCSS construct, that error is being thrown and Atom linter is just displaying it the way that it displays errors. I'd think that the error would be caught within the Promise, though, so I don't know exactly what's going on .... but chances our we may need to wrap usage of postcss-selector-parser in a try-catch or something to prevent this. We'll see.

@Arcanemagus
Copy link
Member

It's being displayed here, within the error function of the promise. I'll file something on stylelint in a tiny bit.

@Arcanemagus
Copy link
Member

Arcanemagus commented Apr 26, 2016

Narrowed it down to selector-type-case all three selector-*-case rules, the above issue has all the details 😉.

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