@beyondessential/eslint-config-jest

Beyond Essential System's ESLint config for Jest.js

Usage no npm install needed!

<script type="module">
  import beyondessentialEslintConfigJest from 'https://cdn.skypack.dev/@beyondessential/eslint-config-jest';
</script>

README

@beyondessential/eslint-config-jest

Jest style guide as as shareable ESLint configuration

This package defines Beyond Essential System's style guide for Jest.

Installation

Install the package and its required peer dependencies:

yarn add -D @beyondessential/eslint-config-jest eslint prettier

Usage

You need to extend this package in your ESLint configuration:

{
  "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:

git fetch && git checkout master && git pull
npm login
npm publish --access public

Style guide

We use the recommended rules from eslint-plugin-jest, with a few changes.

Changes

Rule Airbnb BES Comment
jest/expect-expect error ['warn', { assertFunctionNames: ['expect', 'assert*'] }] Our assert* functions conventionally use expect under the hood
jest/valid-describe error off The implementation of this rule does not allow imported functions as describe callbacks
jest/valid-title error off Title may be a variable