cartant / eslint-plugin-rxjs

ESLint rules for RxJS
MIT License
312 stars 37 forks source link

is there a way to ban .asObservable() method #116

Open goldenratio opened 1 year ago

goldenratio commented 1 year ago

Hey, wondering, is there a way to ban .asObservable() method? Thanks.

// wrong
get click$(): Observable<void> {
  return this._clickSubject$.asObservable();
}

// correct
get click$(): Observable<void> {
  return this._clickSubject$;
}
mhombach commented 1 year ago

I think, as long as there is not a fixed rule, you could use the restricted-syntax rule to define that rule yourself in your lint config. But could you explain in which cases asObservable() might be a problem?