Skip to content

Commit b695fbf

Browse files
committed
update readme
1 parent 82d5842 commit b695fbf

File tree

1 file changed

+51
-19
lines changed

1 file changed

+51
-19
lines changed

README.md

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,89 @@ Since some rules have better implementations in other more generic ESLint packag
88

99
The tests have been upgraded to use standard TypeScript and ESLint test helpers.
1010

11+
All existing unit tests pass.
12+
1113
## Install
1214

1315
Install the ESLint TypeScript parser using npm:
1416

15-
```
17+
``` bash
1618
npm install @typescript-eslint/parser --save-dev
1719
```
1820

1921
Install the package using npm:
2022

21-
```
23+
``` bash
2224
npm install @smarttools/eslint-plugin-rxjs --save-dev
2325
```
2426

2527
Configure 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
2852
const { join } = require("path");
2953
module.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

4965
Or, 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
5287
const { join } = require("path");
5388
module.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

Comments
 (0)