Skip to content

indent rule unexpected result with for loop + semi-colon for the body #8882

@Trott

Description

@Trott

Tell us about your environment

  • ESLint Version: 4.1.1
  • Node Version: 8.1.3
  • npm Version: 5.0.4

What parser (default, Babel-ESLint, etc.) are you using?
default

Please show your full configuration:

Configuration
root: true

env:
  node: true
  es6: true

parserOptions:
  ecmaVersion: 2017

rules:
  indent: [2, 2, {ArrayExpression: first,
                  CallExpression: {arguments: first},
                  FunctionDeclaration: {parameters: first},
                  FunctionExpression: {parameters: first},
                  MemberExpression: off,
                  ObjectExpression: first,
                  SwitchCase: 1}]

What did you do? Please include the actual source code causing the issue.

for (var handle; handle = this.handles.shift(); handle.close())
  ;

What did you expect to happen?
I expected indentation of the ; that represents the body of the for loop to be accepted at 2 spaces of indentation.

What actually happened? Please include the actual, raw output from ESLint.

2:1 error Expected indentation of 0 spaces but found 2 indent

Metadata

Metadata

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 incorrectlyindentRelates to the `indent` ruleruleRelates 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