Skip to content

Commit

Permalink
chore: turn on eslint rule and fix up some core internal imports
Browse files Browse the repository at this point in the history
but not all, as some are not exported yet
  • Loading branch information
teebszet committed Oct 27, 2023
1 parent eb6366b commit 20e47d5
Show file tree
Hide file tree
Showing 23 changed files with 64 additions and 51 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
"rules": {
"consistent-return": "off",
"import/prefer-default-export": 1,
"import/no-internal-modules": [
"warn",
{
"allow": ["./**/*", "../**/*"]
}
],
"no-promise-executor-return": "warn",
"max-len": "off",
"no-inline-styles/no-inline-styles": 2,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"*.{ts,tsx}": [
"prettier --write",
"eslint",
"tsc-files --noEmit"
"tsc-files --noEmit src/styled.d.ts src/react-app-env.d.ts"
],
"*.json": [
"prettier --write"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import useNetworkSelector from '@hooks/useNetwork';
import useOnOriginTabClose from '@hooks/useOnTabClosed';
import {
addressToString,
Args,
broadcastSignedTransaction,
Coin,
ContractFunction,
extractFromPayload,
} from '@secretkeylabs/xverse-core';
import { Args, ContractFunction } from '@secretkeylabs/xverse-core/types/api/stacks/transaction';
import { ContractCallPayload } from '@stacks/connect';
import {
ClarityType,
Expand Down
2 changes: 1 addition & 1 deletion src/app/hooks/queries/useBtcWalletData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import useBtcClient from '@hooks/useBtcClient';
import { BtcAddressData } from '@secretkeylabs/xverse-core/types';
import type { BtcAddressData } from '@secretkeylabs/xverse-core';
import { SetBtcWalletDataAction } from '@stores/wallet/actions/actionCreators';
import { useQuery } from '@tanstack/react-query';
import BigNumber from 'bignumber.js';
Expand Down
4 changes: 2 additions & 2 deletions src/app/hooks/queries/usePendingOrdinalTx.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BtcAddressMempool } from '@secretkeylabs/xverse-core/types/api/esplora';
import { useQuery } from '@tanstack/react-query';
import useBtcClient from '@hooks/useBtcClient';
import type { BtcAddressMempool } from '@secretkeylabs/xverse-core';
import { useQuery } from '@tanstack/react-query';
import useWalletSelector from '../useWalletSelector';

const usePendingOrdinalTxs = (ordinalUtxoHash: string | undefined) => {
Expand Down
9 changes: 4 additions & 5 deletions src/app/hooks/queries/useStacksCollectibles.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { NftsListData } from '@secretkeylabs/xverse-core/types';
import { getNfts } from '@secretkeylabs/xverse-core/api/stacks';
import { useInfiniteQuery } from '@tanstack/react-query';
import useWalletSelector from '@hooks/useWalletSelector';
import useNetworkSelector from '@hooks/useNetwork';
import { InvalidParamsError, handleRetries } from '@utils/query';
import useWalletSelector from '@hooks/useWalletSelector';
import { getNfts, NftsListData } from '@secretkeylabs/xverse-core';
import { useInfiniteQuery } from '@tanstack/react-query';
import { handleRetries, InvalidParamsError } from '@utils/query';

const useStacksCollectibles = () => {
const { stxAddress } = useWalletSelector();
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/home/coinSelectModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import IconStacks from '@assets/img/dashboard/stack_icon.svg';
import BottomModal from '@components/bottomModal';
import TokenTile from '@components/tokenTile';
import useWalletSelector from '@hooks/useWalletSelector';
import { FungibleToken } from '@secretkeylabs/xverse-core/types';
import type { FungibleToken } from '@secretkeylabs/xverse-core';
import { useTranslation } from 'react-i18next';
import styled, { useTheme } from 'styled-components';

Expand Down
4 changes: 2 additions & 2 deletions src/app/screens/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ActionButton from '@components/button';
import ReceiveCardComponent from '@components/receiveCardComponent';
import ShowBtcReceiveAlert from '@components/showBtcReceiveAlert';
import ShowOrdinalReceiveAlert from '@components/showOrdinalReceiveAlert';
import SquareButton from '@components/squareButton';
import BottomBar from '@components/tabBar';
import TokenTile from '@components/tokenTile';
import UpdatedBottomModal from '@components/updatedBottomModal';
Expand All @@ -25,7 +26,7 @@ import useStxWalletData from '@hooks/queries/useStxWalletData';
import useWalletSelector from '@hooks/useWalletSelector';
import { ArrowDown, ArrowUp, Plus } from '@phosphor-icons/react';
import CoinSelectModal from '@screens/home/coinSelectModal';
import { FungibleToken } from '@secretkeylabs/xverse-core/types';
import type { FungibleToken } from '@secretkeylabs/xverse-core';
import { changeShowDataCollectionAlertAction } from '@stores/wallet/actions/actionCreators';
import { CurrencyTypes } from '@utils/constants';
import { isLedgerAccount } from '@utils/helper';
Expand All @@ -36,7 +37,6 @@ import { useDispatch } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import styled, { useTheme } from 'styled-components';
import Theme from 'theme';
import SquareButton from '../../components/squareButton';
import BalanceCard from './balanceCard';

export const Container = styled.div((props) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/nftDashboard/collectiblesTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ActionButton from '@components/button';
import { StyledBarLoader, TilesSkeletonLoader } from '@components/tilesSkeletonLoader';
import WrenchErrorMessage from '@components/wrenchErrorMessage';
import { StyledP, StyledTab, StyledTabList } from '@ui-library/common.styled';
import { ApiBundle, Bundle, mapRareSatsAPIResponseToRareSats } from '@utils/rareSats';
Expand All @@ -8,7 +9,6 @@ import { useNavigate, useSearchParams } from 'react-router-dom';
import { TabPanel, Tabs } from 'react-tabs';
import styled from 'styled-components';
import type { NftDashboardState } from '.';
import { StyledBarLoader, TilesSkeletonLoader } from '../../components/tilesSkeletonLoader';
import Notice from './notice';
import RareSatsTabGridItem from './rareSatsTabGridItem';

Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/nftDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useAddressRareSats } from '@hooks/queries/ordinals/useAddressRareSats';
import useStacksCollectibles from '@hooks/queries/useStacksCollectibles';
import useWalletSelector from '@hooks/useWalletSelector';
import { ArrowDown, Wrench } from '@phosphor-icons/react';
import type { InscriptionCollectionsData } from '@secretkeylabs/xverse-core/types';
import type { InscriptionCollectionsData } from '@secretkeylabs/xverse-core';
import {
ChangeActivateOrdinalsAction,
ChangeActivateRareSatsAction,
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/ordinals/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import useOrdinalDataReducer from '@hooks/stores/useOrdinalReducer';
import { Inscription } from '@secretkeylabs/xverse-core/types/index';
import type { Inscription } from '@secretkeylabs/xverse-core';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import styled from 'styled-components';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useInscriptionDetails from '@hooks/queries/ordinals/useInscriptionDetails';
import OrdinalImage from '@screens/ordinals/ordinalImage';
import { BtcOrdinal, Inscription } from '@secretkeylabs/xverse-core/types';
import type { BtcOrdinal, Inscription } from '@secretkeylabs/xverse-core';
import { useTranslation } from 'react-i18next';
import { MoonLoader } from 'react-spinners';
import styled from 'styled-components';
Expand Down
25 changes: 14 additions & 11 deletions src/app/screens/sendStx/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import SendForm from '@components/sendForm';
import BottomBar from '@components/tabBar';
import useStxPendingTxData from '@hooks/queries/useStxPendingTxData';
import useNetworkSelector from '@hooks/useNetwork';
import useWalletSelector from '@hooks/useWalletSelector';
import {
generateUnsignedStxTokenTransferTransaction,
microstacksToStx,
StacksTransaction,
stxToMicrostacks,
validateStxAddress,
} from '@secretkeylabs/xverse-core';
import { useMutation } from '@tanstack/react-query';
import { replaceCommaByDot } from '@utils/helper';
import BigNumber from 'bignumber.js';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate } from 'react-router-dom';
import { generateUnsignedStxTokenTransferTransaction } from '@secretkeylabs/xverse-core/transactions';
import { microstacksToStx, stxToMicrostacks } from '@secretkeylabs/xverse-core/currency';
import { StacksTransaction } from '@secretkeylabs/xverse-core/types';
import { validateStxAddress } from '@secretkeylabs/xverse-core/wallet';
import SendForm from '@components/sendForm';
import TopRow from '@components/topRow';
import useStxPendingTxData from '@hooks/queries/useStxPendingTxData';
import { replaceCommaByDot } from '@utils/helper';
import BottomBar from '@components/tabBar';
import useNetworkSelector from '@hooks/useNetwork';
import useWalletSelector from '@hooks/useWalletSelector';
import TopRow from '../../components/topRow';

function SendStxScreen() {
const { t } = useTranslation('translation', { keyPrefix: 'SEND' });
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/settings/changeNetwork/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BottomBar from '@components/tabBar';
import TopRow from '@components/topRow';
import useWalletReducer from '@hooks/useWalletReducer';
import useWalletSelector from '@hooks/useWalletSelector';
import { SettingsNetwork, StacksMainnet, StacksTestnet } from '@secretkeylabs/xverse-core/types';
import type { SettingsNetwork, StacksMainnet, StacksTestnet } from '@secretkeylabs/xverse-core';
import { initialNetworksList } from '@utils/constants';
import { isValidBtcApi, isValidStacksApi } from '@utils/helper';
import { useState } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/settings/changeNetwork/networkRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TickIcon from '@assets/img/settings/tick.svg';
import { SettingsNetwork } from '@secretkeylabs/xverse-core/types';
import type { SettingsNetwork } from '@secretkeylabs/xverse-core';
import styled, { useTheme } from 'styled-components';

interface TitleProps {
Expand Down
4 changes: 2 additions & 2 deletions src/app/screens/settings/fiatCurrency/currencyRow.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import TickIcon from '@assets/img/settings/tick.svg';
import { SupportedCurrency } from '@secretkeylabs/xverse-core/types';
import type { SupportedCurrency } from '@secretkeylabs/xverse-core';
import { Currency } from '@utils/currency';
import styled, { useTheme } from 'styled-components';
import { Currency } from '../../../utils/currency';

interface TitleProps {
color: string;
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/stacking/startStacking/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ArrowSquareOut from '@assets/img/arrow_square_out.svg';
import ActionButton from '@components/button';
import useStackingData from '@hooks/queries/useStackingData';
import type { Pool } from '@secretkeylabs/xverse-core';
import { microstacksToStx } from '@secretkeylabs/xverse-core';
import { Pool } from '@secretkeylabs/xverse-core/types';
import { XVERSE_WEB_POOL_URL } from '@utils/constants';
import BigNumber from 'bignumber.js';
import { useEffect, useState } from 'react';
Expand Down
8 changes: 6 additions & 2 deletions src/app/screens/transactionRequest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import useNetworkSelector from '@hooks/useNetwork';
import useDappRequest from '@hooks/useTransationRequest';
import useWalletReducer from '@hooks/useWalletReducer';
import useWalletSelector from '@hooks/useWalletSelector';
import { Coin, createDeployContractRequest, extractFromPayload } from '@secretkeylabs/xverse-core';
import { ContractFunction } from '@secretkeylabs/xverse-core/types/api/stacks/transaction';
import {
Coin,
ContractFunction,
createDeployContractRequest,
extractFromPayload,
} from '@secretkeylabs/xverse-core';
import { StacksTransaction } from '@stacks/transactions';
import { getNetworkType, isHardwareAccount } from '@utils/helper';
import { useEffect, useState } from 'react';
Expand Down
6 changes: 3 additions & 3 deletions src/app/stores/wallet/actions/actionCreators.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { PostGuardPing } from '@components/guards/singleTab';
import {
AccountType,
import type {
Account,
AccountType,
BaseWallet,
Coin,
FeesMultipliers,
FungibleToken,
SettingsNetwork,
SupportedCurrency,
TransactionData,
} from '@secretkeylabs/xverse-core/types';
} from '@secretkeylabs/xverse-core';
import BigNumber from 'bignumber.js';
import * as actions from './types';

Expand Down
4 changes: 2 additions & 2 deletions src/app/stores/wallet/actions/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
Account,
AccountType,
AppInfo,
Expand All @@ -9,7 +9,7 @@ import {
SettingsNetwork,
SupportedCurrency,
TransactionData,
} from '@secretkeylabs/xverse-core/types';
} from '@secretkeylabs/xverse-core';
import BigNumber from 'bignumber.js';

export const SetWalletKey = 'SetWallet';
Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable prefer-destructuring */
import type { SettingsNetwork } from '@secretkeylabs/xverse-core';
import {
BTC_BASE_URI_MAINNET,
BTC_BASE_URI_TESTNET,
HIRO_MAINNET_DEFAULT,
HIRO_TESTNET_DEFAULT,
} from '@secretkeylabs/xverse-core/constant';
import { SettingsNetwork } from '@secretkeylabs/xverse-core/types';

export const BNS_CONTRACT = 'SP000000000000000000002Q6VF78.bns::names';
export const GAMMA_URL = 'https://gamma.io/';
Expand Down
16 changes: 8 additions & 8 deletions src/app/utils/currency.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import UsFlag from '@assets/img/settings/ic_usa.svg';
import ARG from '@assets/img/settings/ars.svg';
import BRL from '@assets/img/settings/brl.svg';
import CNY from '@assets/img/settings/cny.svg';
import GBP from '@assets/img/settings/gbp.svg';
import HKD from '@assets/img/settings/hkd.svg';
import CanFlag from '@assets/img/settings/ic_can.svg';
import EurFlag from '@assets/img/settings/ic_eu.svg';
import JapanFlag from '@assets/img/settings/ic_jp.svg';
import CNY from '@assets/img/settings/cny.svg';
import ARG from '@assets/img/settings/ars.svg';
import HKD from '@assets/img/settings/hkd.svg';
import UsFlag from '@assets/img/settings/ic_usa.svg';
import KRW from '@assets/img/settings/krw.svg';
import SGD from '@assets/img/settings/sgd.svg';
import GBP from '@assets/img/settings/gbp.svg';
import BRL from '@assets/img/settings/brl.svg';
import RUB from '@assets/img/settings/rub.svg';
import { SupportedCurrency } from '@secretkeylabs/xverse-core/types';
import SGD from '@assets/img/settings/sgd.svg';
import type { SupportedCurrency } from '@secretkeylabs/xverse-core';

export interface Currency {
name: SupportedCurrency;
Expand Down
4 changes: 2 additions & 2 deletions src/app/utils/mixpanel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mixpanel from 'mixpanel-browser';
import { AnalyticsEvents } from '@secretkeylabs/xverse-core';
import { sha256 } from 'js-sha256';
import { AnalyticsEvents } from '@secretkeylabs/xverse-core/types';
import mixpanel from 'mixpanel-browser';
import { MIX_PANEL_TOKEN } from './constants';

export const isMixPanelInited = () => !!MIX_PANEL_TOKEN && !!mixpanel.config;
Expand Down

0 comments on commit 20e47d5

Please sign in to comment.