From 4012345da0b4b880de1b77befb8989a27de828cf Mon Sep 17 00:00:00 2001 From: evavirseda Date: Wed, 8 Jan 2025 12:22:30 +0100 Subject: [PATCH] refactor(tooling): remove unnecessary `import React from 'react'` (#4612) * feat: remove unnecessary react import * fix: remove debris * fix import * feat: cleanup * feat: remove debris and add tsconfig * fix format --- apps/apps-backend/jest-e2e.json | 22 +++++++++---------- apps/apps-backend/tsconfig.json | 2 +- .../src/components/Inputs/AddressInput.tsx | 2 +- .../components/Inputs/SendTokenFormInput.tsx | 1 - apps/core/src/components/QR.tsx | 1 - .../buttons/ViewTxnOnExplorerButton.tsx | 5 +++-- .../src/components/cards/BalanceChanges.tsx | 2 +- .../components/cards/ObjectChangeDisplay.tsx | 1 - .../src/components/cards/ObjectChanges.tsx | 2 +- apps/core/src/components/coin/CoinItem.tsx | 1 - .../components/collapsible/Collapsible.tsx | 2 +- apps/core/src/components/gas/GasFees.tsx | 1 - apps/core/src/components/gas/GasSummary.tsx | 1 - .../src/components/lists/ExpandableList.tsx | 2 +- apps/core/src/components/stake/StakedCard.tsx | 1 - .../transaction/TransactionReceipt.tsx | 1 - .../transaction/amount/TransactionAmount.tsx | 1 - .../transaction/info/StakeTransactionInfo.tsx | 1 - .../info/UnstakeTransactionInfo.tsx | 1 - .../summary/TransactionSummary.tsx | 2 +- apps/core/tsconfig.json | 13 +++++++++++ apps/explorer/src/index.tsx | 1 - .../src/pages/validator/ValidatorDetails.tsx | 2 +- .../src/pages/validators/Validators.tsx | 2 +- .../src/lib/components/atoms/badge/Badge.tsx | 1 - .../atoms/button-segment/ButtonSegment.tsx | 1 - .../lib/components/atoms/button/Button.tsx | 1 - .../lib/components/atoms/divider/Divider.tsx | 1 - .../lib/components/atoms/info-box/InfoBox.tsx | 1 - .../atoms/key-value-info/KeyValueInfo.tsx | 2 +- .../components/atoms/label-text/LabelText.tsx | 1 - .../components/atoms/list-item/ListItem.tsx | 2 +- .../loading-indicator/LoadingIndicator.tsx | 1 - .../src/lib/components/atoms/panel/Panel.tsx | 1 - .../atoms/radio-button/RadioButton.tsx | 1 - .../lib/components/atoms/tooltip/Tooltip.tsx | 2 +- .../visual-asset-card/VisualAssetCard.tsx | 1 - .../components/molecules/account/Account.tsx | 1 - .../components/molecules/address/Address.tsx | 1 - .../lib/components/molecules/card/Card.tsx | 1 - .../components/molecules/card/CardImage.tsx | 1 - .../molecules/display-stats/DisplayStats.tsx | 2 +- .../molecules/navbar-item/NavbarItem.tsx | 1 - .../navbar-item/NavbarItemHorizontal.tsx | 1 - .../navbar-item/NavbarItemVertical.tsx | 1 - .../components/molecules/search/Search.tsx | 2 +- .../segmented-button/SegmentedButton.tsx | 2 +- .../table-header-cell/TableHeaderCell.tsx | 5 +++-- .../organisms/accordion/Accordion.tsx | 2 +- .../organisms/navbar/NavbarSlideout.tsx | 1 - .../components/VariableSpacingShowcase.tsx | 1 - .../molecules/DisplayStats.stories.tsx | 1 - .../stories/molecules/NavbarItem.stories.tsx | 1 - .../app/(protected)/activity/page.tsx | 1 - .../app/(protected)/layout.tsx | 2 +- .../components/AppList/AppList.tsx | 1 - apps/wallet-dashboard/components/Banner.tsx | 1 - apps/wallet-dashboard/components/Box.tsx | 4 ++-- .../components/Buttons/Button.tsx | 2 -- .../components/Dialogs/Assets/AssetDialog.tsx | 2 +- .../Dialogs/Assets/views/DetailsView.tsx | 1 - .../Dialogs/Assets/views/SendView.tsx | 1 - .../Dialogs/SendToken/SendTokenDialog.tsx | 2 +- .../Dialogs/Staking/StakeDialog.tsx | 2 +- .../Dialogs/Staking/views/DetailsView.tsx | 1 - .../Staking/views/EnterAmountDialogLayout.tsx | 1 - .../Dialogs/Staking/views/EnterAmountView.tsx | 1 - .../views/EnterTimelockedAmountView.tsx | 2 +- .../Staking/views/SelectValidatorView.tsx | 2 -- .../Dialogs/migration/MigrationDialog.tsx | 2 +- .../migration/views/ConfirmMigrationView.tsx | 1 - .../Dialogs/settings/SettingsDialog.tsx | 1 - .../settings/views/SettingsListView.tsx | 1 - .../transaction/TransactionDetailsLayout.tsx | 2 +- apps/wallet-dashboard/components/Input.tsx | 2 -- .../wallet-dashboard/components/RouteLink.tsx | 1 - .../components/VirtualList.tsx | 4 ++-- .../components/coins/MyCoins.tsx | 2 +- .../components/tiles/VisualAssetTile.tsx | 1 - .../transactions/TransactionTile.tsx | 2 +- .../transactions/TransactionsList.tsx | 1 - .../ui/app/components/OutsideClickHandler.tsx | 2 +- .../accounts/UnlockAccountContext.tsx | 9 +------- .../pages/accounts/manage/AccountGroup.tsx | 2 +- 84 files changed, 62 insertions(+), 107 deletions(-) create mode 100644 apps/core/tsconfig.json diff --git a/apps/apps-backend/jest-e2e.json b/apps/apps-backend/jest-e2e.json index 8a02f0e8a41..a3ce13344dd 100644 --- a/apps/apps-backend/jest-e2e.json +++ b/apps/apps-backend/jest-e2e.json @@ -1,13 +1,13 @@ { - "moduleFileExtensions": ["js", "json", "ts"], - "rootDir": "./", - "testRegex": ".e2e-spec.ts$", - "transform": { - "^.+\\.(t|j)s$": "ts-jest" - }, - "testEnvironment": "node", - "moduleNameMapper": { - "^src/(.*)$": "/dist/$1", - "^@iota/core/(.*)$": "/dist/core/src/$1" - } + "moduleFileExtensions": ["js", "json", "ts"], + "rootDir": "./", + "testRegex": ".e2e-spec.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + }, + "testEnvironment": "node", + "moduleNameMapper": { + "^src/(.*)$": "/dist/$1", + "^@iota/core/(.*)$": "/dist/core/src/$1" + } } diff --git a/apps/apps-backend/tsconfig.json b/apps/apps-backend/tsconfig.json index 11f5788c888..62acc1f8668 100644 --- a/apps/apps-backend/tsconfig.json +++ b/apps/apps-backend/tsconfig.json @@ -20,5 +20,5 @@ "paths": { "@iota/core/constants/*": ["./../core/src/constants/*"] } - }, + } } diff --git a/apps/core/src/components/Inputs/AddressInput.tsx b/apps/core/src/components/Inputs/AddressInput.tsx index 63920a9afe0..75d80154ea0 100644 --- a/apps/core/src/components/Inputs/AddressInput.tsx +++ b/apps/core/src/components/Inputs/AddressInput.tsx @@ -5,7 +5,7 @@ import { Input, InputType } from '@iota/apps-ui-kit'; import { Close } from '@iota/ui-icons'; import { useIotaAddressValidation } from '../../hooks'; -import React, { useCallback } from 'react'; +import { useCallback } from 'react'; import { useField, useFormikContext } from 'formik'; export interface AddressInputProps { diff --git a/apps/core/src/components/Inputs/SendTokenFormInput.tsx b/apps/core/src/components/Inputs/SendTokenFormInput.tsx index 3e97b41c707..5a0862e6b37 100644 --- a/apps/core/src/components/Inputs/SendTokenFormInput.tsx +++ b/apps/core/src/components/Inputs/SendTokenFormInput.tsx @@ -1,7 +1,6 @@ // Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import React from 'react'; import { ButtonPill, Input, InputType } from '@iota/apps-ui-kit'; import { CoinStruct } from '@iota/iota-sdk/client'; import { useFormatCoin, useGasBudgetEstimation } from '../../hooks'; diff --git a/apps/core/src/components/QR.tsx b/apps/core/src/components/QR.tsx index 7ab47b246e3..2c4b806b161 100644 --- a/apps/core/src/components/QR.tsx +++ b/apps/core/src/components/QR.tsx @@ -1,7 +1,6 @@ // Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import React from 'react'; import { QRCodeSVG } from 'qrcode.react'; export enum QRLevel { diff --git a/apps/core/src/components/buttons/ViewTxnOnExplorerButton.tsx b/apps/core/src/components/buttons/ViewTxnOnExplorerButton.tsx index 247241de188..1ad3734b4ee 100644 --- a/apps/core/src/components/buttons/ViewTxnOnExplorerButton.tsx +++ b/apps/core/src/components/buttons/ViewTxnOnExplorerButton.tsx @@ -1,7 +1,6 @@ // Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import React, { JSX } from 'react'; import { Button, ButtonType, LoadingIndicator } from '@iota/apps-ui-kit'; import { ArrowTopRight } from '@iota/ui-icons'; @@ -9,7 +8,9 @@ interface ViewTxnOnExplorerButtonProps { digest?: string; } -export function ViewTxnOnExplorerButton({ digest }: ViewTxnOnExplorerButtonProps): JSX.Element { +export function ViewTxnOnExplorerButton({ + digest, +}: ViewTxnOnExplorerButtonProps): React.JSX.Element { return (