From efe7303c904638b16b044b33ed9d1e0be1c1a98c Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 10:00:40 +0300 Subject: [PATCH 01/11] build(rollup): rollup should use the base tsconfig.json that should be esm, not cjs. also exclude is now in tsconfig --- packages/core/rollup.config.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/core/rollup.config.js b/packages/core/rollup.config.js index 778ff2a6b6..c599839c7f 100644 --- a/packages/core/rollup.config.js +++ b/packages/core/rollup.config.js @@ -76,12 +76,7 @@ export default { nodeResolve({ extensions: [...EXTENSIONS, ".json", ".css"] }), - typescript({ - tsconfig: path.join(ROOT_PATH, "tsconfig.esm.json"), - tsconfigOverride: { - exclude: ["**/__tests__", "**/__stories__"] - } - }), + typescript(), babel({ babelHelpers: "bundled", extensions: EXTENSIONS From df81da0a32b052fe826610f411ccc5b8d4436b16 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 10:01:24 +0300 Subject: [PATCH 02/11] build(webpack): webpack should use its own tsconfig.cjs.json as now tsconfig.json is esm --- packages/core/webpack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/webpack.config.js b/packages/core/webpack.config.js index 07cc717d24..a21b76a837 100644 --- a/packages/core/webpack.config.js +++ b/packages/core/webpack.config.js @@ -79,6 +79,7 @@ module.exports = () => { { loader: "ts-loader", options: { + configFile: "tsconfig.cjs.json", onlyCompileBundledFiles: true } } From 8424ac34cbb9f05b5dd0d1f63ffb8a21550b4ec4 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 10:02:04 +0300 Subject: [PATCH 03/11] build: align tsconfig for core library --- packages/core/.storybook/preview.d.ts | 5 ----- packages/core/.storybook/tsconfig.json | 7 +++++++ packages/core/tsconfig.base.json | 12 +++++++++++ packages/core/tsconfig.cjs.json | 6 ++++++ packages/core/tsconfig.esm.json | 7 ------- packages/core/tsconfig.json | 29 +++++++++----------------- 6 files changed, 35 insertions(+), 31 deletions(-) delete mode 100644 packages/core/.storybook/preview.d.ts create mode 100644 packages/core/.storybook/tsconfig.json create mode 100644 packages/core/tsconfig.base.json create mode 100644 packages/core/tsconfig.cjs.json delete mode 100644 packages/core/tsconfig.esm.json diff --git a/packages/core/.storybook/preview.d.ts b/packages/core/.storybook/preview.d.ts deleted file mode 100644 index 22a6c190ce..0000000000 --- a/packages/core/.storybook/preview.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Preview } from "@storybook/react"; -import "monday-ui-style/dist/index.min.css"; -import "vibe-storybook-components/index.css"; -declare const preview: Preview; -export default preview; diff --git a/packages/core/.storybook/tsconfig.json b/packages/core/.storybook/tsconfig.json new file mode 100644 index 0000000000..6b21f65983 --- /dev/null +++ b/packages/core/.storybook/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "resolveJsonModule": true + }, + "include": ["**/*.ts", "**/*.tsx", "**/*.json"] +} diff --git a/packages/core/tsconfig.base.json b/packages/core/tsconfig.base.json new file mode 100644 index 0000000000..85825bccc8 --- /dev/null +++ b/packages/core/tsconfig.base.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "lib": ["esnext", "dom"], + "target": "es6", + "moduleResolution": "node", + "esModuleInterop": true, + "jsx": "react-jsx", + "skipLibCheck": true, + "noImplicitAny": true, + "baseUrl": "." + } +} diff --git a/packages/core/tsconfig.cjs.json b/packages/core/tsconfig.cjs.json new file mode 100644 index 0000000000..7048c297c8 --- /dev/null +++ b/packages/core/tsconfig.cjs.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS" + } +} diff --git a/packages/core/tsconfig.esm.json b/packages/core/tsconfig.esm.json deleted file mode 100644 index d29969f797..0000000000 --- a/packages/core/tsconfig.esm.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*", "types/**/*"], - "compilerOptions": { - "module": "ESNext" - } -} diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 95338c5b37..51a01c8530 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -1,24 +1,15 @@ { - "include": ["src/**/*", "types/**/*"], + "extends": "./tsconfig.base.json", "compilerOptions": { - "rootDirs": ["./src", "./.storybook"], - "lib": ["esnext", "dom"], - "allowJs": true, - "target": "es6", - "module": "CommonJS", - "sourceMap": true, - "moduleResolution": "node", - "resolveJsonModule": true, - "declarationDir": "dist/types", - "experimentalDecorators": true, - "emitDecoratorMetadata": true, + "module": "ESNext", "declaration": true, - "skipLibCheck": true, - "noImplicitAny": true, - "baseUrl": ".", + "declarationDir": "dist/types", + "sourceMap": true, + "allowJs": true, + "rootDir": "src", "allowSyntheticDefaultImports": true, - "jsx": "react-jsx", - "plugins": [{ "name": "typescript-plugin-css-modules" }], - "esModuleInterop": true - } + "plugins": [{ "name": "typescript-plugin-css-modules" }] + }, + "include": ["src/**/*", "types/**/*"], + "exclude": ["**/__tests__", "**/__stories__"] } From c7b42e28fed57c1df49d5a7ff02502ff479e0c11 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 10:04:36 +0300 Subject: [PATCH 04/11] build: react 16.x should be using "react" in tsconfig, not "react-jsx". also, throw errors when not importing react we were warned by ides and ts to not import react. it was caused by this. it also caused components which did not import react, and this is a breaking behavior for react 16 consumers --- packages/core/.eslintrc.js | 2 +- packages/core/tsconfig.base.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index de90d218e7..a35aa28ca0 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -17,7 +17,7 @@ const commonRules = { "no-underscore-dangle": "off", "import/prefer-default-export": "off", "no-plusplus": "off", - "react/react-in-jsx-scope": 0, + "react/react-in-jsx-scope": "error", "react/no-danger": "error", "react/jsx-one-expression-per-line": "off", "react/prop-types": 0, diff --git a/packages/core/tsconfig.base.json b/packages/core/tsconfig.base.json index 85825bccc8..b64ce9843d 100644 --- a/packages/core/tsconfig.base.json +++ b/packages/core/tsconfig.base.json @@ -4,7 +4,7 @@ "target": "es6", "moduleResolution": "node", "esModuleInterop": true, - "jsx": "react-jsx", + "jsx": "react", "skipLibCheck": true, "noImplicitAny": true, "baseUrl": "." From c5dbbdf80071e95e6c8d502911ed69df01964d5b Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 12:37:00 +0300 Subject: [PATCH 05/11] build: ignore importing React for certain files (temporarily, storybook and test related) --- packages/core/.eslintrc.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index a35aa28ca0..84539490c0 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -110,6 +110,23 @@ module.exports = { "react-hooks/rules-of-hooks": "off", "react/jsx-key": "off" } + }, + // TODO This entire block should be removed and fixed, unless we move to React 17+ + { + files: [ + "*.stories.@(js|jsx|ts|tsx)", + "*.stories.helpers.@(js|jsx|ts|tsx)", + "**/__stories__/**/*.{js,jsx,ts,tsx}", + "*.test.@(js|jsx|ts|tsx)", + "**/__tests__/**/*.{js,jsx,ts,tsx}", + "src/storybook/stand-alone-documentaion/**/*.{js,jsx,ts,tsx}", + "src/storybook/patterns/**/*.{js,jsx,ts,tsx}", + "src/storybook/components/**/*.{js,jsx,ts,tsx}", + "src/storybook/decorators/**/*.{js,jsx,ts,tsx}" + ], + rules: { + "react/react-in-jsx-scope": "off" + } } ], env: { From e6397db9b7e1a05cd756cef6aa53ad4f3bc85e4a Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 12:50:00 +0300 Subject: [PATCH 06/11] build: exclude tests and stories related only in rollup --- packages/core/rollup.config.js | 6 +++++- packages/core/tsconfig.json | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/rollup.config.js b/packages/core/rollup.config.js index c599839c7f..50cf4fd6ee 100644 --- a/packages/core/rollup.config.js +++ b/packages/core/rollup.config.js @@ -76,7 +76,11 @@ export default { nodeResolve({ extensions: [...EXTENSIONS, ".json", ".css"] }), - typescript(), + typescript({ + tsconfigOverride: { + exclude: ["**/__tests__", "**/__stories__", path.join(SRC_PATH, "storybook")] + } + }), babel({ babelHelpers: "bundled", extensions: EXTENSIONS diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 51a01c8530..0aa0351c29 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -10,6 +10,5 @@ "allowSyntheticDefaultImports": true, "plugins": [{ "name": "typescript-plugin-css-modules" }] }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["**/__tests__", "**/__stories__"] + "include": ["src/**/*", "types/**/*"] } From 0a157b3732a0fa161b0fab33ab79059cc092e12b Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 12:53:37 +0300 Subject: [PATCH 07/11] fix: include import React --- .../AttentionBox/AttentionBoxLink/AttentionBoxLink.tsx | 4 ++-- .../components/StickyCategoryHeader/StickyCategoryHeader.tsx | 1 + .../core/src/components/DatePicker/YearPicker/YearsList.tsx | 1 + .../Dropdown/components/ChildrenContent/ChildrenContent.jsx | 2 +- packages/core/src/components/Label/Leg.tsx | 2 ++ packages/core/src/components/Menu/MenuDivider/MenuDivider.tsx | 1 + packages/core/src/components/Tipseen/TipseenBasicContent.tsx | 4 ++-- packages/core/src/components/Tipseen/TipseenImage.tsx | 4 ++-- 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/core/src/components/AttentionBox/AttentionBoxLink/AttentionBoxLink.tsx b/packages/core/src/components/AttentionBox/AttentionBoxLink/AttentionBoxLink.tsx index fa7b827f45..4194307290 100644 --- a/packages/core/src/components/AttentionBox/AttentionBoxLink/AttentionBoxLink.tsx +++ b/packages/core/src/components/AttentionBox/AttentionBoxLink/AttentionBoxLink.tsx @@ -1,9 +1,9 @@ -import { FC } from "react"; +import React from "react"; import styles from "./AttentionBoxLink.module.scss"; import Link, { LinkProps } from "../../Link/Link"; import cx from "classnames"; -const AttentionBoxLink: FC = ({ +const AttentionBoxLink: React.FC = ({ href, text, // TODO: use Link's target default in next major diff --git a/packages/core/src/components/Combobox/components/StickyCategoryHeader/StickyCategoryHeader.tsx b/packages/core/src/components/Combobox/components/StickyCategoryHeader/StickyCategoryHeader.tsx index 52066b69f6..bbdf361a70 100644 --- a/packages/core/src/components/Combobox/components/StickyCategoryHeader/StickyCategoryHeader.tsx +++ b/packages/core/src/components/Combobox/components/StickyCategoryHeader/StickyCategoryHeader.tsx @@ -1,3 +1,4 @@ +import React from "react"; import cx from "classnames"; import styles from "./StickyCategoryHeader.module.scss"; import comboboxStyles from "../../Combobox.module.scss"; diff --git a/packages/core/src/components/DatePicker/YearPicker/YearsList.tsx b/packages/core/src/components/DatePicker/YearPicker/YearsList.tsx index 84c2e1efc2..dab8568671 100644 --- a/packages/core/src/components/DatePicker/YearPicker/YearsList.tsx +++ b/packages/core/src/components/DatePicker/YearPicker/YearsList.tsx @@ -1,3 +1,4 @@ +import React from "react"; import Button from "../../Button/Button"; import styles from "./YearPicker.module.scss"; diff --git a/packages/core/src/components/Dropdown/components/ChildrenContent/ChildrenContent.jsx b/packages/core/src/components/Dropdown/components/ChildrenContent/ChildrenContent.jsx index ef308a1ece..0269beb6f4 100644 --- a/packages/core/src/components/Dropdown/components/ChildrenContent/ChildrenContent.jsx +++ b/packages/core/src/components/Dropdown/components/ChildrenContent/ChildrenContent.jsx @@ -1,6 +1,6 @@ +import React, { useCallback } from "react"; import Avatar from "../../../Avatar/Avatar"; import Icon from "../../../Icon/Icon"; -import { useCallback } from "react"; import styles from "./ChildrenContent.module.scss"; import { getTestId } from "../../../../tests/test-ids-utils"; import { ComponentDefaultTestId } from "../../../../tests/constants"; diff --git a/packages/core/src/components/Label/Leg.tsx b/packages/core/src/components/Label/Leg.tsx index aca08c485d..1c81d6aed4 100644 --- a/packages/core/src/components/Label/Leg.tsx +++ b/packages/core/src/components/Label/Leg.tsx @@ -1,3 +1,5 @@ +import React from "react"; + const Leg = () => ( = ({ +const TipseenBasicContent: React.FC = ({ title, children = null, titleClassName, diff --git a/packages/core/src/components/Tipseen/TipseenImage.tsx b/packages/core/src/components/Tipseen/TipseenImage.tsx index 49d2505ac5..a52bfe4c94 100644 --- a/packages/core/src/components/Tipseen/TipseenImage.tsx +++ b/packages/core/src/components/Tipseen/TipseenImage.tsx @@ -1,5 +1,5 @@ import cx from "classnames"; -import { FC } from "react"; +import React from "react"; import styles from "./TipseenImage.module.scss"; import TipseenMedia from "./TipseenMedia/TipseenMedia"; @@ -12,7 +12,7 @@ export interface TipseenImageProps { tipseenMediaClassName?: string; } -const TipseenImage: FC = ({ src, alt, className, tipseenMediaClassName }) => { +const TipseenImage: React.FC = ({ src, alt, className, tipseenMediaClassName }) => { return ( // TODO future breaking change where we remove the TipseenMedia component and we remove TipseenImage? From ae33d69cebc6fddababbfb07822ced24c58bf2e0 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 14:48:31 +0300 Subject: [PATCH 08/11] build: fix storybook typescript errors --- packages/core/.storybook/preview.tsx | 7 +++---- packages/core/plop/component/index.js | 2 +- packages/core/scripts/build-utils.js | 2 +- .../src/components/Icon/__tests__/all-icons-tests.test.ts | 2 +- packages/core/src/components/{index.js => index.ts} | 0 .../core/src/storybook/components/{index.js => index.ts} | 0 packages/core/src/storybook/{index.js => index.ts} | 0 7 files changed, 6 insertions(+), 7 deletions(-) rename packages/core/src/components/{index.js => index.ts} (100%) rename packages/core/src/storybook/components/{index.js => index.ts} (100%) rename packages/core/src/storybook/{index.js => index.ts} (100%) diff --git a/packages/core/.storybook/preview.tsx b/packages/core/.storybook/preview.tsx index 48b0e9286b..18976087e0 100644 --- a/packages/core/.storybook/preview.tsx +++ b/packages/core/.storybook/preview.tsx @@ -1,7 +1,7 @@ import React from "react"; -import * as VibeComponents from "../src/components/index"; +import * as VibeComponents from "../src/components"; import * as VibeComponentsNext from "../src/next"; -import * as VibeIcons from "../src/components/Icon/Icons/index"; +import * as VibeIcons from "../src/components/Icon/Icons"; import { Preview } from "@storybook/react"; import isChromatic from "chromatic/isChromatic"; import { DocsContainer, DocsPage, Unstyled } from "@storybook/blocks"; @@ -25,7 +25,6 @@ import { UsageGuidelines, withMemoryStats, RelatedComponent, - MultipleStoryElementsWrapper, StorybookLink } from "vibe-storybook-components"; import CanvasWrapper from "../src/storybook/components/canvas-wrapper/CanvasWrapper"; @@ -147,7 +146,7 @@ const preview: Preview = { } } }, - + loaders: isChromatic() && document.fonts ? [fontLoader] : [] }; diff --git a/packages/core/plop/component/index.js b/packages/core/plop/component/index.js index d2059554ee..e16e04e04c 100644 --- a/packages/core/plop/component/index.js +++ b/packages/core/plop/component/index.js @@ -58,7 +58,7 @@ module.exports = plop => { }, { type: "append", - path: "src/components/index.js", + path: "src/components/index.ts", pattern: /(\n$)/gm, separator: "", template: diff --git a/packages/core/scripts/build-utils.js b/packages/core/scripts/build-utils.js index 36fbd5f513..df8e8a7e39 100644 --- a/packages/core/scripts/build-utils.js +++ b/packages/core/scripts/build-utils.js @@ -49,7 +49,7 @@ function buildComponentsTypesIndexFile() { function buildStorybookComponentsIndexFile() { const imports = ["import 'vibe-storybook-components/index.css';"]; const exports = ["export * from 'vibe-storybook-components'"]; - convertExportsToFile(imports.concat(exports), "storybook/index.js"); + convertExportsToFile(imports.concat(exports), "storybook/index.ts"); } module.exports = { diff --git a/packages/core/src/components/Icon/__tests__/all-icons-tests.test.ts b/packages/core/src/components/Icon/__tests__/all-icons-tests.test.ts index 4df4629621..e86b291d74 100644 --- a/packages/core/src/components/Icon/__tests__/all-icons-tests.test.ts +++ b/packages/core/src/components/Icon/__tests__/all-icons-tests.test.ts @@ -27,7 +27,7 @@ describe("All icons", () => { }); // Make sure all icons are also exported in allIcons if (missingIcons.length > 0) { - console.error("Missing exported icons in components/Icon/Icons/index.js", missingIcons); + console.error("Missing exported icons in components/Icon/Icons/index.ts", missingIcons); } expect(missingIcons).toEqual([]); }); diff --git a/packages/core/src/components/index.js b/packages/core/src/components/index.ts similarity index 100% rename from packages/core/src/components/index.js rename to packages/core/src/components/index.ts diff --git a/packages/core/src/storybook/components/index.js b/packages/core/src/storybook/components/index.ts similarity index 100% rename from packages/core/src/storybook/components/index.js rename to packages/core/src/storybook/components/index.ts diff --git a/packages/core/src/storybook/index.js b/packages/core/src/storybook/index.ts similarity index 100% rename from packages/core/src/storybook/index.js rename to packages/core/src/storybook/index.ts From 4f81af2ef8dedb95b4a7641f59f25ca232e77780 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 14:57:46 +0300 Subject: [PATCH 09/11] build: tweak paths to ignore --- packages/core/.eslintrc.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index 84539490c0..463b34ab45 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -114,10 +114,7 @@ module.exports = { // TODO This entire block should be removed and fixed, unless we move to React 17+ { files: [ - "*.stories.@(js|jsx|ts|tsx)", - "*.stories.helpers.@(js|jsx|ts|tsx)", "**/__stories__/**/*.{js,jsx,ts,tsx}", - "*.test.@(js|jsx|ts|tsx)", "**/__tests__/**/*.{js,jsx,ts,tsx}", "src/storybook/stand-alone-documentaion/**/*.{js,jsx,ts,tsx}", "src/storybook/patterns/**/*.{js,jsx,ts,tsx}", From b9dbf2ccc8bfdd972f055dbdf933f8c366692791 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 15:23:38 +0300 Subject: [PATCH 10/11] build: fix lint errors on import React --- .../AccordionItem/__tests__/accordionItem-tests.test.tsx | 1 + .../components/Counter/__tests__/counter-snapshot-tests.test.tsx | 1 + .../core/src/components/Counter/__tests__/counter-tests.test.tsx | 1 + .../core/src/components/Label/__tests__/Label-tests.test.tsx | 1 + .../src/components/Link/__tests__/link-snapshot-tests.test.tsx | 1 + packages/core/src/components/Link/__tests__/link-tests.test.tsx | 1 + .../__tests__/multiStepIndicator-tests.test.tsx | 1 + .../RadioButton/__tests__/radioButton-snapshot-tests.test.tsx | 1 + .../components/RadioButton/__tests__/radioButton-tests.test.tsx | 1 + packages/core/src/components/Refable/__tests__/Refable.test.tsx | 1 + 10 files changed, 10 insertions(+) diff --git a/packages/core/src/components/Accordion/AccordionItem/__tests__/accordionItem-tests.test.tsx b/packages/core/src/components/Accordion/AccordionItem/__tests__/accordionItem-tests.test.tsx index 2f5354997b..6fc1563427 100644 --- a/packages/core/src/components/Accordion/AccordionItem/__tests__/accordionItem-tests.test.tsx +++ b/packages/core/src/components/Accordion/AccordionItem/__tests__/accordionItem-tests.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { fireEvent, render, screen } from "@testing-library/react"; import Accordion from "../../Accordion/Accordion"; import AccordionItem from "../AccordionItem"; diff --git a/packages/core/src/components/Counter/__tests__/counter-snapshot-tests.test.tsx b/packages/core/src/components/Counter/__tests__/counter-snapshot-tests.test.tsx index 68d2fa5f3f..e911aeae6f 100644 --- a/packages/core/src/components/Counter/__tests__/counter-snapshot-tests.test.tsx +++ b/packages/core/src/components/Counter/__tests__/counter-snapshot-tests.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import renderer from "react-test-renderer"; import Counter from "../Counter"; diff --git a/packages/core/src/components/Counter/__tests__/counter-tests.test.tsx b/packages/core/src/components/Counter/__tests__/counter-tests.test.tsx index dbb032075f..bcd038444b 100644 --- a/packages/core/src/components/Counter/__tests__/counter-tests.test.tsx +++ b/packages/core/src/components/Counter/__tests__/counter-tests.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { render } from "@testing-library/react"; import Counter from "../Counter"; diff --git a/packages/core/src/components/Label/__tests__/Label-tests.test.tsx b/packages/core/src/components/Label/__tests__/Label-tests.test.tsx index 6bd043ac91..5b73e76542 100644 --- a/packages/core/src/components/Label/__tests__/Label-tests.test.tsx +++ b/packages/core/src/components/Label/__tests__/Label-tests.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { render, fireEvent, screen } from "@testing-library/react"; import Label from "../Label"; import { getTestId } from "../../../tests/test-ids-utils"; diff --git a/packages/core/src/components/Link/__tests__/link-snapshot-tests.test.tsx b/packages/core/src/components/Link/__tests__/link-snapshot-tests.test.tsx index 4afe3bb003..f3322e4575 100644 --- a/packages/core/src/components/Link/__tests__/link-snapshot-tests.test.tsx +++ b/packages/core/src/components/Link/__tests__/link-snapshot-tests.test.tsx @@ -1,4 +1,5 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ +import React from "react"; import renderer from "react-test-renderer"; import Link from "../Link"; diff --git a/packages/core/src/components/Link/__tests__/link-tests.test.tsx b/packages/core/src/components/Link/__tests__/link-tests.test.tsx index 2d809c2713..63679cdb7d 100644 --- a/packages/core/src/components/Link/__tests__/link-tests.test.tsx +++ b/packages/core/src/components/Link/__tests__/link-tests.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { fireEvent, render, screen } from "@testing-library/react"; import Link from "../Link"; diff --git a/packages/core/src/components/MultiStepIndicator/__tests__/multiStepIndicator-tests.test.tsx b/packages/core/src/components/MultiStepIndicator/__tests__/multiStepIndicator-tests.test.tsx index da90773be6..9847dc5699 100644 --- a/packages/core/src/components/MultiStepIndicator/__tests__/multiStepIndicator-tests.test.tsx +++ b/packages/core/src/components/MultiStepIndicator/__tests__/multiStepIndicator-tests.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { fireEvent, render } from "@testing-library/react"; import { act } from "@testing-library/react-hooks"; import MultiStepIndicator, { Step } from "../MultiStepIndicator"; diff --git a/packages/core/src/components/RadioButton/__tests__/radioButton-snapshot-tests.test.tsx b/packages/core/src/components/RadioButton/__tests__/radioButton-snapshot-tests.test.tsx index 1b8d5c25c4..71eca60388 100644 --- a/packages/core/src/components/RadioButton/__tests__/radioButton-snapshot-tests.test.tsx +++ b/packages/core/src/components/RadioButton/__tests__/radioButton-snapshot-tests.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import renderer from "react-test-renderer"; import RadioButton from "../RadioButton"; diff --git a/packages/core/src/components/RadioButton/__tests__/radioButton-tests.test.tsx b/packages/core/src/components/RadioButton/__tests__/radioButton-tests.test.tsx index d9eb78c45e..61e803a243 100644 --- a/packages/core/src/components/RadioButton/__tests__/radioButton-tests.test.tsx +++ b/packages/core/src/components/RadioButton/__tests__/radioButton-tests.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { fireEvent, render, cleanup, screen } from "@testing-library/react"; import RadioButton from "../RadioButton"; diff --git a/packages/core/src/components/Refable/__tests__/Refable.test.tsx b/packages/core/src/components/Refable/__tests__/Refable.test.tsx index e11f2d4258..614ca31c55 100644 --- a/packages/core/src/components/Refable/__tests__/Refable.test.tsx +++ b/packages/core/src/components/Refable/__tests__/Refable.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { cleanup } from "@testing-library/react-hooks"; import { fireEvent, render } from "@testing-library/react"; import { Refable } from "../Refable"; From b85176fcef96cfdfab16597fec0bf521112efef1 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Tue, 21 May 2024 15:32:09 +0300 Subject: [PATCH 11/11] build: require importing React on all tests --- packages/core/.eslintrc.js | 1 - packages/core/src/components/Dialog/__tests__/Dialog.test.js | 1 + .../__tests__/GridKeyboardNavigationContext.test.js | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index 463b34ab45..95865259ed 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -115,7 +115,6 @@ module.exports = { { files: [ "**/__stories__/**/*.{js,jsx,ts,tsx}", - "**/__tests__/**/*.{js,jsx,ts,tsx}", "src/storybook/stand-alone-documentaion/**/*.{js,jsx,ts,tsx}", "src/storybook/patterns/**/*.{js,jsx,ts,tsx}", "src/storybook/components/**/*.{js,jsx,ts,tsx}", diff --git a/packages/core/src/components/Dialog/__tests__/Dialog.test.js b/packages/core/src/components/Dialog/__tests__/Dialog.test.js index c8b64857bf..8af24b02ed 100644 --- a/packages/core/src/components/Dialog/__tests__/Dialog.test.js +++ b/packages/core/src/components/Dialog/__tests__/Dialog.test.js @@ -1,3 +1,4 @@ +import React from "react"; import userEvent from "@testing-library/user-event"; import { render, screen } from "@testing-library/react"; import Dialog from "../Dialog"; diff --git a/packages/core/src/components/GridKeyboardNavigationContext/__tests__/GridKeyboardNavigationContext.test.js b/packages/core/src/components/GridKeyboardNavigationContext/__tests__/GridKeyboardNavigationContext.test.js index 06adc03991..6c2dc0b897 100644 --- a/packages/core/src/components/GridKeyboardNavigationContext/__tests__/GridKeyboardNavigationContext.test.js +++ b/packages/core/src/components/GridKeyboardNavigationContext/__tests__/GridKeyboardNavigationContext.test.js @@ -1,3 +1,4 @@ +import React from "react"; import { act, cleanup, renderHook } from "@testing-library/react-hooks"; import userEvent from "@testing-library/user-event"; import { NavDirections } from "../../../hooks/useFullKeyboardListeners";