From 573c6e0e3a78f8f89247a8bcd3708162d5860255 Mon Sep 17 00:00:00 2001 From: Adrien le Corvec Date: Thu, 7 Nov 2024 01:15:39 +0000 Subject: [PATCH] add: jest plugin in eslint configuration --- eslint.config.mjs | 13 +++++++++++++ package-lock.json | 1 + package.json | 1 + 3 files changed, 15 insertions(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index d767de4..ee4ce7e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,9 +3,21 @@ import pluginJs from "@eslint/js"; import pluginReactConfig from "eslint-plugin-react/configs/recommended.js"; import { fixupConfigRules } from "@eslint/compat"; +import pluginJest from 'eslint-plugin-jest'; + export default [ { files: ["**/*.{js,mjs,cjs,jsx}"], + plugins: { jest: pluginJest }, + languageOptions: { + }, + rules: { + 'jest/no-disabled-tests': 'warn', + 'jest/no-focused-tests': 'error', + 'jest/no-identical-title': 'error', + 'jest/prefer-to-have-length': 'warn', + 'jest/valid-expect': 'error', + }, languageOptions: { ecmaVersion: 2021, sourceType: "module", @@ -13,6 +25,7 @@ export default [ ecmaFeatures: { jsx: true }, }, globals: { + ...pluginJest.environments.globals.globals, ...globals.node, ...globals.browser, }, diff --git a/package-lock.json b/package-lock.json index 62549ac..9a5bccc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@eslint/compat": "^1.1.0", "@testing-library/user-event": "^13.5.0", "bcryptjs-react": "^2.4.6", + "eslint-plugin-jest": "^25.7.0", "react": "^18.3.1", "react-calculator-component": "^1.0.0", "react-dom": "^18.3.1", diff --git a/package.json b/package.json index 1883b26..8079186 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "@eslint/compat": "^1.1.0", "@testing-library/user-event": "^13.5.0", "bcryptjs-react": "^2.4.6", + "eslint-plugin-jest": "^25.7.0", "react": "^18.3.1", "react-calculator-component": "^1.0.0", "react-dom": "^18.3.1",