diff --git a/.eslintignore b/.eslintignore
index 23d8b377ae..6490d1ac4e 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,2 +1,2 @@
# including storybook as .folder are hidden by default and need to be overriden
-!.storybook
\ No newline at end of file
+!.storybook
diff --git a/.eslintrc.js b/.eslintrc.js
index def98d5aeb..57c30e0e79 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -4,13 +4,25 @@ module.exports = {
es6: true,
jest: true,
},
- extends: ["airbnb", "prettier"],
+ extends: ["airbnb", "plugin:testing-library/react", "prettier"],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
Fusion: "readonly",
},
- parser: "babel-eslint",
+ ignorePatterns: [
+ "**/features/ad-taboola/default.jsx",
+ "**/features/alert-bar/default.jsx",
+ "**/features/search-results-list/_children/custom-content.jsx",
+ "**/features/search-results-list/_children/global-content.jsx",
+ ],
+ overrides: [
+ {
+ files: ["**/?(*.)+(test).js(x)*"],
+ extends: ["plugin:testing-library/react"],
+ },
+ ],
+ parser: "@babel/eslint-parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
@@ -18,11 +30,13 @@ module.exports = {
ecmaVersion: 2020,
sourceType: "module",
},
- plugins: ["react", "jest", "jsx-a11y", "react-hooks"],
+ plugins: ["jest", "jest-dom", "jsx-a11y", "react", "react-hooks", "testing-library"],
rules: {
+ "default-param-last": "warn",
"global-require": "off",
- "no-underscore-dangle": ["error", { allow: ["_website", "_id"] }],
"import/no-extraneous-dependencies": "off", // This might be fine. It's worth looking into at the very least.
+ "import/no-named-as-default": "warn",
+ "import/no-named-as-default-member": "warn",
"import/no-unresolved": [
2,
{
@@ -36,11 +50,6 @@ module.exports = {
],
},
],
- "react/forbid-prop-types": "off",
- "react/prop-types": "off", // We will want to be more granular with this I assume.
- "react/require-default-props": "off", // We will also want to have some rules around this. Whitelisting certain props for example
- "react/no-danger": "off",
- "react/jsx-props-no-spreading": "off",
// For list of a11y definitions for this see: https://github.com/evcohen/eslint-plugin-jsx-a11y
"jsx-a11y/accessible-emoji": 2,
"jsx-a11y/alt-text": 2,
@@ -52,6 +61,7 @@ module.exports = {
"jsx-a11y/aria-role": 2,
"jsx-a11y/aria-unsupported-elements": 2,
"jsx-a11y/click-events-have-key-events": 2,
+ "jsx-a11y/control-has-associated-label": "warn",
"jsx-a11y/heading-has-content": 2,
"jsx-a11y/html-has-lang": 2,
"jsx-a11y/iframe-has-title": 2,
@@ -82,7 +92,24 @@ module.exports = {
"jsx-a11y/role-supports-aria-props": 2,
"jsx-a11y/scope": 2,
"jsx-a11y/tabindex-no-positive": 2,
- "react-hooks/rules-of-hooks": "error",
+ "no-promise-executor-return": "warn",
+ "no-underscore-dangle": ["error", { allow: ["_website", "_id"] }],
"react-hooks/exhaustive-deps": "error",
+ "react-hooks/rules-of-hooks": "error",
+ "react/forbid-prop-types": "off",
+ "react/function-component-definition": "warn",
+ "react/jsx-props-no-spreading": "off",
+ "react/no-danger": "off",
+ "react/no-unstable-nested-components": "warn",
+ "react/prop-types": "off", // We will want to be more granular with this I assume.
+ "react/require-default-props": "off", // We will also want to have some rules around this. Whitelisting certain props for example
+ "testing-library/await-async-queries": "warn",
+ "testing-library/await-async-utils": "warn",
+ "testing-library/no-container": "warn",
+ "testing-library/no-node-access": "warn",
+ "testing-library/no-unnecessary-act": "warn",
+ "testing-library/prefer-find-by": "warn",
+ "testing-library/prefer-presence-queries": "warn",
+ "testing-library/prefer-screen-queries": "warn",
},
};
diff --git a/.github/workflows/sync-themes-branch-with-themes-tag.yml b/.github/workflows/sync-themes-branch-with-themes-tag.yml
index 4c2412f47c..d16e11c67f 100644
--- a/.github/workflows/sync-themes-branch-with-themes-tag.yml
+++ b/.github/workflows/sync-themes-branch-with-themes-tag.yml
@@ -51,8 +51,8 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- #- name: Run all tests
- # run: npm run test
+ - name: Run all tests
+ run: npm run test
# See confluence pages https://arcpublishing.atlassian.net/wiki/spaces/TI/pages/2983788608/How+To+Do+Product-Facing+Tag+Release and https://arcpublishing.atlassian.net/wiki/spaces/TI/pages/3013541978/Github+Actions+for+NodeJS+Standards+Best+Practices for documentation
- name: Publish to target tag based off of branch name
diff --git a/.stylelintrc.json b/.stylelintrc.json
index 8d492f71e6..61df103667 100644
--- a/.stylelintrc.json
+++ b/.stylelintrc.json
@@ -5,6 +5,7 @@
"stylelint-config-sass-guidelines",
"stylelint-config-prettier"
],
+ "ignoreFiles": ["**/*.js", "**/*.jsx"],
"rules": {
"max-nesting-depth": 5,
"plugin/no-unsupported-browser-features": [
diff --git a/_templates/chain/new/default-entry.ejs.t b/_templates/chain/new/default-entry.ejs.t
index d024b18659..72f22b59c2 100644
--- a/_templates/chain/new/default-entry.ejs.t
+++ b/_templates/chain/new/default-entry.ejs.t
@@ -6,7 +6,7 @@ import React from 'react';
import PropTypes from '@arc-fusion/prop-types';
const <%= h.changeCase.pascal(block_name) %> = ({ children }) => {
- return <>{children}>;
+ return children;
};
<%= h.changeCase.pascal(block_name) %>.label = '<%= h.changeCase.title( block_name ) %> - Arc Block';
diff --git a/_templates/content-source/feature/default-test.ejs.t b/_templates/content-source/feature/default-test.ejs.t
index 28a2e483c8..22ad56327f 100644
--- a/_templates/content-source/feature/default-test.ejs.t
+++ b/_templates/content-source/feature/default-test.ejs.t
@@ -4,7 +4,7 @@ to: blocks/<%= h.inflection.dasherize(block_name) %>-content-source-block/featur
---
import React from 'react';
import { render, screen } from '@testing-library/react';
-import '@testing-library/jest-dom/extend-expect';
+import '@testing-library/jest-dom';
import <%= h.changeCase.pascal(feature_name) %> from './default';
diff --git a/babel.config.js b/babel.config.js
index 554d6dd020..4c0e9fa3ae 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -3,13 +3,16 @@ module.exports = {
[
"@babel/preset-env",
{
+ targets: {
+ node: "current",
+ },
modules: "commonjs",
},
],
[
"@babel/preset-react",
{
- runtime: "automatic",
+ runtime: "automatic", // default in preset-react v8
},
],
],
@@ -41,6 +44,7 @@ module.exports = {
},
},
],
+ "@babel/plugin-transform-private-methods",
],
},
},
diff --git a/blocks/alert-bar-block/features/alert-bar/default.test.jsx b/blocks/alert-bar-block/features/alert-bar/default.test.jsx
index 1b7ed231a8..69075b6765 100644
--- a/blocks/alert-bar-block/features/alert-bar/default.test.jsx
+++ b/blocks/alert-bar-block/features/alert-bar/default.test.jsx
@@ -1,13 +1,3 @@
-/*
- Enzyme is using an old jsdom that has issues using waitFor on prototype
- methods and this component is using Component constructor and prototypes.
-
- This will set the proper jsdom environment for this specific test need
- until we can convert this away from the component model or update the test.
-
- @jest-environment jsdom-sixteen
-*/
-
import React from "react";
import {
@@ -50,7 +40,7 @@ describe("the alert bar presentational component", () => {
hideAlertHandler={null}
linkText="Basic Headline"
url="#"
- />
+ />,
);
await waitFor(() => expect(container.firstChild).not.toBe(null));
@@ -127,7 +117,7 @@ describe("the alert bar update interval", () => {
window.setInterval = jest.fn((func) => func());
});
afterAll(() => {
- window.setInterval.clearMock();
+ window?.setInterval?.clearMock && window?.setInterval?.clearMock();
});
it("should be called", async () => {
@@ -328,12 +318,15 @@ describe("when the alert is added to the header-nav-chain", () => {
});
const { container, getByRole } = render(
-