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: remove dupe imports, lint #4855

Merged
merged 1 commit into from
Jan 24, 2024
Merged
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
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
// methods, such as implicit use of signed transactions
'deprecation/deprecation': 'warn',
'no-console': ['error'],
'no-duplicate-imports': ['error'],
'prefer-const': [
'error',
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { fetchWalletConfig, generateWallet } from '@stacks/wallet-sdk';
import { connectToGaiaHubWithConfig, getHubInfo } from '@stacks/wallet-sdk';
import {
connectToGaiaHubWithConfig,
fetchWalletConfig,
generateWallet,
getHubInfo,
} from '@stacks/wallet-sdk';

import { gaiaUrl as gaiaHubUrl } from '@shared/constants';

Expand Down
3 changes: 1 addition & 2 deletions src/app/common/hooks/use-bitcoin-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import {
import { Money, createMoneyFromDecimal } from '@shared/models/money.model';
import { RouteUrls } from '@shared/route-urls';
import { BitcoinContractResponseStatus } from '@shared/rpc/methods/accept-bitcoin-contract';
import { makeRpcSuccessResponse } from '@shared/rpc/rpc-methods';
import { makeRpcErrorResponse } from '@shared/rpc/rpc-methods';
import { makeRpcErrorResponse, makeRpcSuccessResponse } from '@shared/rpc/rpc-methods';

import { sendAcceptedBitcoinContractOfferToProtocolWallet } from '@app/query/bitcoin/contract/send-accepted-bitcoin-contract-offer';
import {
Expand Down
6 changes: 4 additions & 2 deletions src/app/common/transactions/bitcoin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import BigNumber from 'bignumber.js';
import { getAddressInfo, validate } from 'bitcoin-address-validation';

import { BTC_P2WPKH_DUST_AMOUNT } from '@shared/constants';
import { BitcoinTransactionVectorOutput } from '@shared/models/transactions/bitcoin-transaction.model';
import { BitcoinTx } from '@shared/models/transactions/bitcoin-transaction.model';
import {
BitcoinTransactionVectorOutput,
BitcoinTx,
} from '@shared/models/transactions/bitcoin-transaction.model';

import { sumNumbers } from '@app/common/math/helpers';
import { satToBtc } from '@app/common/money/unit-conversion';
Expand Down
3 changes: 1 addition & 2 deletions src/app/common/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getTicker } from '@app/common/utils';
import { extractPhraseFromString } from '@app/common/utils';
import { extractPhraseFromString, getTicker } from '@app/common/utils';

import { countDecimals } from './math/helpers';

Expand Down
3 changes: 1 addition & 2 deletions src/app/components/app-version.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useMemo } from 'react';
import { forwardRef } from 'react';
import { forwardRef, useMemo } from 'react';

import { HTMLStyledProps, styled } from 'leather-styles/jsx';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { CryptoAssetSelectors } from '@tests/selectors/crypto-asset.selectors';
import { Flex } from 'leather-styles/jsx';
import { styled } from 'leather-styles/jsx';
import { Flex, styled } from 'leather-styles/jsx';

import { CryptoCurrencies } from '@shared/models/currencies.model';
import { Money } from '@shared/models/money.model';
Expand Down
3 changes: 1 addition & 2 deletions src/app/components/fees-row/components/fees-row.layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useField } from 'formik';
import { HstackProps, styled } from 'leather-styles/jsx';
import { HStack } from 'leather-styles/jsx';
import { HStack, HstackProps, styled } from 'leather-styles/jsx';

import { openInNewTab } from '@app/common/utils/open-in-new-tab';
import { SponsoredLabel } from '@app/components/sponsored-label';
Expand Down
3 changes: 1 addition & 2 deletions src/app/features/bitcoin-choose-fee/bitcoin-choose-fee.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState } from 'react';

import { Box, FlexProps, Stack } from 'leather-styles/jsx';
import { styled } from 'leather-styles/jsx';
import { Box, FlexProps, Stack, styled } from 'leather-styles/jsx';

import { BtcFeeType } from '@shared/models/fees/bitcoin-fees.model';
import { Money } from '@shared/models/money.model';
Expand Down
3 changes: 1 addition & 2 deletions src/app/features/container/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { Outlet, useLocation } from 'react-router-dom';

import { closeWindow } from '@shared/utils';

import { useInitalizeAnalytics } from '@app/common/hooks/analytics/use-analytics';
import { useAnalytics } from '@app/common/hooks/analytics/use-analytics';
import { useAnalytics, useInitalizeAnalytics } from '@app/common/hooks/analytics/use-analytics';
import { LoadingSpinner } from '@app/components/loading-spinner';
import { useOnSignOut } from '@app/routes/hooks/use-on-sign-out';
import { useOnWalletLock } from '@app/routes/hooks/use-on-wallet-lock';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useLayoutEffect, useRef, useState } from 'react';
import Confetti from 'react-dom-confetti';

