Skip to content

[indent] Multiline class members with linebreak right after = #549

Closed
@Philipp91

Description

@Philipp91

Repro

{
  "rules": {
    "@typescript-eslint/indent": "error",
  }
}
class Test {
    public test =
        'test';
}

Expected Result

No warning. This is what the auto-formatter does, this is also what I consider to look reasonable.

Actual Result

error Expected indentation of 4 spaces but found 8 on the 'test' line, and auto-fix to:

class Test {
    public test =
    'test';
}

Additional Info

  eslint:linter Linting code for ......ts (pass 1) +0ms
  eslint:traverser Unknown node type "ClassProperty": Estimated visitor keys ["type","key","value","computed","static","readonly","range","loc","accessibility"] +0ms
  eslint:linter Generating fixed text for ......ts (pass 1) +29s
  eslint:source-code-fixer Applying fixes +0ms
  eslint:source-code-fixer shouldFix parameter was false, not attempting fixes +0ms

The problem does not occur if there is no line-break after the = operator, or outside of class properties:

class Test {
    public test = 'test' +
        'test';
}
const test =
    'test';

Versions

package version
@typescript-eslint/eslint-plugin 1.9.0
@typescript-eslint/parser 1.9.0
TypeScript 3.4.5
ESLint 5.16.0
node 8.11.3
npm 6.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions