Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable recommended ESLint plugin rules #681

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading