Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-ignored-replay-buffer doesn't check bufferSize if object config passed to shareReplay #100

Open
sashaqred opened this issue May 1, 2022 · 0 comments · Fixed by JasonWeinzierl/eslint-plugin-rxjs-x#12 · May be fixed by #114

Comments

@sashaqred
Copy link

In my project I'm using plugin:rxjs/recommended which comes with two rules: rxjs/no-sharereplay and rxjs/no-ignored-replay-buffer.

The following code is good with rxjs/no-ignored-replay-buffer rule and throws error with rxjs/no-sharereplay rule:

interval(1000).pipe(shareReplay(1));

And this won't throw any linter error:

interval(1000).pipe(shareReplay({refCount: true}));

But bufferSize here is missing. And it looks like here should be error from rxjs/no-ignored-replay-buffer rule. I've checked sources and it looks like the rule check only arguments length but doesn't check the arguments content.

Also, I can help with pull request, if you don't mind.

skrtheboss added a commit to skrtheboss/eslint-plugin-rxjs that referenced this issue May 12, 2023
JasonWeinzierl added a commit to JasonWeinzierl/eslint-plugin-rxjs-x that referenced this issue Nov 8, 2024
Fixes cartant#100

There's also a proposed fix PR in the upstream repo
cartant#114 but I avoided
looking at that solution to avoid any license issue, so this solution
might be different.

- Fix: if the `shareReplay` operator was passed an object config, then
require `bufferSize` to be in that object.
- Fix: the rule wasn't handling if `shareReplay` is imported under a
namespace.
- (Might need to review the entire project. Since rxjs now recommends
importing from "rxjs" instead of "rxjs/operators", there's a risk that
many rules also fail to account for that new paradigm. Note that this
rule is the only rule that tests namespace imports for all cases, so we
at least should expand that coverage/type of test.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant