Skip to content

[indent] expected indentation inconsistent for class X extends/implements Y #1597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
quezak opened this issue Feb 12, 2020 · 1 comment
Closed
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@quezak
Copy link

quezak commented Feb 12, 2020

intro note: I understand formatting line breaks & indents in a multi-line declaration like class X extends Y implements I1, I2, I3 is a complicated & opinionated problem, especially as the class names grow longer and/or have generic args (inb4 "use prettier" 😅), I'm just reporting a small inconsistency between how extends and implements behaves.

Repro

{
  "rules": {
    "@typescript-eslint/indent": ["error", 4]
  }
}
// ---- example A ----
export class ExA1
implements Iface1 {  // OK, indent 0 is correct
    fn(): void {}
}

export class ExA2
extends Base2 {  // Error: Expected indentation of 4 spaces but found 0.
    fn(): void {}
}

// ---- example B ----
export class ExB1 implements
Iface1 {  // OK, indent 0 is correct
    fn(): void {}
}

export class ExB2 extends
Base2 {  // Error: Expected indentation of 4 spaces but found 0.
    fn(): void {}
}

Expected Result
In the above examples, ... extends X ... and ... implements Y ... with identical line breaks should have identical indentation.

Actual Result
extends and implements require different indent when the class declaration is multi-line.

Versions

package version
@typescript-eslint/eslint-plugin 2.19.2
@typescript-eslint/parser 2.19.2
TypeScript 3.7.2
ESLint 6.8.0
node 11.9
npm 6.5

(but I don't use npm, only yarn ^)

@quezak quezak added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Feb 12, 2020
@bradzacher bradzacher added this to the indent rewrite milestone Feb 12, 2020
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for team members to take a look labels Feb 12, 2020
@bradzacher
Copy link
Member

Merging into #1824

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants