Disallow using ReplaySubject
, publishReplay
or shareReplay
without specifying the buffer size (rxjs-x/no-ignored-replay-buffer
)
💼 This rule is enabled in the following configs: ✅ recommended
, 🔒 strict
.
This rule effects failures if the buffer size of a replay buffer is not explicitly specified.
Examples of incorrect code for this rule:
import { ReplaySubject } from "rxjs";
const subject = new ReplaySubject<number>();
import { of, shareReplay } from "rxjs";
of(42).pipe(shareReplay({ refCount: true }));
Examples of correct code for this rule:
import { ReplaySubject } from "rxjs";
const subject = new ReplaySubject<number>(1);
import { ReplaySubject } from "rxjs";
const subject = new ReplaySubject<number>(Infinity);
import { of, shareReplay } from "rxjs";
of(42).pipe(shareReplay({ refCount: true, bufferSize: 1 }));
If you don't care about implicitly defaulting to Infinity
in your replay buffers, then you don't need this rule.