Skip to content

Commit af070bc

Browse files
committed
feat: add style recommended config
1 parent 5d3ebcc commit af070bc

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ config file:
7272
}
7373
```
7474

75+
### Style
76+
77+
This plugin also exports a configuration named `style`, which adds some
78+
stylistic rules, such as `prefer-to-be-null`, which enforces usage of `toBeNull`
79+
over `toBe(null)`. All rules included are:
80+
81+
- `prefer-to-be-null`
82+
- `prefer-to-be-undefined`
83+
- `prefer-to-contain`
84+
- `prefer-to-have-length`
85+
7586
See
7687
[ESLint documentation](http://eslint.org/docs/user-guide/configuring#extending-configuration-files)
7788
for more information about extending configuration files.

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ module.exports = {
4949
'jest/valid-expect-in-promise': 'error',
5050
},
5151
},
52+
style: {
53+
plugins: ['jest'],
54+
rules: {
55+
'jest/prefer-to-be-null': 'error',
56+
'jest/prefer-to-be-undefined': 'error',
57+
'jest/prefer-to-contain': 'error',
58+
'jest/prefer-to-have-length': 'error',
59+
},
60+
},
5261
},
5362
environments: {
5463
globals: {

0 commit comments

Comments
 (0)