indent auto-fix does not distinguish between tabs and spaces
See original GitHub issueUsing 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:
- Created 8 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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).
Any news on this issue? I’m still having the same problem and I cannot find a solution. Thanks.