Skip to content

Commit

Permalink
refactor(tooling): remove unnecessary import React from 'react' (#4612
Browse files Browse the repository at this point in the history
)

* feat: remove unnecessary react import

* fix: remove debris

* fix import

* feat: cleanup

* feat: remove debris and add tsconfig

* fix format
  • Loading branch information
evavirseda authored Jan 8, 2025
1 parent c2df0aa commit 4012345
Show file tree
Hide file tree
Showing 84 changed files with 62 additions and 107 deletions.
22 changes: 11 additions & 11 deletions apps/apps-backend/jest-e2e.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": "./",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"testEnvironment": "node",
"moduleNameMapper": {
"^src/(.*)$": "<rootDir>/dist/$1",
"^@iota/core/(.*)$": "<rootDir>/dist/core/src/$1"
}
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": "./",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"testEnvironment": "node",
"moduleNameMapper": {
"^src/(.*)$": "<rootDir>/dist/$1",
"^@iota/core/(.*)$": "<rootDir>/dist/core/src/$1"
}
}
2 changes: 1 addition & 1 deletion apps/apps-backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"paths": {
"@iota/core/constants/*": ["./../core/src/constants/*"]
}
},
}
}
2 changes: 1 addition & 1 deletion apps/core/src/components/Inputs/AddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion apps/core/src/components/Inputs/SendTokenFormInput.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
1 change: 0 additions & 1 deletion apps/core/src/components/QR.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions apps/core/src/components/buttons/ViewTxnOnExplorerButton.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// 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';

interface ViewTxnOnExplorerButtonProps {
digest?: string;
}

