From 191e332ca2f5ce5dc8879d0d7a4fa428b3dc088d Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Wed, 9 Aug 2023 15:45:05 -0400 Subject: [PATCH] chore: enable recommended ESLint plugin rules --- .eslintrc.json | 39 +++++++++++++++++++++-------------- package.json | 6 ------ src/__tests__/Buttons.test.js | 4 ++-- src/__tests__/Dialogs.test.js | 6 +++--- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 22d950e57..4ce112962 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,40 +2,49 @@ "env": { "browser": true, "node": true, - "es2021": true, - "jest/globals": true + "es2021": true }, "extends": [ "eslint:recommended", - "plugin:react/recommended" - //"plugin:prettier/recommended" + "plugin:react/recommended", + "plugin:react-hooks/recommended", + "plugin:jsx-a11y/recommended", + "plugin:prettier/recommended" ], - "globals": { - "process": true - }, "overrides": [ { - "files": ["test/**"], - "plugins": ["jest"], + "files": ["**/*test.js"], "extends": [ "eslint:recommended", - "plugin:jest/recommended" - //"plugin:prettier/recommended" + "plugin:jest/recommended", + "plugin:prettier/recommended" ], - "rules": { "jest/prefer-expect-assertions": "off" } + "rules": { "jest/prefer-expect-assertions": "off" }, + "env": { + "jest": true + } } ], "parserOptions": { "ecmaVersion": "latest", "sourceType": "module" }, - "plugins": ["react", "react-hooks", "jest", "jsx-a11y"], "rules": { // suppress errors for missing 'import React' in files "react/react-in-jsx-scope": "off", - "react/prop-types": "off" + "react/prop-types": "off", + // suppress currently failing recommended rules + "jsx-a11y/alt-text": "off", + "jsx-a11y/anchor-is-valid": "off", + "jsx-a11y/click-events-have-key-events": "off", + "jsx-a11y/iframe-has-title": "off", + "jsx-a11y/mouse-events-have-key-events": "off", + "jsx-a11y/no-autofocus": "off", + "jsx-a11y/no-noninteractive-element-interactions": "off", + "jsx-a11y/no-static-element-interactions": "off", + "react-hooks/exhaustive-deps": "off", + "react-hooks/rules-of-hooks": "off" }, - "ignorePatterns": ["**/*.css", "**/*.scss"], "settings": { "react": { "pragma": "React", // Pragma to use, default to "React" diff --git a/package.json b/package.json index 056687620..498ea2610 100644 --- a/package.json +++ b/package.json @@ -61,12 +61,6 @@ "fix": "eslint --fix --ext js,jsx . && prettier -w .", "lint": "eslint --ext js,jsx . && prettier -c ." }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, "browserslist": { "production": [ ">0.2%", diff --git a/src/__tests__/Buttons.test.js b/src/__tests__/Buttons.test.js index 5733858a1..99f8dc724 100644 --- a/src/__tests__/Buttons.test.js +++ b/src/__tests__/Buttons.test.js @@ -12,7 +12,7 @@ jest.mock("react-router-dom", () => ({ })); describe("Test button types", () => { - test("Test that Button renders and fires onClick properly", () => { + test("that Button renders and fires onClick properly", () => { const mockOnClick = jest.fn(); const testButton =