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.

Bug: `indent` is not reporting on wrong indentation

See original GitHub issue

Environment

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:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
btmillscommented, Jan 30, 2022

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.

3reactions
nzakascommented, Feb 1, 2022

Ok, marking as accepted. @ljharb feel free to open a PR.

Read more comments on GitHub >

github_iconTop 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 >

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