Disallow banned observable creators (rxjs-x/ban-observables)
April 18, 2025 ยท View on GitHub
It can sometimes be useful to ban specific rxjs imports.
This rule can be configured to ban a list of specific rxjs imports developers want to avoid in their project.
Tip
ban-observables only bans at the import site. (In fact, it can ban anything imported from rxjs.)
See ban-operators for banning operators at their usage.
Options
This rule accepts a single option which is an object the keys of which are the names of anything in rxjs and the values are either booleans or strings containing the explanation for the ban.
The following configuration bans partition and onErrorResumeNext:
{
"rxjs-x/ban-observables": [
"error",
{
"partition": true,
"of": false,
"onErrorResumeNext": "What is this? Visual Basic?"
}
]
}
When Not To Use It
If you have no need to ban importing anything from rxjs, you don't need this rule.