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.

eol-last with whitespace breaks everything

See original GitHub issue

Tell us about your environment

  • ESLint Version: 5.11.1
  • Node Version: 10.11.0
  • npm Version: 6.9.0

What parser (default, Babel-ESLint, etc.) are you using? default with VSCode plugin Please show your full configuration:

  "env": {
    "es6": true,
    "node": true,
    "mocha": true
  "extends": [
  "globals": {
    "integrations": true
  "ecmaFeatures": {
    "jsx": true,
    "node": true
  "plugins": [
  "rules": {
    "no-use-before-define": 2,
    "symbol-description": 0

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

const init = () => {
  const dsada = 1

What did you expect to happen? I expected it to show me all linter errors.

What actually happened? Please include the actual, raw output from ESLint. It only shows some unrelated linter errors. After removing whitespace from last line it shows all errors

Are you willing to submit a pull request to fix this bug? No

Issue Analytics

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

github_iconTop GitHub Comments

Sahtaircommented, Apr 9, 2019

@platinumazure here is the stack trace from the output. As you can see the provided demo is only 5 lines but it keeps requesting line 6 when a whitespace is on line 5. It is a real nightmare trying to figure out why our linter is not working as intended with this issue.

[Error - 3:59:18 PM] ESLint stack trace:
[Error - 3:59:18 PM] RangeError: Line number out of range (line 6 requested, but only 5 lines present).
    at SourceCode.getIndexFromLoc (/Users/jurest/Projects/smart-stack/node_modules/eslint/lib/util/source-code.js:389:19)
    at Object.fix (/Users/jurest/Projects/smart-stack/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:116:52)
    at (/Users/jurest/Projects/smart-stack/node_modules/eslint/lib/rule-context.js:127:34)
    at Program:exit.allLines.reduce.concat.reduce (/Users/jurest/Projects/smart-stack/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:108:37)
    at Array.reduce (<anonymous>)
    at EventEmitter.Program:exit (/Users/jurest/Projects/smart-stack/node_modules/eslint/lib/rules/no-multiple-empty-lines.js:93:22)
    at EventEmitter.emit (events.js:187:15)
    at NodeEventGenerator.applySelector (/Users/jurest/Projects/smart-stack/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (/Users/jurest/Projects/smart-stack/node_modules/eslint/lib/util/node-event-generator.js:294:22)
    at NodeEventGenerator.leaveNode (/Users/jurest/Projects/smart-stack/node_modules/eslint/lib/util/node-event-generator.js:317:14)
platinumazurecommented, Jun 10, 2019

I was hoping I or someone else would have a chance to try to recreate the bug before the issue got auto-closed (again). I apologize for not having had a chance to do it myself.

@eslint/eslint-team Could someone please try recreating this bug with the configuration and source code from the original post?

Read more comments on GitHub >

github_iconTop Results From Across the Web

eol-last: Add "none" option to enforce no line break at end of file
What did you expect to happen? If the file ends in a single newline character, this should be a linting error. What actually...
Read more >
eol-last - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
enforce consistent line breaks inside function parentheses ...
This rule has a single option, which can either be a string or an object. "always" requires line breaks inside all function parentheses....
Read more >
html - Why does the browser renders a newline as space?
Browsers condense multiple whitespace characters (including newlines) to a single space when rendering. The only exception is within <pre> ...
Read more >
Reduce smelling code and detect JavaScript issues with ESLint
Incorrectly placed spaces, non-standard line breaks, ... Not all Linters analyze source code for performance and security, but some do.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found