Bug: `indent` is not reporting on wrong indentation
See original GitHub issueEnvironment
Node version: latest npm version: latest Local ESLint version: v8.6.0 Global ESLint version: n/a Operating System: Mac
What parser are you using?
Default (Espree)
What did you do?
Configuration
indent: [2, "tab"]
See demo
'use strict';
// https://262.ecma-international.org/11.0/#sec-isunclampedintegerelementtype
/* eslint indent: [2, "tab"] */
module.exports = function IsUnclampedIntegerElementType(type) {
return type === 'Int8'
|| type === 'Uint8'
|| type === 'Int16'
|| type === 'Uint16'
|| type === 'Int32'
|| type === 'Uint32';
};
Note how the return
correctly has a tab, but the ||
lines all have spaces. eslint does not warn on this.
What did you expect to happen?
eslint should warn on spaces being used for indentation, when configured to “tab”.
What actually happened?
No warning.
Participation
- I am willing to submit a pull request for this issue.
Additional comments
This definitely happened in eslint 7 also, and probably older versions.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Wrong indenting - Visual Studio Feedback
For the issue "VC is using both tabs and spaces to indent a single line" may be because the Tab size is different...
Read more >74836 – [indent] Wrong indentation on Enter in <a>|<b>
I expect to have the second element located at same column as the first one. Steps to reproduce: =================== 1. Create new web ......
Read more >BUG REPORT: Text indentation maximum is calcultated wrong
BUG REPORT : Text indentation maximum is calcultated wrong. When trying to indent the text in a table, I came across a bug...
Read more >What should I do with "Unexpected indent" in Python?
18 Answers 18 · Copy the tabs or spaces that are causing the error · Do a find and replace in your IDE...
Read more >bug GNU Octave - Bugs: bug #60649, Incorrect indentation for...
Enter this code manually, and stay on the last line. ... Then type "carriage return". "case 2" becomes mis-aligned. Indenting a selected section ......
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 FreeTop 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
Top GitHub Comments
The first version of indent was just about blocks and statements. We’ve since added on options for a whole bunch of multi line expressions. It seems reasonable to me that at some point along the way, the rule’s scope expanded to include all lines, not just blocks, statements, and a couple dozen other cases, which would make this an omission and plausibly justifiable a bug. Given that, I’m with @nzakas.
Ok, marking as accepted. @ljharb feel free to open a PR.