Hello! Facing a strange behavior of no-exposed-subjects rule, as I recently read in docs "Disallows exposed subjects. In classes, Subject properties and methods that return a Subject must be private.", so I guess eslint must notify me about three errors if I will write this:
@Component({
selector: 'app-component',
....
})
export class AppComponent {
public foo$: Subject<unknown>;
public bar$ = new Subject<unknown>();
public getFoo(): Subject<unknown> {
return this.foo$;
}
}
But it marks as error only public "getFoo" method that returns public Subject. I expected public bar$ = new Subject<unknown>(); and public foo$: Subject<unknown>; are wrong too. Can someone explain this situation? Thanks a lot!
Problem
Hello! Facing a strange behavior of no-exposed-subjects rule, as I recently read in docs "Disallows exposed subjects. In classes, Subject properties and methods that return a Subject must be private.", so I guess eslint must notify me about three errors if I will write this:
But it marks as error only public "getFoo" method that returns public Subject. I expected
public bar$ = new Subject<unknown>();
andpublic foo$: Subject<unknown>;
are wrong too. Can someone explain this situation? Thanks a lot!.eslintrc.js config
Versions of packages:
Please reply if you need some more info to investigate!