chinchiheather / tslint-lines-between-class-members

Custom rule for TSLint to enforce blank lines between class methods - achieves a similar thing to lines-between-class-members in ESLint
18 stars 5 forks source link

Wants initial blank line when class declaration is broken over lines #19

Closed pburkindine closed 5 years ago

pburkindine commented 5 years ago
export class ExtremelyOverlongClassNameCausingLineBreak
  implements BaseClass {
  constructor() {}
}

When prettier cleans up a class declaration to span multiple lines (or if you do so manually), the rule will decide here that constructor is missing a leading blank line (which, unfortunately, prettier will then remove)

pburkindine commented 5 years ago

@chinchiheather Is there any update on this?

chinchiheather commented 5 years ago

Hi @pburkindine , sorry I've been a bit MIA the last few months, I'll have a look into it, shouldn't be too difficult to fix I think

chinchiheather commented 5 years ago

I have implemented the fix and released 1.3.2

pburkindine commented 5 years ago

@chinchiheather Thanks, it's much improved! However I'm still seeing the issue in some scenarios involving generics:

Prettier breaks a generic type param onto its own line:

export class VeryVeryVeryVeryLongClassName extends VeryVerVeryLongBaseClassName<
  SomeType
> {
  constructor() {
    super('foo);
  }

Generic-typed interface split across lines:

class VeryVeryVeryVeryLongClassName
  implements VeryVeryVeryVeryLongInterface<SomeType> {
  constructor() {}

Nested generic:

export abstract class VeryVeryVeryVeryLongClassName<
  T extends Model<T>
> extends VeryVerVeryLongBaseClassName<T> {
  constructor() {
    super('foo);
  }