Skip to content
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

Linting fails for constructor of generic type after prettier multi-line format #13

Open
seangwright opened this issue Jan 21, 2019 · 3 comments

Comments

@seangwright
Copy link

seangwright commented Jan 21, 2019

Prettier formats some generic type definitions by placing the generic constraints on multiple lines.

This causes tslint-lines-between-class-members to fail linting.

The error is must have 1 new line(s) between class methods, see docs for how to configure which appears on the constructor() { line.

I believe this is due to how you are checking the previous line.

Passes

export class PermissionsStore extends EntityStore<PermissionsState, Permission> {
  constructor() {
    super();
  }
}

Fails

export class PermissionsStore extends EntityStore<
  PermissionsState,
  Permission
> {
  constructor() {
    super();
  }
}

I also ran into this situation where Prettier puts the implements keyword on its own line which causes this lint rule to fail at the line constructor() { }.

interface SomeInterface {
    name: string;
}

export class SomeClass
  implements SomeInterface {
  constructor() { }

  name = 'test';
}
@chinchiheather
Copy link
Owner

This should be fixed in 1.3.5, let me know if you are still getting any problems

@seangwright
Copy link
Author

Awesome! Thanks so much!

@eyev
Copy link

eyev commented Jul 24, 2019

I worked alongside @seangwright on a project we really felt the pain of this issue on. I've updated our packages and can confirm this has been resolved. Thank you, @chinchiheather much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants