Skip to content

Commit 8eca2fd

Browse files
committed
doc: update rule usage guide
1 parent f8aef51 commit 8eca2fd

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ This is a repository containing custom ESLint rules for Angular projects
66

77
## Rules included
88

9-
`destroy-service-provider`: When using `DestroyService` to automatically unsubscribe from an observable, this service MUST be provided in Component/Directive class providers in order for the Service to work properly. This rule ensures the DestroyService is always provided in the `providers` array of the Component or Directive.
9+
- `destroy-service-provider`: When using `DestroyService` to automatically unsubscribe from an observable, this service MUST be provided in Component/Directive class providers in order for the Service to work properly. This rule ensures the DestroyService is always provided in the `providers` array of the Component or Directive.
1010

1111
## Usage
1212

13-
### `destroy-service-provider`
13+
### Install the package
1414

15-
Edit your eslint config file as follow
15+
```bash
16+
npm install --save-dev eslint-plugin-ngx-eslint
17+
```
18+
19+
### Config rule `destroy-service-provider`
20+
21+
Edit your `.eslintrc` config file as follow
1622

1723
```json
1824
{
@@ -23,6 +29,22 @@ Edit your eslint config file as follow
2329
}
2430
```
2531

32+
If your destroy service class name is different than `DestroyService`, the configuration would be like this
33+
34+
```json
35+
{
36+
"plugins": ["ngx-eslint"],
37+
"rules": {
38+
"ngx-eslint/destroy-service-provider": [
39+
"error",
40+
{
41+
"destroyServiceName": "MyDestroyService"
42+
}
43+
]
44+
}
45+
}
46+
```
47+
2648
## LICENSE
2749

2850
MIT

0 commit comments

Comments
 (0)