-
Notifications
You must be signed in to change notification settings - Fork 3
No nested pipe similar to no-nested-subscribe #134
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
Conversation
this is just new rule created based on the no-nested-subscribe, in our code we found this one of big issue when its making code complex and have certain issue as well so we wanted to avoid nested pipe in the code currently there is not other solution available in the next
example in the docs about the growing code face issues with nested pipes for which we require this rule to avoid this complexity
added new test file for no-nested-pipe valid and invalid scenarios
rule usage standalone code for playground
test description update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've left some comments. Additionally:
- Run
yarn lintandyarn typecheckand fix any problems. - Run
yarn docsto auto-update the documentation instead of manually updating it. - You may need to re-create your branch off this repository instead of cartant's, since we've upgraded things like dependencies and the testing framework.
| /** | ||
| * @license Use of this source code is governed by an MIT-style license that | ||
| * can be found in the LICENSE file at https://github.com/cartant/eslint-plugin-rxjs | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This license header can be removed (and in the test file too).
|
|
||
| import { TSESTree as es } from "@typescript-eslint/experimental-utils"; | ||
| import { getParent, getTypeServices } from "eslint-etc"; | ||
| import { ruleCreator } from "../utils"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we've upgraded typescript-eslint and dropped the dependency on eslint-etc, you'll need slightly separate imports:
import { TSESTree as es } from '@typescript-eslint/utils';
import { getTypeServices } from '../etc';
...And instead of getParent, you can just do node.parent.
| }, | ||
| }); | ||
|
|
||
| export = rule; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're exporting rules slightly different to support ESM too. Do:
export const noNestedPipeRule = ruleCreator({
...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to add the rule to index.ts (we have a unit test to ensure it gets added).
In this PR I would like to add new rule: no-nested-pipe
Last year, my team have spent significant effort on improving the maintainability and readability of rxjs statement in the codebase. Avoiding nested pipe has been the most useful rule on driving the better behavior in this area. The team have been enforcing this manually through PR review check last year. I have come cross your library and find it very useful, hence would like to introduce no-nested-pipe rule so that we could all benefit from it.
would you please review this PR and suggest if there is any correction and could please approve this PR if everything is ok