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.

Indent: Issue with a wrong indented start statement

See original GitHub issue

Eslint version: master Parser: default

Code:

/* eslint indent: [2, 2] */
if (true){
    for (;;){ // <-\n
      b(); // <-\n
  }
}

Current output:

3:5 - Expected indentation of 2 space characters but found 4.
5:3 - Expected indentation of 4 space characters but found 2.

Expected output:

3:5 - Expected indentation of 2 space characters but found 4.
4:7 - Expected indentation of 4 space characters but found 6.

Note: This also trips the fix for such code.

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
fregantecommented, Jul 2, 2016

I’m not sure if it’s the same thing, but I found this issue with --fix:

eslint file.js --rule "indent: [error, tab]" --fix

Input:

if(true) {
    foo(); // tab
  bar(); // 2 spaces
}

Output

if(true) {
    foo(); // tab
                                        bar(); // 2 spaces, 10 tabs
}

Expected output

if(true) {
    foo(); // tab
    bar(); // tab
}
0reactions
trongthanhcommented, Aug 8, 2016

I can confirm with @bfred-it that attempt to convert indent from spaces to tabs mess up all of the files.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Indentation Error in Python | How to Solve it - Edureka
This article will provide you with a detailed understanding of Indentation error in Python and the solutions to avoid the same.
Read more >
How to fix indentation Error in Python - Numpy Ninja
The indentation error can occur when the spaces or tabs are not placed properly. There will not be an issue if the interpreter...
Read more >
expected an indented block” Error in Your Python Code
The “IndentationError: expected an indented block” error is something you're likely to see when you first start using Python, especially if you' ...
Read more >
How does Indentation Error Work in Python? - eduCBA
Python is a procedural language. The indentation error can occur when the spaces or tabs are not placed properly. There will not be...
Read more >
What should I do with "Unexpected indent" in Python?
"How do I rectify the error ..."? By identifying where it occurred and fixing the cause of the error. In this case, by...
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