@beyondessential/eslint-config-jest
Version:
Beyond Essential System's ESLint config for Jest.js
51 lines (34 loc) • 2.48 kB
Markdown
# /eslint-config-jest
## Jest style guide as as shareable ESLint configuration
This package defines [Beyond Essential System](https://beyondessential.com.au/)'s style guide for Jest.
## Installation
Install the package and its required peer dependencies:
```sh
yarn add -D /eslint-config-jest eslint prettier
```
## Usage
You need to extend this package in your [ESLint configuration](https://eslint.org/docs/user-guide/configuring):
```json
{
"extends": "@beyondessential/jest"
}
```
## Publishing
1. Checkout the latest code: `git fetch && git checkout master`
2. Commit your changes in a new branch
3. ⚠️ Don't forget to also update the package version: `npm version # < patch || minor || major >`
4. Create a pull request against `master`
After your PR is approved and merged:
```sh
git fetch && git checkout master && git pull
npm login
npm publish --access public
```
## Style guide
We use the recommended rules from [eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest), with a few changes.
### Changes
| Rule | Airbnb | BES | Comment |
| ------------------------------------------------------------------------------------------------------------------ | ------ | -------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [jest/expect-expect](https://github.com/jest-community/eslint-plugin-jest/blob/HEAD/docs/rules/expect-expect.md) | error | ['warn', { assertFunctionNames: ['expect', 'assert*'] }] | Our `assert*` functions conventionally use `expect` under the hood |
| [jest/valid-describe](https://github.com/jest-community/eslint-plugin-jest/blob/HEAD/docs/rules/valid-describe.md) | error | off | The implementation of this rule does not allow imported functions as `describe` callbacks |
| [jest/valid-title](https://github.com/jest-community/eslint-plugin-jest/blob/HEAD/docs/rules/valid-title.md) | error | off | Title may be a variable |