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.

Error Thrown: Line number out of range

See original GitHub issue

Tell us about your environment

  • ESLint Version: 3.19.0
  • Node Version: 7.7.3
  • npm Version: 4.4.4

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

module.exports = {
    "extends": "standard",
    "plugins": [
        "standard",
        "promise"
    ]
};

What did you do? Please include the actual source code causing the issue.

eslint --fix */**

What did you expect to happen? Successful execution.

What actually happened? Please include the actual, raw output from ESLint.

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
honomoacommented, Nov 6, 2017

I can reproduce by add only two spaces at last line in any file.

1reaction
HoraceShmoracecommented, Apr 3, 2017

Thanks for that insight, @not-an-aardvark.

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.

Unfortunately, this pre-existing codebase in which I’m working oddly seems to have a lot of files that end in a new line + space.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint Error: Line number out of range - Stack Overflow
It appears that this error is consistently thrown if the file ends in a new line with a space character. When I delete...
Read more >
List Index Out of Range – Python Error Message Solved
In this article you'll see a few of the reasons that cause the list index out of range Python error. Besides knowing why...
Read more >
RangeError - JavaScript - MDN Web Docs
The RangeError object indicates an error when a value is not in the set or range of allowed values. Description. A RangeError is...
Read more >
C# Exception Guide: ArgumentOutOfRangeException
The ArgumentOutOfRangeException exception is thrown when the value of an argument is outside the expected range of values as defined by the ...
Read more >
Modern C++ best practices for exceptions and error handling
Program errors are often divided into two categories: Logic errors that are caused by programming mistakes, for example, an "index out of range" ......
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