eslint-plugin-rxjs icon indicating copy to clipboard operation
eslint-plugin-rxjs copied to clipboard

is there a way to ban .asObservable() method

Open goldenratio opened this issue 1 year ago • 1 comments

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$;
}

goldenratio avatar Jun 20 '23 20:06 goldenratio

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?

mhombach avatar Sep 22 '23 11:09 mhombach