@@ -8,57 +8,89 @@ Since some rules have better implementations in other more generic ESLint packag
88
99The tests have been upgraded to use standard TypeScript and ESLint test helpers.
1010
11+ All existing unit tests pass.
12+
1113## Install
1214
1315Install the ESLint TypeScript parser using npm:
1416
15- ```
17+ ``` bash
1618npm install @typescript-eslint/parser --save-dev
1719```
1820
1921Install the package using npm:
2022
21- ```
23+ ``` bash
2224npm install @smarttools/eslint-plugin-rxjs --save-dev
2325```
2426
2527Configure the ` parser ` and the ` parserOptions ` for ESLint. Here, I use a ` .eslintrc.js ` file for the configuration:
2628
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
2852const { join } = require (" path" );
2953module .exports = {
3054 parser: " @typescript-eslint/parser" ,
31- parserOptions: {
32- ecmaVersion: 2019 ,
33- project: join (__dirname , " ./tsconfig.json" ),
34- sourceType: " module"
35- },
55+ // parserOptions here
3656 plugins: [" rxjs" ],
3757 extends: [],
3858 rules: {
3959 " 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.
4561 }
4662};
4763```
4864
4965Or, using the ` recommended ` configuration:
5066
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
5287const { join } = require (" path" );
5388module .exports = {
5489 parser: " @typescript-eslint/parser" ,
55- parserOptions: {
56- ecmaVersion: 2019 ,
57- project: join (__dirname , " ./tsconfig.json" ),
58- sourceType: " module"
59- },
90+ // parserOptions here
6091 extends: [" plugin:rxjs/recommended" ],
6192};
93+
6294```
6395
6496## Rules
0 commit comments