Skip to content

Indent rule and nested one-line blocks #3238

@targos

Description

@targos

Rule:

indent: [2, 2, {"SwitchCase": 1, "VariableDeclarator": 2}]

Code:

for (var val in obj)
  if (true)
    console.log(val);

if (true)
  if (true)
    if (true)
      console.log(true);

Error:

test4.js
  3:5  error  Expected indentation of 2 characters but found 4  indent
  7:5  error  Expected indentation of 2 characters but found 4  indent
  8:7  error  Expected indentation of 4 characters but found 6  indent

I expect no error in this case.

Cross-reference: nodejs/node#2286

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyruleRelates to ESLint's core rules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions