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

Column start greater than line length #239

Closed
pascalpp opened this issue May 9, 2016 · 10 comments
Closed

Column start greater than line length #239

pascalpp opened this issue May 9, 2016 · 10 comments
Labels

Comments

@pascalpp
Copy link

pascalpp commented May 9, 2016

Version

4.0.0

Issue

Similar to #167

I'm getting "Error: Column start (2) greater than line length (0)" with a very simple .jscsrc config:

{
    "validateIndentation": 4,
    "validateNewlineAfterArrayElements": {
        "maximum": 4
    }
}

If I remove that second rule, validateNewlineAfterArrayElements, the error no longer occurs..

Full trace:

Error: Column start (2) greater than line length (0)
    at Object.rangeFromLineNumber (/Users/pascal/.atom/packages/linter-eslint/node_modules/atom-linter/lib/index.js:194:11)
    at /Users/pascal/.atom/packages/linter-jscs/src/linter-jscs.js:184:33
    at Array.map (native)
    at Object.lint (/Users/pascal/.atom/packages/linter-jscs/src/linter-jscs.js:179:39)
    at promises.push.Promise.then._this.emitter.emit.linter (/Users/pascal/.atom/packages/linter/lib/linter-registry.js:63:26)
    at /Users/pascal/.atom/packages/linter/lib/linter-registry.js:62:23
    at Set.forEach (native)
    at LinterRegistry.lint (/Users/pascal/.atom/packages/linter/lib/linter-registry.js:60:18)
    at /Users/pascal/.atom/packages/linter/lib/linter.coffee:98:16
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at /Users/pascal/.atom/packages/linter/lib/editor-linter.js:80:22
    at /Users/pascal/.atom/packages/linter/lib/helpers.coffee:23:18
@Arcanemagus
Copy link
Member

Arcanemagus commented May 9, 2016

Are you able to share the file you are seeing this on? Without that, or a minimal reproduction case, there isn't really anything that can be done to diagnose this.

@pascalpp
Copy link
Author

pascalpp commented May 9, 2016

i can reproduce with a very simple file that only contains:

var bar = [1, 2, 3, 4, 5, 6]

@pascalpp
Copy link
Author

pascalpp commented May 9, 2016

This also occurs with a more complex config which uses "preset": "airbnb" and some override rules. If I remove the validateNewlineAfterArrayElements rule it stops erroring. So must be something related to that rule. Will see if I can track it down.

@pascalpp
Copy link
Author

pascalpp commented May 9, 2016

Disabled linter-eslint to isolate the issue. Still occurs with just linter-jscs enabled.

Error: Column start (1) greater than line length (0)
    at Object.rangeFromLineNumber (/Users/pascal/.atom/packages/linter-jscs/node_modules/atom-linter/lib/index.js:194:11)
    at /Users/pascal/.atom/packages/linter-jscs/src/linter-jscs.js:184:33
    at Array.map (native)
    at Object.lint (/Users/pascal/.atom/packages/linter-jscs/src/linter-jscs.js:179:39)
    at promises.push.Promise.then._this.emitter.emit.linter (/Users/pascal/.atom/packages/linter/lib/linter-registry.js:63:26)
    at /Users/pascal/.atom/packages/linter/lib/linter-registry.js:62:23
    at Set.forEach (native)
    at LinterRegistry.lint (/Users/pascal/.atom/packages/linter/lib/linter-registry.js:60:18)
    at /Users/pascal/.atom/packages/linter/lib/linter.coffee:98:16
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at /Users/pascal/.atom/packages/linter/lib/editor-linter.js:80:22
    at /Users/pascal/.atom/packages/linter/lib/helpers.coffee:23:18

(I know this is a bit of a dead end with jscs merging with eslint. But I'm hoping to continue using jscs to fix some things that eslint doesn't fix yet, until eslint's rules gets some fixer updates.)

@Arcanemagus
Copy link
Member

Arcanemagus commented May 9, 2016

It looks like that rule is horribly broken with that code:
image
(Note how the JSON output references lines all the way up to line 7... on a 2 line file!)

Tested with this folder setup: linter-jscs_GH239.zip

As this is confirmed to be a bug in jscs itself, the next step is to file a bug over there (They are still working on it, the final shutdown isn't for a while from now 😉). Do you want me to file that or do you want to track it?

@pascalpp
Copy link
Author

pascalpp commented May 9, 2016

oh nice, thanks! yeah could you open the bug and link it here?

@pascalpp
Copy link
Author

pascalpp commented May 9, 2016

might be related to jscs-dev/node-jscs#2219 ?

@Arcanemagus
Copy link
Member

Possibly, I'm guessing that is just a symptom of the rules not parsing the new CST properly though. I'll file it over there and let the maintainers decide if it's a duplicate since I don't know the internals enough to say for sure.

@Arcanemagus
Copy link
Member

Filed the above issue, let's see what they say.

@Arcanemagus
Copy link
Member

Closing as fixed in jscs-dev/node-jscs#2252.

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

No branches or pull requests

2 participants