eslint-plugin-jest-react

raw JSON →
0.1.0 verified Sat Apr 25 auth: no javascript maintenance

An ESLint plugin providing linting rules for Jest tests in React projects. Current stable version is 0.1.0, with low release cadence (last update likely stale). Key differentiator: combines Jest and React specific rules. However, the official community ESLint Jest plugin (eslint-plugin-jest) is more actively maintained and recommended; this plugin may have niche value only for the `no-mocking-react` rule.

error Error: Failed to load plugin 'jest-react'
cause Missing peer dependency 'eslint' or plugin not installed.
fix
Run: yarn add --dev eslint eslint-plugin-jest-react
error Configuration for rule 'jest-react/no-mocking-react' is invalid
cause Rule configured with wrong severity or extra options.
fix
Use standard severity: 'off', 'warn', or 'error'.
error Parsing error: 'import' and 'export' may only appear at the top level
cause ESLint parser does not support ES modules by default.
fix
Add 'parserOptions: { sourceType: 'module' }' in ESLint config.
breaking Plugin is not maintained; last update over 2 years ago. Consider using active alternatives like eslint-plugin-jest.
fix Switch to eslint-plugin-jest and eslint-plugin-testing-library for React testing patterns.
deprecated eslint-plugin-jest-react may not work with ESLint >= 9 due to config changes (flat config).
fix Use ESLint 8 with .eslintrc format, or migrate to flat config with compatible plugins.
gotcha The recommended config 'plugin:jest-react/recommended' may enable rules that conflict with Jest's environment or other ESLint rules.
fix Review each rule after extending the recommended config, and disable/override as needed.
npm install eslint-plugin-jest-react
yarn add eslint-plugin-jest-react
pnpm add eslint-plugin-jest-react

Shows how to install and configure the plugin in ESLint to lint Jest tests in React projects.

// Install: yarn add --dev eslint eslint-plugin-jest-react
// .eslintrc.js
module.exports = {
  plugins: ['jest-react'],
  extends: ['plugin:jest-react/recommended'],
  rules: {
    'jest-react/no-mocking-react': 'error'
  }
};