You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-5Lines changed: 14 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,9 @@ There is no recommended configuration for this package, as all of the rules are
12
12
This project is a fork of [`eslint-plugin-rxjs-angular`](https://github.com/cartant/eslint-plugin-rxjs-angular)
13
13
initially started to support the new ESLint flat config format.
14
14
15
+
- The old `.eslintrc` format is not supported.
16
+
- If you need to continue using this old format, use the original `eslint-plugin-rxjs` or a different fork.
17
+
15
18
A complete description of all changes are documented in the [CHANGELOG](CHANGELOG.md) file.
16
19
17
20
## Install
@@ -51,8 +54,14 @@ See [Linting with Type Information](https://typescript-eslint.io/getting-started
51
54
52
55
The package includes the following rules:
53
56
54
-
| Rule | Description | Recommended |
55
-
| --- | --- | --- |
56
-
|[`prefer-async-pipe`](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-angular-x/blob/main/docs/rules/prefer-async-pipe.md)| Forbids the calling of `subscribe` within Angular components. | No |
57
-
|[`prefer-composition`](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-angular-x/blob/main/docs/rules/prefer-composition.md)| Forbids `subscribe` calls that are not composed within Angular components (and, optionally, within services, directives, and pipes). | No |
58
-
|[`prefer-takeuntil`](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-angular-x/blob/main/docs/rules/prefer-takeuntil.md)| Forbids Calling `subscribe` without an accompanying `takeUntil`. | No |
|[prefer-async-pipe](docs/rules/prefer-async-pipe.md)| Disallow the calling of `subscribe` within Angular components. | 💭 |
64
+
|[prefer-composition](docs/rules/prefer-composition.md)| Disallow `subscribe` calls that are not composed within Angular components (and, optionally, within services, directives, and pipes). | 💭 |
65
+
|[prefer-takeuntil](docs/rules/prefer-takeuntil.md)| Disallow `subscribe` calls without an accompanying `takeUntil` within Angular components (and, optionally, within services, directives, and pipes). | 💭 |
Copy file name to clipboardExpand all lines: docs/rules/prefer-async-pipe.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# Use container components and async pipe (`prefer-async-pipe`)
1
+
# Disallow the calling of `subscribe` within Angular components (`rxjs-angular-x/prefer-async-pipe`)
2
2
3
-
This rule effects failures if explicit calls to `subscribe` are made within a component. Instead, use a child component to which a value is passed by using the async pipe in the parent component's template.
3
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
4
4
5
-
## Options
5
+
<!-- end auto-generated rule header -->
6
6
7
-
This rule has no options.
7
+
This rule effects failures if explicit calls to `subscribe` are made within a component. Instead, use a child component to which a value is passed by using the async pipe in the parent component's template.
Copy file name to clipboardExpand all lines: docs/rules/prefer-composition.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
-
# Use subscription composition (`prefer-composition`)
1
+
# Disallow `subscribe` calls that are not composed within Angular components (and, optionally, within services, directives, and pipes) (`rxjs-angular-x/prefer-composition`)
2
+
3
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
4
+
5
+
<!-- end auto-generated rule header -->
2
6
3
7
This rule effects failures if `subscribe` calls are made with a component and the returned subscription is not composed into a subscription that is unsubscribed when the component is destroyed.
|`checkDecorators`| An optional array of decorator names to check. | String[]|
60
+
61
+
<!-- end auto-generated rule options list -->
62
+
51
63
This rule accepts a single option which is an object with a `checkDecorators` property which is an array containing the names of the decorators that determine whether or not a class is checked. By default, `checkDecorators` is `["Component"]`.
52
64
53
65
```json
@@ -61,4 +73,4 @@ This rule accepts a single option which is an object with a `checkDecorators` pr
Copy file name to clipboardExpand all lines: docs/rules/prefer-takeuntil.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
-
# Use `takeUntil` and `ngOnDestroy` (`prefer-takeuntil`)
1
+
# Disallow `subscribe` calls without an accompanying `takeUntil` within Angular components (and, optionally, within services, directives, and pipes) (`rxjs-angular-x/prefer-takeuntil`)
2
+
3
+
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).
4
+
5
+
<!-- end auto-generated rule header -->
2
6
3
7
This rule effects failures if `subscribe` is called within a component and the `takeUntil`-destroyed pattern is not used.
4
8
@@ -50,6 +54,17 @@ class SomeComponent implements OnDestroy, OnInit {
|`alias`| An optional array of operator names that alias for `takeUntil`. | String[]|
62
+
|`checkComplete`| Check for `complete` calls. | Boolean |
63
+
|`checkDecorators`| An optional array of decorator names to check. | String[]|
64
+
|`checkDestroy`| Check for `Subject`-based `ngOnDestroy`. | Boolean |
65
+
66
+
<!-- end auto-generated rule options list -->
67
+
53
68
This rule accepts a single option which is an object with `checkComplete`, `checkDecorators`, `checkDestroy` and `alias` properties.
54
69
55
70
The `checkComplete` property is a boolean that determines whether or not `complete` must be called after `next` and the `checkDestroy` property is a boolean that determines whether or not a `Subject`-based `ngOnDestroy` must be implemented.
@@ -74,4 +89,4 @@ The `alias` property is an array of names of operators that should be treated si
0 commit comments