import { Dialog } from '@radix-ui/themes';
import { Inset } from '@radix-ui/themes';
import { Dialog, Inset } from '@radix-ui/themes';
import { css } from 'leather-styles/css';
import { Box, Flex, Stack, styled } from 'leather-styles/jsx';

Expand Down
2 changes: 1 addition & 1 deletion src/app/features/ledger/utils/stacks-ledger-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
SemVerObject,
prepareLedgerDeviceForAppFn,
promptOpenAppOnDevice,
versionObjectToVersionString,
} from './generic-ledger-utils';
import { versionObjectToVersionString } from './generic-ledger-utils';

export function requestPublicKeyForStxAccount(app: StacksApp) {
return async (index: number) =>
Expand Down
3 changes: 1 addition & 2 deletions src/app/features/message-signer/message-preview-box.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Stack } from 'leather-styles/jsx';
import { styled } from 'leather-styles/jsx';
import { Stack, styled } from 'leather-styles/jsx';

import { HashDrawer } from './hash-drawer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box, Circle, HStack } from 'leather-styles/jsx';
import { styled } from 'leather-styles/jsx';
import { Box, Circle, HStack, styled } from 'leather-styles/jsx';

import { LockIcon } from '@app/ui/components/icons/lock-icon';

Expand Down
6 changes: 4 additions & 2 deletions src/app/pages/bitcoin-contract-list/bitcoin-contract-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { useState } from 'react';

import { Flex, styled } from 'leather-styles/jsx';

import { useBitcoinContracts } from '@app/common/hooks/use-bitcoin-contracts';
import { BitcoinContractListItem } from '@app/common/hooks/use-bitcoin-contracts';
import {
BitcoinContractListItem,
useBitcoinContracts,
} from '@app/common/hooks/use-bitcoin-contracts';
import { useOnMount } from '@app/common/hooks/use-on-mount';
import { FullPageLoadingSpinner } from '@app/components/loading-spinner';
import { truncateMiddle } from '@app/ui/utils/truncate-middle';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { Stack } from 'leather-styles/jsx';
import { RouteUrls } from '@shared/route-urls';
import { BitcoinContractResponseStatus } from '@shared/rpc/methods/accept-bitcoin-contract';

import { useBitcoinContracts } from '@app/common/hooks/use-bitcoin-contracts';
import { BitcoinContractOfferDetails } from '@app/common/hooks/use-bitcoin-contracts';
import {
BitcoinContractOfferDetails,
useBitcoinContracts,
} from '@app/common/hooks/use-bitcoin-contracts';
import { useOnMount } from '@app/common/hooks/use-on-mount';
import { initialSearchParams } from '@app/common/initial-search-params';
import { useCurrentAccountNativeSegwitSigner } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BitcoinContractRequestSelectors } from '@tests/selectors/bitcoin-contract-request.selectors';
import { Flex } from 'leather-styles/jsx';
import { styled } from 'leather-styles/jsx';
import { Flex, styled } from 'leather-styles/jsx';

interface BitcoinContractEmergencyRefundTimeProps {
emergencyRefundTime: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { SettingsSelectors } from '@tests/selectors/settings.selectors';
import { Box, Flex, Stack } from 'leather-styles/jsx';
import { styled } from 'leather-styles/jsx';
import { Box, Flex, Stack, styled } from 'leather-styles/jsx';

import { NetworkConfiguration } from '@shared/constants';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Flex } from 'leather-styles/jsx';
import { HStack, styled } from 'leather-styles/jsx';
import { Flex, HStack, styled } from 'leather-styles/jsx';

interface CollectibleAssetProps {
icon: React.JSX.Element;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ChangeEvent } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import { type ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';

import { SendCryptoAssetSelectors } from '@tests/selectors/send.selectors';
import { useField } from 'formik';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box } from 'leather-styles/jsx';
import { Flex } from 'leather-styles/jsx';
import { Box, Flex } from 'leather-styles/jsx';

import { Money } from '@shared/models/money.model';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Field, useField } from 'formik';
import { Flex } from 'leather-styles/jsx';
import { styled } from 'leather-styles/jsx';
import { Flex, styled } from 'leather-styles/jsx';

import { useOnMount } from '@app/common/hooks/use-on-mount';
import { Flag } from '@app/components/layout/flag';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState } from 'react';
import { toast } from 'react-hot-toast';
import { Outlet } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';
import { Outlet, useLocation, useNavigate } from 'react-router-dom';

