Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erring with 'Unexpected linter output' #833

Closed
matthewadams opened this issue Apr 3, 2017 · 7 comments

Comments

@matthewadams
Copy link

commented Apr 3, 2017

Similar to #465, but different.

$ node --version
v6.10.1
$ npm --version
3.10.10
$ npm i --save-dev standard@9.0.2
# ...
$ standard
standard: Unexpected linter output:

RangeError: Line number out of range (line 1005 requested, but only 1004 lines present).
    at SourceCode.getIndexFromLoc (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/util/source-code.js:389:19)
    at Object.fix (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:116:52)
    at RuleContext.report (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/rule-context.js:127:34)
    at Program:exit.allLines.reduce.concat.reduce (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:108:37)
    at Array.reduce (native)
    at EventEmitter.Program:exit (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:93:22)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.applySelector (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/util/node-event-generator.js:294:22)

If you think this is a bug in `standard`, open an issue: https://github.com/feross/standard/issues
ADA6011@pumba:~/dev/ms-accounts (next-gen *+)
$ standard --verbose
standard: Unexpected linter output:

RangeError: Line number out of range (line 1005 requested, but only 1004 lines present).
    at SourceCode.getIndexFromLoc (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/util/source-code.js:389:19)
    at Object.fix (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:116:52)
    at RuleContext.report (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/rule-context.js:127:34)
    at Program:exit.allLines.reduce.concat.reduce (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:108:37)
    at Array.reduce (native)
    at EventEmitter.Program:exit (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:93:22)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.applySelector (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (/Users/ADA6011/dev/ms-accounts/node_modules/eslint/lib/util/node-event-generator.js:294:22)

If you think this is a bug in `standard`, open an issue: https://github.com/feross/standard/issues

Trying to figure out which of my files is causing it so I can add reproducible test case...will update issue when I find it.

@matthewadams

This comment has been minimized.

Copy link
Author

commented Apr 3, 2017

Found the problem. When the last line has a single blank space, eslint bombs out:

class Foo {}
// next line has a single blank space
 

Note the last line above as a single blank space in it!

Removing the line with the single blank space allows standard & eslint to work properly.

@feross

This comment has been minimized.

Copy link
Member

commented Apr 3, 2017

Thanks for the bug report, @matthewadams.

It looks like this is a recently reported issue in ESLint. See here: eslint/eslint#8401 There's already a PR out, just waiting to get merged and released.

It appears that this error is consistently thrown if the file ends in a new line with a space character. When I delete the space, the error goes away.

It's not ideal, but at least it looks like it's possible to workaround this crash until ESLint releases a fix.

@matthewadams

This comment has been minimized.

Copy link
Author

commented Apr 3, 2017

@matthewadams

This comment has been minimized.

Copy link
Author

commented Apr 3, 2017

Ok, just saw your comment while I was entering the eslint issue. I'll go mark mine as a duplicate. #fastresponse

@feross

This comment has been minimized.

Copy link
Member

commented Apr 3, 2017

@matthewadams Haha, thanks for taking the time to file an issue with ESLint, even though it wasn't necessary in this case :) Very nice of you!

@feross

This comment has been minimized.

Copy link
Member

commented Apr 3, 2017

I think this issue can be closed, since it's not something that we can fix in standard. We'll just wait for the ESLint fix.

@feross feross closed this Apr 3, 2017

@matthewadams

This comment has been minimized.

Copy link
Author

commented Apr 3, 2017

Sure sounds good! :)

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.