From 612a122aa87d69fda70255369a3a999739b045ec Mon Sep 17 00:00:00 2001
From: thisyahlen <104053934+thisyahlen-deriv@users.noreply.github.com>
Date: Wed, 27 Sep 2023 09:46:12 +0800
Subject: [PATCH] thisyahlen/chore: enforce camelcase (#10308)
* chore: enforce camelcase
* chore: fix circle ci and leftovers
---
packages/wallets/.eslintrc.js | 2 +-
.../CTraderList/CTraderList.tsx | 6 +--
.../OtherCFDPlatformsList.tsx | 4 +-
.../InlineMessage/InlineMessage.tsx | 35 +++++++-------
.../OptionsAndMultipliersListing.tsx | 18 +++----
.../components/ProgressBar/ProgressBar.tsx | 16 +++----
.../wallets/src/components/Tabs/TabList.tsx | 4 +-
.../wallets/src/components/Tabs/TabPanels.tsx | 4 +-
packages/wallets/src/components/Tabs/Tabs.tsx | 6 +--
.../WalletAddMoreCurrencyIcon.tsx | 4 +-
.../src/components/WalletCard/WalletCard.tsx | 24 +++++-----
.../WalletCashierHeader.tsx | 13 +++--
.../WalletClipboard/WalletClipboard.tsx | 16 +++----
.../WalletCurrencyCard/WalletCurrencyCard.tsx | 2 +-
.../WalletDepositCryptoAddress.tsx | 16 +++----
.../WalletDepositCryptoCurrencyDetails.tsx | 4 +-
.../WalletDepositCryptoDisclaimers.tsx | 25 +++++-----
.../WalletDepositFiat/WalletDepositFiat.tsx | 10 ++--
.../WalletGradientBackground.tsx | 12 ++---
.../WalletListCardActions.tsx | 7 +--
.../WalletListCardBadge.tsx | 8 ++--
.../WalletTransferFormAccountCard.tsx | 2 +-
.../WalletTransferFormDropdown.tsx | 2 +-
.../WalletTransferFormInputField.tsx | 2 +-
.../WalletsAddMoreCard/WalletsAddMoreCard.tsx | 12 +++--
.../WalletsAddMoreCardBanner.tsx | 14 ++++--
.../WalletsAddMoreCardContent.tsx | 14 +++---
.../WalletsCarouselContent.tsx | 42 ++++++++--------
.../wallets/src/hooks/useInputATMFormatter.ts | 48 +++++++++----------
.../src/hooks/useInputDecimalFormatter.ts | 46 +++++++++---------
30 files changed, 208 insertions(+), 210 deletions(-)
diff --git a/packages/wallets/.eslintrc.js b/packages/wallets/.eslintrc.js
index 7e4d101720e5..5b49571e9965 100644
--- a/packages/wallets/.eslintrc.js
+++ b/packages/wallets/.eslintrc.js
@@ -52,7 +52,7 @@ module.exports = {
'sort-keys': 'warn',
'typescript-sort-keys/interface': 'warn',
'typescript-sort-keys/string-enum': 'warn',
- camelcase: 'warn',
+ camelcase: 'error',
},
overrides: [
{
diff --git a/packages/wallets/src/components/ExternalTradingPlatforms/CTraderList/CTraderList.tsx b/packages/wallets/src/components/ExternalTradingPlatforms/CTraderList/CTraderList.tsx
index 84a79ea13190..117354e2a800 100644
--- a/packages/wallets/src/components/ExternalTradingPlatforms/CTraderList/CTraderList.tsx
+++ b/packages/wallets/src/components/ExternalTradingPlatforms/CTraderList/CTraderList.tsx
@@ -4,11 +4,11 @@ import { SecondaryActionButton } from '../../SecondaryActionButton';
import { TradingAccountCard } from '../../TradingAccountCard';
import './CTraderList.scss';
-const ctrader_mapper = [
+const ctraderMapper = [
{
- title: 'Deriv cTrader',
description: 'This account offers CFDs on a feature-rich trading platform.',
icon: ,
+ title: 'Deriv cTrader',
},
];
@@ -19,7 +19,7 @@ const CTraderList: React.FC = () => {
Deriv cTrader
- {ctrader_mapper.map(account => (
+ {ctraderMapper.map(account => (
{
const { data } = useDxtradeAccountsList();
- const has_dxtrade_account = !!data?.length;
+ const hasDxtradeAccount = !!data?.length;
return (
@@ -14,7 +14,7 @@ const OtherCFDPlatformsList: React.FC = () => {
Other CFD Platforms
- {has_dxtrade_account ?
:
}
+ {hasDxtradeAccount ?
:
}
);
diff --git a/packages/wallets/src/components/InlineMessage/InlineMessage.tsx b/packages/wallets/src/components/InlineMessage/InlineMessage.tsx
index 82ebe0761f18..ee09201a06a6 100644
--- a/packages/wallets/src/components/InlineMessage/InlineMessage.tsx
+++ b/packages/wallets/src/components/InlineMessage/InlineMessage.tsx
@@ -6,42 +6,39 @@ import AlertInfo from '../../public/images/alert-info.svg';
import Warning from '../../public/images/warning.svg';
import './InlineMessage.scss';
-const type_icon_mapper = {
- warning: Warning,
- information: AlertInfo,
+const typeIconMapper = {
announcement: AlertAnnounce,
error: AlertDanger,
+ information: AlertInfo,
+ warning: Warning,
};
type TProps = RequireAtLeastOne<{ children: React.ReactNode; message: React.ReactNode; title: React.ReactNode }> & {
size?: 'lg' | 'md' | 'sm' | 'xs';
- type?: keyof typeof type_icon_mapper;
+ type?: keyof typeof typeIconMapper;
};
const InlineMessage: React.FC = ({ children, message, size = 'xs', title, type = 'warning' }) => {
- const { is_mobile } = useDevice();
- const Icon = type_icon_mapper[type];
- const icon_size = size === 'lg' && !is_mobile ? 24 : 16;
+ const { isMobile } = useDevice();
+ const Icon = typeIconMapper[type];
+ const iconSize = size === 'lg' && !isMobile ? 24 : 16;
- const size_to_font_size_mapper: Record = useMemo(
+ const sizeToFontSizeMapper: Record = useMemo(
() => ({
- xs: is_mobile ? '8px' : '10px',
- sm: is_mobile ? '10px' : '12px',
- md: is_mobile ? '12px' : '14px',
- lg: is_mobile ? '14px' : '16px',
+ lg: isMobile ? '14px' : '16px',
+ md: isMobile ? '12px' : '14px',
+ sm: isMobile ? '10px' : '12px',
+ xs: isMobile ? '8px' : '10px',
}),
- [is_mobile]
+ [isMobile]
);
- const font_size = size_to_font_size_mapper[size];
+ const fontSize = sizeToFontSizeMapper[size];
return (
-
-
+
+
{title && {title}}
{message && {message}}
{children}
diff --git a/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.tsx b/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.tsx
index f64350769916..841c816822c7 100644
--- a/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.tsx
+++ b/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.tsx
@@ -9,41 +9,41 @@ import { PrimaryActionButton } from '../PrimaryActionButton';
import { TradingAccountCard } from '../TradingAccountCard';
import './OptionsAndMultipliersListing.scss';
-const options_and_multipliers = [
+const optionsAndMultipliers = [
{
- title: 'Deriv Trader',
description: 'Options and multipliers trading platform.',
icon: ,
+ title: 'Deriv Trader',
},
{
- title: 'Deriv Bot',
description: 'Automate your trading, no coding needed.',
icon: ,
+ title: 'Deriv Bot',
},
{
- title: 'SmartTrader',
description: 'Our legacy options trading platform.',
icon: ,
+ title: 'SmartTrader',
},
{
- title: 'Binary Bot',
description: 'Our legacy automated trading platform.',
icon: ,
+ title: 'Binary Bot',
},
{
- title: 'Deriv GO',
description: 'Trade on the go with our mobile app.',
icon: ,
+ title: 'Deriv GO',
},
];
const OptionsAndMultipliersListing = () => {
- const { is_mobile } = useDevice();
+ const { isMobile } = useDevice();
return (
- {!is_mobile && (
+ {!isMobile && (
{/* TODO: Localization needed*/}
Options & Multipliers
@@ -64,7 +64,7 @@ const OptionsAndMultipliersListing = () => {
- {options_and_multipliers.map(account => (
+ {optionsAndMultipliers.map(account => (
void;
};
-const ProgressBar: React.FC = ({ active_index, indexes, is_transition = true, setActiveIndex }) => {
+const ProgressBar: React.FC = ({ activeIndex, indexes, isTransition = true, setActiveIndex }) => {
return (
{indexes.map((value, idx) => {
- const current_index = idx + 1;
- const is_active = current_index === active_index;
+ const currentIndex = idx + 1;
+ const isActive = currentIndex === activeIndex;
- const bar_classname = is_active ? 'wallets-progress-bar-active' : 'wallets-progress-bar-inactive';
+ const barClassname = isActive ? 'wallets-progress-bar-active' : 'wallets-progress-bar-inactive';
return (
setActiveIndex(value)}
/>
);
diff --git a/packages/wallets/src/components/Tabs/TabList.tsx b/packages/wallets/src/components/Tabs/TabList.tsx
index 364768736e43..d9b2c67c2a04 100644
--- a/packages/wallets/src/components/Tabs/TabList.tsx
+++ b/packages/wallets/src/components/Tabs/TabList.tsx
@@ -7,14 +7,14 @@ type TTabListProps = {
};
export const TabList = ({ list }: TTabListProps) => {
- const { active_tab_index, setActiveTabIndex } = useTabs();
+ const { activeTabIndex, setActiveTabIndex } = useTabs();
return (
{list.map((tab, i) => (
setActiveTabIndex(i)}
diff --git a/packages/wallets/src/components/Tabs/TabPanels.tsx b/packages/wallets/src/components/Tabs/TabPanels.tsx
index d2f0bf51ed63..3921d940b52d 100644
--- a/packages/wallets/src/components/Tabs/TabPanels.tsx
+++ b/packages/wallets/src/components/Tabs/TabPanels.tsx
@@ -2,12 +2,12 @@ import React from 'react';
import { useTabs } from './Tabs';
const TabPanels = ({ children }: React.PropsWithChildren
) => {
- const { active_tab_index } = useTabs();
+ const { activeTabIndex } = useTabs();
return (
{React.Children.map(children, (child, index) => {
- if (index !== active_tab_index) return undefined;
+ if (index !== activeTabIndex) return undefined;
return child;
})}
diff --git a/packages/wallets/src/components/Tabs/Tabs.tsx b/packages/wallets/src/components/Tabs/Tabs.tsx
index 62d0b1b331f2..af88c2b58fc1 100644
--- a/packages/wallets/src/components/Tabs/Tabs.tsx
+++ b/packages/wallets/src/components/Tabs/Tabs.tsx
@@ -1,7 +1,7 @@
import React from 'react';
type TTabContext = {
- active_tab_index: number;
+ activeTabIndex: number;
setActiveTabIndex: React.Dispatch
>;
};
@@ -22,10 +22,10 @@ type TTabsProps = {
};
export const Tabs = ({ children, className }: React.PropsWithChildren) => {
- const [active_tab_index, setActiveTabIndex] = React.useState(0);
+ const [activeTabIndex, setActiveTabIndex] = React.useState(0);
return (
-
+
{children}
);
diff --git a/packages/wallets/src/components/WalletAddMoreCurrencyIcon/WalletAddMoreCurrencyIcon.tsx b/packages/wallets/src/components/WalletAddMoreCurrencyIcon/WalletAddMoreCurrencyIcon.tsx
index 8ed6549b2d17..f5312dad6e43 100644
--- a/packages/wallets/src/components/WalletAddMoreCurrencyIcon/WalletAddMoreCurrencyIcon.tsx
+++ b/packages/wallets/src/components/WalletAddMoreCurrencyIcon/WalletAddMoreCurrencyIcon.tsx
@@ -15,11 +15,11 @@ const currencies = {
eth: ETHIcon,
eur: EURIcon,
eusdt: TetherIcon,
+ gbp: GBPIcon,
ltc: LTCIcon,
+ tusdt: TetherIcon,
usd: USDIcon,
- gbp: GBPIcon,
usdc: USDCIcon,
- tusdt: TetherIcon,
ust: TetherIcon,
};
diff --git a/packages/wallets/src/components/WalletCard/WalletCard.tsx b/packages/wallets/src/components/WalletCard/WalletCard.tsx
index 407779ab4ff9..971cd68ab9e5 100644
--- a/packages/wallets/src/components/WalletCard/WalletCard.tsx
+++ b/packages/wallets/src/components/WalletCard/WalletCard.tsx
@@ -10,31 +10,31 @@ type TProps = {
};
const WalletCard: React.FC = ({ account }) => {
- const { currency, currency_config, display_balance, is_virtual, landing_company_name, wallet_currency_type } =
- account || {};
-
return (
-
+
- {landing_company_name && (
-
+ {account?.landing_company_name && (
+
)}
-
-
{currency} Wallet
+
+
{account?.currency} Wallet
- {display_balance} {currency}
+ {account?.display_balance} {account?.currency}
diff --git a/packages/wallets/src/components/WalletCashierHeader/WalletCashierHeader.tsx b/packages/wallets/src/components/WalletCashierHeader/WalletCashierHeader.tsx
index 6ed44e1e0aeb..35fc37d1aea5 100644
--- a/packages/wallets/src/components/WalletCashierHeader/WalletCashierHeader.tsx
+++ b/packages/wallets/src/components/WalletCashierHeader/WalletCashierHeader.tsx
@@ -14,12 +14,11 @@ const WalletCashierHeader = () => {
const { data } = useActiveWalletAccount();
const { isMobile } = useDevice();
const history = useHistory();
- const { currency, currency_config, display_balance, landing_company_name, wallet_currency_type } = data || {};
const location = useLocation();
return (
{
- {currency} Wallet
+ {data?.currency} Wallet
- {landing_company_name && (
-
+ {data?.landing_company_name && (
+
)}
-
{display_balance}
+
{data?.display_balance}
- {wallet_currency_type &&
}
+ {data?.wallet_currency_type &&
}