import { Stack } from 'leather-styles/jsx';
import get from 'lodash.get';
Expand Down
9 changes: 5 additions & 4 deletions src/app/query/common/market-data/market-data.hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useMemo } from 'react';
import { useCallback } from 'react';
import { useCallback, useMemo } from 'react';

import BigNumber from 'bignumber.js';

Expand All @@ -8,8 +7,10 @@ import { MarketData, createMarketData, createMarketPair } from '@shared/models/m
import { Money, createMoney, currencyDecimalsMap } from '@shared/models/money.model';

import { calculateMeanAverage } from '@app/common/math/calculate-averages';
import { convertAmountToFractionalUnit } from '@app/common/money/calculate-money';
import { baseCurrencyAmountInQuote } from '@app/common/money/calculate-money';
import {
baseCurrencyAmountInQuote,
convertAmountToFractionalUnit,
} from '@app/common/money/calculate-money';

import {
selectBinanceUsdPrice,
Expand Down
10 changes: 6 additions & 4 deletions src/app/store/accounts/blockchain/bitcoin/bitcoin.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import AppClient from 'ledger-bitcoin';
import { getBitcoinJsLibNetworkConfigByMode } from '@shared/crypto/bitcoin/bitcoin.network';
import {
extractAddressIndexFromPath,
getInputPaymentType,
getTaprootAddress,
} from '@shared/crypto/bitcoin/bitcoin.utils';
import { getInputPaymentType } from '@shared/crypto/bitcoin/bitcoin.utils';
import { getTaprootAccountDerivationPath } from '@shared/crypto/bitcoin/p2tr-address-gen';
import { getNativeSegwitAccountDerivationPath } from '@shared/crypto/bitcoin/p2wpkh-address-gen';
import {
Expand Down Expand Up @@ -40,10 +40,12 @@ import {
useCurrentAccountNativeSegwitSigner,
useCurrentNativeSegwitAccount,
useUpdateLedgerSpecificNativeSegwitBip32DerivationForAdddressIndexZero,
useUpdateLedgerSpecificNativeSegwitUtxoHexForAdddressIndexZero,
} from './native-segwit-account.hooks';
import { useUpdateLedgerSpecificNativeSegwitUtxoHexForAdddressIndexZero } from './native-segwit-account.hooks';
import { useCurrentTaprootAccount } from './taproot-account.hooks';
import { useUpdateLedgerSpecificTaprootInputPropsForAdddressIndexZero } from './taproot-account.hooks';
import {
useCurrentTaprootAccount,
useUpdateLedgerSpecificTaprootInputPropsForAdddressIndexZero,
} from './taproot-account.hooks';

// Checks for both TR and NativeSegwit hooks
export function useHasCurrentBitcoinAccount() {
Expand Down
3 changes: 1 addition & 2 deletions src/background/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// This file is the entrypoint to the extension's background script
// https://developer.chrome.com/docs/extensions/mv3/architecture-overview/#background_script
import { logger } from '@shared/logger';
import { CONTENT_SCRIPT_PORT } from '@shared/message-types';
import type { LegacyMessageFromContentScript } from '@shared/message-types';
import { CONTENT_SCRIPT_PORT, type LegacyMessageFromContentScript } from '@shared/message-types';
import { RouteUrls } from '@shared/route-urls';
import { WalletRequests } from '@shared/rpc/rpc-methods';
import { warnUsersAboutDevToolsDangers } from '@shared/utils/dev-tools-warning-log';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { RpcErrorCode } from '@btckit/types';

import { RouteUrls } from '@shared/route-urls';
import { BitcoinContractRequest } from '@shared/rpc/methods/accept-bitcoin-contract';
import { BitcoinContractResponseStatus } from '@shared/rpc/methods/accept-bitcoin-contract';
import {
BitcoinContractRequest,
BitcoinContractResponseStatus,
} from '@shared/rpc/methods/accept-bitcoin-contract';
import { makeRpcErrorResponse } from '@shared/rpc/rpc-methods';

import {
Expand Down
3 changes: 1 addition & 2 deletions src/shared/crypto/bitcoin/bitcoin.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import * as btc from '@scure/btc-signer';

import { BitcoinNetworkModes, NetworkModes } from '@shared/constants';
import { logger } from '@shared/logger';
import { defaultWalletKeyId } from '@shared/utils';
import { isDefined, whenNetwork } from '@shared/utils';
import { defaultWalletKeyId, isDefined, whenNetwork } from '@shared/utils';

import { DerivationPathDepth } from '../derivation-path.utils';
import { BtcSignerNetwork, getBtcSignerLibNetworkConfigByMode } from './bitcoin.network';
Expand Down
Loading