Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
eslint-plugin-jest-formatting
Advanced tools
eslint-plugin-jest-formatting is an ESLint plugin that enforces consistent formatting for Jest test suites. It helps maintain a uniform style across your test files, making them easier to read and maintain.
Enforce consistent test block spacing
This rule ensures that there is consistent padding around test blocks, improving readability.
module.exports = {
"plugins": ["jest-formatting"],
"rules": {
"jest-formatting/padding-around-test-blocks": "error"
}
};
Enforce consistent describe block spacing
This rule ensures that there is consistent padding around describe blocks, making the structure of the tests clearer.
module.exports = {
"plugins": ["jest-formatting"],
"rules": {
"jest-formatting/padding-around-describe-blocks": "error"
}
};
Enforce consistent expect statement spacing
This rule ensures that there is consistent padding around all Jest blocks, including expect statements, for a uniform look.
module.exports = {
"plugins": ["jest-formatting"],
"rules": {
"jest-formatting/padding-around-all": "error"
}
};
eslint-plugin-jest provides a set of ESLint rules specific to Jest. While it focuses more on best practices and avoiding common pitfalls in Jest tests, it does not specifically enforce formatting rules like eslint-plugin-jest-formatting.
eslint-plugin-testing-library is an ESLint plugin for Testing Library. It enforces best practices and helps avoid common mistakes when using Testing Library, but it does not focus on formatting rules for Jest tests.
eslint-plugin-jasmine provides linting rules for Jasmine test suites. It is similar in purpose to eslint-plugin-jest but is tailored for Jasmine rather than Jest. It does not enforce formatting rules like 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.
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.
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"]
}
This provides an extensive set of jest eslint rules
FAQs
ESLint rules for formatting jest tests
The npm package eslint-plugin-jest-formatting receives a total of 223,798 weekly downloads. As such, eslint-plugin-jest-formatting popularity was classified as popular.
We found that eslint-plugin-jest-formatting demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.