Skip to content

Commit a02f9a2

Browse files
docs(suffix-subjects): when not to use and conflict with finnish
1 parent b29a9d6 commit a02f9a2

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

docs/rules/finnish.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ The default (Angular-friendly) configuration looks like this:
6868

6969
The properties in the options object are themselves optional; they do not all have to be specified.
7070

71+
Note the default options of this rule will conflict with [`suffix-subjects`](./suffix-subjects.md).
72+
If you want to handle subjects separately with `suffix-subjects` (or another rule),
73+
then add the following to your `finnish` options:
74+
75+
```js
76+
"types": {
77+
// The default allowed types.
78+
"^EventEmitter$": false,
79+
// The subject types to be compatible with suffix-subjects.
80+
"^(BehaviorSubject|ReplaySubject|AsyncSubject|Subject)$": false,
81+
}
82+
```
83+
7184
## When Not To Use It
7285

7386
If you don't use Finnish notation in your project or don't care about enforcing Finnish notation in your project, you don't need this rule.
@@ -82,6 +95,7 @@ Type checked lint rules are more powerful than traditional lint rules, but also
8295
## Related To
8396

8497
- [`no-finnish`](./no-finnish.md)
98+
- [`suffix-subjects`](./suffix-subjects.md)
8599

86100
## Resources
87101

docs/rules/suffix-subjects.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const answersSubject = new Subject<number>();
3434

3535
<!-- end auto-generated rule options list -->
3636

37-
This rule accepts a single option which is an object with properties that determine whether Finnish notation is enforced for `parameters`, `properties` and `variables`. It also contains a `types` property that determine whether of not the naming convention is to be enforced for specific types and a `suffix` property.
37+
This rule accepts a single option which is an object with properties that determine whether subject suffixes are enforced for `parameters`, `properties` and `variables`. It also contains a `types` property that determine whether of not the naming convention is to be enforced for specific types and a `suffix` property.
3838

3939
The default (Angular-friendly) configuration looks like this:
4040

@@ -56,3 +56,22 @@ The default (Angular-friendly) configuration looks like this:
5656
```
5757

5858
The properties in the options object are themselves optional; they do not all have to be specified.
59+
60+
Note this rule will conflict with [`finnish`](./finnish.md) with default options.
61+
See that rule for notes on how to configure both rules.
62+
63+
## When Not To Use It
64+
65+
If you don't use suffixes on your project's subjects, then you don't need this rule.
66+
However, keep in mind that inconsistent style can harm readability in a project.
67+
68+
Type checked lint rules are more powerful than traditional lint rules, but also require configuring type checked linting.
69+
70+
## Related To
71+
72+
- [`finnish`](./finnish.md)
73+
74+
## Resources
75+
76+
- [Rule source](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x/blob/main/src/rules/suffix-subjects.ts)
77+
- [Test source](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x/blob/main/tests/rules/suffix-subjects.test.ts)

0 commit comments

Comments
 (0)