@@ -8,57 +8,89 @@ Since some rules have better implementations in other more generic ESLint packag
8
8
9
9
The tests have been upgraded to use standard TypeScript and ESLint test helpers.
10
10
11
+ All existing unit tests pass.
12
+
11
13
## Install
12
14
13
15
Install the ESLint TypeScript parser using npm:
14
16
15
- ```
17
+ ``` bash
16
18
npm install @typescript-eslint/parser --save-dev
17
19
```
18
20
19
21
Install the package using npm:
20
22
21
- ```
23
+ ``` bash
22
24
npm install @smarttools/eslint-plugin-rxjs --save-dev
23
25
```
24
26
25
27
Configure the ` parser ` and the ` parserOptions ` for ESLint. Here, I use a ` .eslintrc.js ` file for the configuration:
26
28
27
- ``` js
29
+ ### Flat Config
30
+
31
+ ``` js
32
+ const rxjs = require (' @smarttools/eslint-plugin-rxjs' );
33
+
34
+ module .exports = [{
35
+ files: [' **/*' ],
36
+ plugins: {
37
+ rxjs,
38
+ },
39
+ },{
40
+ files: [' **/*.ts' ],
41
+ // languageOptions here
42
+ rules: {
43
+ ' rxjs/no-async-subscribe' : ' error' ,
44
+ ... etc.
45
+ },
46
+ }];
47
+ ```
48
+
49
+ ### Legacy Config
50
+
51
+ ``` js
28
52
const { join } = require (" path" );
29
53
module .exports = {
30
54
parser: " @typescript-eslint/parser" ,
31
- parserOptions: {
32
- ecmaVersion: 2019 ,
33
- project: join (__dirname , " ./tsconfig.json" ),
34
- sourceType: " module"
35
- },
55
+ // parserOptions here
36
56
plugins: [" rxjs" ],
37
57
extends: [],
38
58
rules: {
39
59
" rxjs/no-async-subscribe" : " error" ,
40
- " rxjs/no-ignored-observable" : " error" ,
41
- " rxjs/no-ignored-subscription" : " error" ,
42
- " rxjs/no-nested-subscribe" : " error" ,
43
- " rxjs/no-unbound-methods" : " error" ,
44
- " rxjs/throw-error" : " error"
60
+ ... etc.
45
61
}
46
62
};
47
63
```
48
64
49
65
Or, using the ` recommended ` configuration:
50
66
51
- ``` js
67
+ ### Flat Config
68
+
69
+ ``` js
70
+ const rxjs = require (' @smarttools/eslint-plugin-rxjs' );
71
+
72
+ module .exports = [
73
+ rxjs .configs .recommended ,
74
+ {
75
+ files: [' **/*.ts' ],
76
+ plugins: {
77
+ rxjs,
78
+ },
79
+ },
80
+ // additional rules
81
+ ];
82
+ ```
83
+
84
+ ### Legacy Config
85
+
86
+ ``` js
52
87
const { join } = require (" path" );
53
88
module .exports = {
54
89
parser: " @typescript-eslint/parser" ,
55
- parserOptions: {
56
- ecmaVersion: 2019 ,
57
- project: join (__dirname , " ./tsconfig.json" ),
58
- sourceType: " module"
59
- },
90
+ // parserOptions here
60
91
extends: [" plugin:rxjs/recommended" ],
61
92
};
93
+
62
94
```
63
95
64
96
## Rules
0 commit comments