Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

eslint-plugin-jest-formatting

dangreenisrael2.3mMIT3.1.0

ESLint rules for formatting jest tests

eslint, eslintplugin, eslint-plugin, jest, format, formatting, padding

readme

CircleCI npm monthly downloads

eslint-plugin-jest-formatting

This package provides ESLint rules for jest test suites.

This project aims to provide formatting rules (auto-fixable where possible) to ensure consistency and readability in jest test suites.

Like this plugin? Say thanks with a ⭐️

Note: The master version may not be the version deployed to npm. Please treat https://www.npmjs.com/package/eslint-plugin-jest-formatting as the cannonical source for docs.

Installation

You'll first need to install ESLint:

$ yarn add eslint --dev

Next, install eslint-plugin-jest-formatting:

$ yarn add eslint-plugin-jest-formatting --dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-jest-formatting globally.

Usage

Add jest-formatting to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["jest-formatting"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "jest-formatting/padding-around-describe-blocks": 2,
    "jest-formatting/padding-around-test-blocks": 2
  }
}

or

You can use our "recommended" settings which enables most of the rules for you

{
  "extends": ["plugin:jest-formatting/recommended"]
}

We also support a "strict" settings which enabled all of the rules for you

{
  "extends": ["plugin:jest-formatting/strict"]
}

Rule Documentation

eslint-plugin-jest

This provides an extensive set of jest eslint rules

https://github.com/jest-community/eslint-plugin-jest

changelog

Changelog

v3.0.0 - May 4, 2021

Breaking Changes

  • Padding is no longer enforced between statements and awaited statements of the same kind.

v1.1.0 - August 14, 2019

Changed

  • Removed padding-around-expect-groups from the "recommended" set of rules.

Added

  • Exposes "strict" rules for eslint extends. This preset is equivalent to version 1.0.0's "recommended" preset.

v1.0.0 - August 12, 2019

Added

  • Exposes "recommended" rules for eslint extends

  • Improve documentation

Deprecated

  • The padding-before-all rule has been deprecated

v0.1.0 - July 20, 2019

Rules Added

  • padding-before-all

  • padding-before-after-all-blocks

  • padding-before-after-each-blocks

  • padding-before-before-all-blocks

  • padding-before-before-each-blocks

  • padding-before-expect-statements

Other

  • Security update of lodash