Skip to content
This repository was archived by the owner on Mar 8, 2021. It is now read-only.
This repository was archived by the owner on Mar 8, 2021. It is now read-only.

Switch statment indentation is broke in ^5.x #46

@Willyham

Description

@Willyham

@malandrew @rtsao

Consider the program:

'use strict';

function foo(x) {
  switch (x) {
    case 'a':
      return 1;
    case 'b':
      return 2;
    default:
      return 'c';
  }
}

foo(1);

Results in:

/home/willy/foo/switch.js
     5:5   Expected indentation of 2 space characters but found 4. (indent)
     6:7   Expected indentation of 4 space characters but found 6. (indent)
     7:5   Expected indentation of 2 space characters but found 4. (indent)
     8:7   Expected indentation of 4 space characters but found 6. (indent)
     9:5   Expected indentation of 2 space characters but found 4. (indent)
    10:7   Expected indentation of 4 space characters but found 6. (indent)

Whereas:

'use strict';

function foo(x) {
  switch (x) {
  case 'a':
    return 1;
  case 'b':
    return 2;
  default:
    return 'c';
  }
}

foo(1);

Passes the linter. Surely this can't be right? Seems to have changed from v4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions