Skip to content

Commit

Permalink
chore: enable recommended ESLint plugin rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Dec 28, 2023
1 parent 1df963a commit 191e332
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
39 changes: 24 additions & 15 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/Buttons.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <Button text="Test Button" onClick={mockOnClick()} />;
Expand All @@ -22,7 +22,7 @@ describe("Test button types", () => {
fireEvent.click(getByText("Test Button"));
expect(mockOnClick).toHaveBeenCalledTimes(1);
});
test("Test that LinkButton renders properly and properly navigates to internal link", () => {
test("that LinkButton renders properly and properly navigates to internal link", () => {
const testButton = <LinkButton text="Test Button" link="/test" />;

const { getByText } = render(testButton);
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/Dialogs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jest.mock("react-router-dom", () => {
});

describe("Test cookie consent pop-up", () => {
test("Test that pop-up appears without cookie existing", async () => {
test("that pop-up appears without cookie existing", async () => {
// Launch CookieConsent
const { getByText } = render(<CookieConsent />);

Expand All @@ -31,7 +31,7 @@ describe("Test cookie consent pop-up", () => {
});
});

test("Test that pop-up does not appear if cookies have been accepted", async () => {
test("that pop-up does not appear if cookies have been accepted", async () => {
// Mock cookie that matches desired
Object.defineProperty(window.document, "cookie", {
configurable: true,
Expand All @@ -56,7 +56,7 @@ describe("Test cookie consent pop-up", () => {
});
});
describe("Test PoliciesModelledPopup", () => {
test("Test that pop-up appears after beginning calculations", () => {
test("that pop-up appears after beginning calculations", () => {
const testProps = {
policy: {
reform: {
Expand Down

0 comments on commit 191e332

Please sign in to comment.