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 auto-fix does not distinguish between tabs and spaces

See original GitHub issue

Using ESLint 1.6.0, but I see the logic issue in master as well.

Looks like indent’s auto-fix only knows how to remove or add indent characters. It doesn’t seem to detect that, for example, if tabs are expected but a file has spaces, then the whole space range should be replaced with the whole expected tab range.

As a result, I get the following issue (using . to represent space and \t to represent tab):

Input:

/* eslint indent: [2, "tab"] */
var input = {
....key: "value"
};

Expected output:

var input = {
\tkey: "value"
};

Actual output: var input = { …\tkey: “value” };

<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:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
platinumazurecommented, Sep 21, 2016

@demian85 As you can see, the issue has been closed by a merged pull request, so this is fixed on master. Please look forward to the next release (eslint@3.6.0 this Friday).

0reactions
demian85commented, Sep 21, 2016

Any news on this issue? I’m still having the same problem and I cannot find a solution. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - "inconsistent use of tabs and spaces in indentation"
For example, I have configured my editor to show transparent tabs and visible spaces because I use tabs to indent code.
Read more >
eslint/eslint - Gitter
I am using the --fix parameter to autofix most of the mistakes. ... According to that page, no-mixed-spaces-and-tabs is not autofixable. thinkpadder1.
Read more >
indent - 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 >
Indent with tabs or spaces? I wish I didn't need to know.
Non-indent formatting is one of the biggest reasons why many people choose spaces over tabs. For a range of reasons, tabs are more...
Read more >
Reformat code | IntelliJ IDEA Documentation
If anything is not defined in .editorconfig , it's taken from the project settings. ... On the appropriate language page, on the Tabs...
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