export function ViewTxnOnExplorerButton({ digest }: ViewTxnOnExplorerButtonProps): JSX.Element {
export function ViewTxnOnExplorerButton({
digest,
}: ViewTxnOnExplorerButtonProps): React.JSX.Element {
return (
<Button
type={ButtonType.Outlined}
Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/components/cards/BalanceChanges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React, { useMemo } from 'react';
import { useMemo } from 'react';
import { Divider, Header, KeyValueInfo, Panel } from '@iota/apps-ui-kit';
import type { BalanceChangeSummary, RenderExplorerLink } from '../../types';
import { ExplorerLinkType } from '../../enums';
Expand Down
1 change: 0 additions & 1 deletion apps/core/src/components/cards/ObjectChangeDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { type IotaObjectChangeWithDisplay, ExplorerLinkType, ImageIcon } from '../../';
import { Card, CardAction, CardActionType, CardBody, CardImage, CardType } from '@iota/apps-ui-kit';
import { ArrowTopRight } from '@iota/ui-icons';
Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/components/cards/ObjectChanges.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
import React, { useState } from 'react';
import { useState } from 'react';
import {
getObjectChangeLabel,
type ObjectChangesByOwner,
Expand Down
1 change: 0 additions & 1 deletion apps/core/src/components/coin/CoinItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import {
Card,
CardAction,
Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/components/collapsible/Collapsible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React, { useState, type ReactNode } from 'react';
import { useState, type ReactNode } from 'react';
import { Accordion, AccordionContent, AccordionHeader, Title, TitleSize } from '@iota/apps-ui-kit';

interface CollapsibleProps extends React.PropsWithChildren {
Expand Down
1 change: 0 additions & 1 deletion apps/core/src/components/gas/GasFees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { TitleSize, Badge, BadgeType, Title, Panel } from '@iota/apps-ui-kit';
import { Collapsible, GasSummary, type RenderExplorerLink, type GasSummaryType } from '../../';

Expand Down
1 change: 0 additions & 1 deletion apps/core/src/components/gas/GasSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { ExplorerLinkType, useFormatCoin, type GasSummaryType } from '../../';
import { RenderExplorerLink } from '../../types';
import { formatAddress, IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
Expand Down
2 changes: 1 addition & 1 deletion apps/core/src/components/lists/ExpandableList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

import clsx from 'clsx';
import React, { useMemo, useState, type ReactNode } from 'react';
import { useMemo, useState, type ReactNode } from 'react';
import { TriangleDown } from '@iota/ui-icons';
import { Button, ButtonSize, ButtonType } from '@iota/apps-ui-kit';

Expand Down
1 change: 0 additions & 1 deletion apps/core/src/components/stake/StakedCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useIotaClientQuery } from '@iota/dapp-kit';
import { ImageIcon } from '../icon';
import { ExtendedDelegatedStake } from '../../utils';
import { useFormatCoin, useStakeRewardStatus } from '../../hooks';
import React from 'react';

interface StakedCardProps {
extendedStake: ExtendedDelegatedStake;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { InfoBox, InfoBoxStyle, InfoBoxType } from '@iota/apps-ui-kit';
import { formatDate, type useTransactionSummary } from '../../hooks';
import { CheckmarkFilled } from '@iota/ui-icons';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { ImageIconSize, CoinIcon } from '../..';
import {
Card,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { Divider, KeyValueInfo, Panel, TooltipPosition } from '@iota/apps-ui-kit';
import { type GasSummaryType, useStakeTxnInfo, GasSummary } from '../../../';
import { RenderExplorerLink } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { TransactionAmount } from '../amount';
import type { IotaEvent } from '@iota/iota-sdk/client';
import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
import React from 'react';

import { type TransactionSummaryType } from '../../..';
import { BalanceChanges, ObjectChanges } from '../../cards';
import { LoadingIndicator, Title, TitleSize } from '@iota/apps-ui-kit';
Expand Down
13 changes: 13 additions & 0 deletions apps/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"jsx": "react-jsx",
"module": "ESNext",
"target": "ES2020",
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"skipLibCheck": true
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
1 change: 0 additions & 1 deletion apps/explorer/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { QueryClientProvider } from '@tanstack/react-query';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { RouterProvider } from 'react-router-dom';

import { growthbook, initAmplitude, initSentry, queryClient } from './lib/utils';
import { router } from './pages';

Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/pages/validator/ValidatorDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { useGetValidatorsApy, useGetValidatorsEvents } from '@iota/core';
import { useIotaClientQuery } from '@iota/dapp-kit';
import { type IotaSystemStateSummary } from '@iota/iota-sdk/client';
import React, { useMemo } from 'react';
import { useMemo } from 'react';
import { useParams } from 'react-router-dom';
import { PageLayout, ValidatorMeta, ValidatorStats } from '~/components';
import { VALIDATOR_LOW_STAKE_GRACE_PERIOD } from '~/lib/constants';
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/pages/validators/Validators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React, { type JSX, useMemo } from 'react';
import { type JSX, useMemo } from 'react';
import { roundFloat, useFormatCoin, useGetValidatorsApy, useGetValidatorsEvents } from '@iota/core';
import {
DisplayStats,
Expand Down
1 change: 0 additions & 1 deletion apps/ui-kit/src/lib/components/atoms/badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { BadgeType } from './badge.enums';
import { BACKGROUND_COLORS, BADGE_TEXT_CLASS, BORDER_COLORS, TEXT_COLORS } from './badge.classes';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import {
BACKGROUND_COLORS,
BACKGROUND_COLORS_SELECTED,
Expand Down
1 change: 0 additions & 1 deletion apps/ui-kit/src/lib/components/atoms/button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { ButtonHtmlType, ButtonSize, ButtonType } from './button.enums';
import {
PADDINGS,
Expand Down
1 change: 0 additions & 1 deletion apps/ui-kit/src/lib/components/atoms/divider/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { DividerType } from './divider.enums';
import cx from 'classnames';
import { BACKGROUND_COLORS, DIVIDER_FULL_WIDTH } from './divider.classes';
Expand Down
1 change: 0 additions & 1 deletion apps/ui-kit/src/lib/components/atoms/info-box/InfoBox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { InfoBoxStyle, InfoBoxType } from './info-box.enums';
import { BACKGROUND_COLORS, ICON_COLORS } from './info-box.classes';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React, { ReactNode } from 'react';
import { ReactNode } from 'react';
import cx from 'classnames';
import { Copy, Info } from '@iota/ui-icons';
import { ValueSize } from './keyValue.enums';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { LabelTextSize } from './labelText.enums';
import { LABEL_TEXT_SIZE, SUPPORTING_TEXT_SIZE, TEXT_SIZE } from './labelText.classes';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React, { PropsWithChildren } from 'react';
import { PropsWithChildren } from 'react';
import cx from 'classnames';
import { ArrowRight } from '@iota/ui-icons';
import { Button, ButtonSize, ButtonType } from '@/components';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { Loader } from '@iota/ui-icons';

Expand Down
1 change: 0 additions & 1 deletion apps/ui-kit/src/lib/components/atoms/panel/Panel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';

interface PanelProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { RadioOn, RadioOff } from '@iota/ui-icons';

Expand Down
2 changes: 1 addition & 1 deletion apps/ui-kit/src/lib/components/atoms/tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React, { PropsWithChildren } from 'react';
import { PropsWithChildren } from 'react';
import cx from 'classnames';
import { TooltipPosition } from './tooltip.enums';
import { TOOLTIP_POSITION } from './tooltip.classes';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { VisualAssetType } from './visual-asset-card.enums';
import { ButtonUnstyled } from '../button';
import { MoreHoriz } from '@iota/ui-icons';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { ButtonUnstyled } from '../../atoms/button';
import { Badge, BadgeType } from '../../atoms';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { Copy, ArrowTopRight } from '@iota/ui-icons';
import { ButtonUnstyled } from '../../atoms/button';
Expand Down
1 change: 0 additions & 1 deletion apps/ui-kit/src/lib/components/molecules/card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { CARD_DISABLED_CLASSES, CARD_TYPE_CLASSES } from './card.classes';
import { CardType } from './card.enums';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import { ImageType, ImageShape } from './card.enums';
import { IMAGE_BG_CLASSES, IMAGE_VARIANT_CLASSES } from './card.classes';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React, { ReactNode } from 'react';
import { ReactNode } from 'react';
import { Tooltip, TooltipPosition } from '../../atoms';
import { Info } from '@iota/ui-icons';
import { DisplayStatsType, DisplayStatsSize } from './display-stats.enums';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { NavbarItemHorizontal } from './NavbarItemHorizontal';
import { NavbarItemVertical } from './NavbarItemVertical';
import { NavbarItemType } from './navbarItem.enums';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import cx from 'classnames';
import {
BADGE_WITH_TEXT,
Expand Down
Loading

0 comments on commit 4012345

Please sign in to comment.