Skip to content

Commit f02931b

Browse files
committed
add section to readme about eslint-plugin-chai-friendly
1 parent a5fe863 commit f02931b

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ npm install eslint-plugin-cypress --save-dev
1212

1313
## Usage
1414

15-
Add an `.eslintrc` file to your `cypress` directory with the following:
15+
Add an `.eslintrc.json` file to your `cypress` directory with the following:
1616

1717
```json
18-
// my-project/cypress/.eslintrc
18+
// my-project/cypress/.eslintrc.json
1919

2020
{
2121
"plugins": [
@@ -26,3 +26,26 @@ Add an `.eslintrc` file to your `cypress` directory with the following:
2626
}
2727
}
2828
```
29+
30+
## Chai and `no-unused-expressions`
31+
32+
Using an assertion such as `expect(value).to.be.true` can fail the ESLint rule `no-unused-expressions` even though it's not an error in this case. To fix this, you can install and use [eslint-plugin-chai-friendly](https://www.npmjs.com/package/eslint-plugin-chai-friendly).
33+
34+
```sh
35+
npm install --save-dev eslint-plugin-chai-friendly
36+
```
37+
38+
In your `.eslintrc.json`:
39+
40+
```json
41+
{
42+
"plugins": [
43+
"cypress",
44+
"chai-friendly"
45+
],
46+
"rules": {
47+
"no-unused-expressions": 0,
48+
"chai-friendly/no-unused-expressions": 2
49+
}
50+
}
51+
```

0 commit comments

Comments
 (0)