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

Failing when linebreak is present #2

Closed patrickreck closed 6 years ago

patrickreck commented 6 years ago

ngOnInit does not have a line break between class members according to the rule.

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {

  ngOnInit() {
  }

}
chinchiheather commented 6 years ago

Hi @patrickreck not sure I understand what you mean?

I tried running linting on your example and I don't see any errors which seems correct to me

chinchiheather commented 6 years ago

Closing issue as haven't heard anything, happy to reopen if more info is provided

patrickreck commented 6 years ago

Hi @chinchiheather,

I provided a bad example, sorry. The following example are failing:

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent implements  OnInit {

  constructor() {
  }

  ngOnInit() {
  }
}
chinchiheather commented 6 years ago

Hmm I still don't reproduce the error. Can you let me know what version of typescript/tslint you are using? I did manage to get an error if that line between the 2 functions has 2 space indentation, but your example doesn't have this so I'm not sure if it is the same issue?

patrickreck commented 6 years ago

There is no spaces on the empty line in the failing example. I am using typescript@2.6.2, tslint@5.8.0 and tslint-lines-between-class-members@1.0.4.

ERROR: /Users/preck/client/src/app/app.component.ts[13, 3]: must have blank line between class methods

skaermbillede 2018-03-20 kl 10 09 10

chinchiheather commented 6 years ago

I still can't reproduce 😢 , can you paste your tslint.json config file in? Maybe it only happens when combined with some other rules

chinchiheather commented 6 years ago

I have released a new version (1.0.5) which fixes something else, but it is probably worth having a look to see if it fixes your problem as well

chinchiheather commented 6 years ago

Closing issue as have not heard anything in a while