Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Indent rule regression starting with v20.1.0 #586

Copy link
Copy link
Closed
@scottohara

Description

@scottohara
Issue body actions

What version of ESLint are you using?
5.11.1

What version of TypeScript are you using?
3.1.1

What version of typescript-eslint-parser are you using?
Any version from 20.1.0 onwards

What code were you trying to parse?

{
  "parser": "typescript-eslint-parser",
  "rules": {
    "indent": ["error", "tab", {"VariableDeclarator": {"const": 3}}]
  }
}

(in the code below, ^ represents a tab character)

interface Foo {
  a: number;
  b: number;
}

const foo: Foo = {
^ ^ ^ ^ a: 1,
^ ^ ^ ^ b: 2
^ ^ ^ },
^ ^ ^ bar = 1;

What did you expect to happen?
No errors

What happened?
In typescript-eslint-parser@20.0.0, code passes with no errors.

With typescript-eslint-parser@20.1.0 onwards, the errors below occur:

7:1  error  Expected indentation of 1 tab but found 4   indent
8:1  error  Expected indentation of 1 tab but found 4   indent
9:1  error  Expected indentation of 0 tabs but found 3  indent

The code can be modified like below to pass, but clearly this is not what the config intends:

const foo: Foo = {
  a: 1,
  b: 2
},
      bar = 1

Vanilla JS code without a type annotation passes as expected:

const foo = {
        a: 1,
		b: 2
      },
      bar = 1;

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.