Skip to content

Commit

Permalink
lint: all \t to spaces for const, let and functions (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Jun 1, 2023
1 parent f57f8d8 commit 3dcfdaf
Show file tree
Hide file tree
Showing 98 changed files with 654 additions and 654 deletions.
20 changes: 10 additions & 10 deletions apps/common/components/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {MotionDiv} from './MotionDiv';
import type {ReactElement} from 'react';
import type {TMenu} from '@yearn-finance/web-lib/components/Header';

function Logo(): ReactElement {
const {pathname} = useRouter();
function Logo(): ReactElement {
const {pathname} = useRouter();

return (
<>
Expand All @@ -41,7 +41,7 @@ function Logo(): ReactElement {

}

function LogoPopover(): ReactElement {
function LogoPopover(): ReactElement {
const [isShowing, set_isShowing] = useState(false);

return (
Expand Down Expand Up @@ -95,12 +95,12 @@ function LogoPopover(): ReactElement {
);
}

export function AppHeader(): ReactElement {
const isMounted = useIsMounted();
const {pathname} = useRouter();
const {isActive} = useWeb3();
const {onOpenMenu} = useMenu();
const menu = useMemo((): TMenu[] => {
export function AppHeader(): ReactElement {
const isMounted = useIsMounted();
const {pathname} = useRouter();
const {isActive} = useWeb3();
const {onOpenMenu} = useMenu();
const menu = useMemo((): TMenu[] => {
const HOME_MENU = {path: '/', label: 'Home'};

if (pathname.startsWith('/ycrv')) {
Expand All @@ -126,7 +126,7 @@ export function AppHeader(): ReactElement {
];
}, [pathname]);

const supportedNetworks = useMemo((): number[] => {
const supportedNetworks = useMemo((): number[] => {
if (pathname.startsWith('/ycrv') || pathname.startsWith('/veyfi') || pathname.startsWith('/ybribe')) {
return [1];
}
Expand Down
24 changes: 12 additions & 12 deletions apps/common/components/BalanceReminderPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ type TBalanceReminderElement = {
symbol: string,
}

function TokenItem({element}: {element: TBalanceReminderElement}): ReactElement {
const {provider} = useWeb3();
const {safeChainID} = useChainID();
const balance = useBalance(element.address);
function TokenItem({element}: {element: TBalanceReminderElement}): ReactElement {
const {provider} = useWeb3();
const {safeChainID} = useChainID();
const balance = useBalance(element.address);

async function addTokenToMetamask(address: string, symbol: string, decimals: number, image: string): Promise<void> {
if (!provider) {
Expand Down Expand Up @@ -91,12 +91,12 @@ function TokenItem({element}: {element: TBalanceReminderElement}): ReactElement
}

export default function BalanceReminderPopover(): ReactElement {
const {balances, isLoading} = useWallet();
const {address, ens, isActive, onDesactivate} = useWeb3();
const {vaults} = useYearn();
const {balances, isLoading} = useWallet();
const {address, ens, isActive, onDesactivate} = useWeb3();
const {vaults} = useYearn();

const nonNullBalances = useMemo((): TDict<TBalanceData> => {
const nonNullBalances = Object.entries(balances).reduce((acc: TDict<TBalanceData>, [address, balance]): TDict<TBalanceData> => {
const nonNullBalances = useMemo((): TDict<TBalanceData> => {
const nonNullBalances = Object.entries(balances).reduce((acc: TDict<TBalanceData>, [address, balance]): TDict<TBalanceData> => {
if (toBigInt(balance?.raw) > 0n) {
acc[toAddress(address)] = balance;
}
Expand All @@ -105,8 +105,8 @@ export default function BalanceReminderPopover(): ReactElement {
return nonNullBalances;
}, [balances]);

const nonNullBalancesForVault = useMemo((): TBalanceReminderElement[] => {
const nonNullBalancesForVault = Object.entries(nonNullBalances).reduce((acc: TBalanceReminderElement[], [address, balance]): TBalanceReminderElement[] => {
const nonNullBalancesForVault = useMemo((): TBalanceReminderElement[] => {
const nonNullBalancesForVault = Object.entries(nonNullBalances).reduce((acc: TBalanceReminderElement[], [address, balance]): TBalanceReminderElement[] => {
const currentVault = vaults?.[toAddress(address)];
if (currentVault) {
acc.push({
Expand All @@ -121,7 +121,7 @@ export default function BalanceReminderPopover(): ReactElement {
return nonNullBalancesForVault;
}, [nonNullBalances, vaults]);

function renderNoTokenFallback(isLoading: boolean): ReactElement {
function renderNoTokenFallback(isLoading: boolean): ReactElement {
if (isLoading) {
return (
<div className={'py-4 text-center text-sm text-neutral-400'}>
Expand Down
2 changes: 1 addition & 1 deletion apps/common/components/HeroTimer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type TProps = {
endTime?: TSeconds;
}

function HeroTimer({endTime}: TProps): ReactElement {
function HeroTimer({endTime}: TProps): ReactElement {
const time = useTimer({endTime});

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/common/components/ImageWithFallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {ReactElement} from 'react';
export type TImageWithFallbackProps = ImageProps & {
onCatchError?: () => void;
};
function ImageWithFallback(props: TImageWithFallbackProps): ReactElement {
function ImageWithFallback(props: TImageWithFallbackProps): ReactElement {
const {alt, src, onCatchError, ...rest} = props;
const [imageSrc, set_imageSrc] = useState(src);

Expand Down
6 changes: 3 additions & 3 deletions apps/common/components/ListHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export type TListHead = {
onSort: (sortBy: string, sortDirection: TSortDirection) => void
}

function ListHead({items, dataClassName, sortBy, sortDirection, onSort}: TListHead): ReactElement {
function ListHead({items, dataClassName, sortBy, sortDirection, onSort}: TListHead): ReactElement {
const toggleSortDirection = (newSortBy: string): TSortDirection => {
return sortBy === newSortBy ? (
sortDirection === '' ? 'desc' : sortDirection === 'desc' ? 'asc' : 'desc'
) : 'desc';
};

const renderChevron = useCallback((shouldSortBy: boolean): ReactElement => {
const renderChevron = useCallback((shouldSortBy: boolean): ReactElement => {
if (shouldSortBy && sortDirection === 'desc') {
return <IconChevronPlain className={'yearn--sort-chevron'} />;
}
Expand All @@ -34,7 +34,7 @@ function ListHead({items, dataClassName, sortBy, sortDirection, onSort}: TListHe
return <IconChevronPlain className={'yearn--sort-chevron--off text-neutral-300 group-hover:text-neutral-500'} />;
}, [sortDirection]);

const [first, ...rest] = items;
const [first, ...rest] = items;
return (
<div className={'mt-4 grid w-full grid-cols-1 md:mt-0'}>
<div className={'yearn--table-head-wrapper'}>
Expand Down
12 changes: 6 additions & 6 deletions apps/common/components/ListHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export type TListHeroDesktopCategories<T> = {
onSelect: (category: T) => void;
}

function DesktopCategories<T>({categories, onSelect}: TListHeroDesktopCategories<T>): ReactElement {
const [isClientLoaded, set_isClientLoaded] = useState(false);
function DesktopCategories<T>({categories, onSelect}: TListHeroDesktopCategories<T>): ReactElement {
const [isClientLoaded, set_isClientLoaded] = useState(false);
useEffect((): void => {
set_isClientLoaded(true);
}, []);
Expand Down Expand Up @@ -66,10 +66,10 @@ function DesktopCategories<T>({categories, onSelect}: TListHeroDesktopCategories
}

function Switch(props: TSwitchProps): ReactElement {
const {isEnabled, onSwitch} = props;
const [isEnabledState, set_isEnabledState] = useState(isEnabled);
const {isEnabled, onSwitch} = props;
const [isEnabledState, set_isEnabledState] = useState(isEnabled);

function safeOnSwitch(): void {
function safeOnSwitch(): void {
if (onSwitch) {
onSwitch(!isEnabled);
} else {
Expand All @@ -93,7 +93,7 @@ function Switch(props: TSwitchProps): ReactElement {
);
}

function ListHero<T extends string>({
function ListHero<T extends string>({
headLabel,
searchLabel,
searchPlaceholder,
Expand Down
2 changes: 1 addition & 1 deletion apps/common/components/Meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type TMetaFile = {
orientation: string;
}

function Meta({meta}: {meta: TMetaFile}): ReactElement {
function Meta({meta}: {meta: TMetaFile}): ReactElement {
return (
<>
<Head>
Expand Down
2 changes: 1 addition & 1 deletion apps/common/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type TSearchBar = {
set_searchValue: (searchValue: string) => void;
}

export function SearchBar({searchLabel, searchPlaceholder, searchValue, set_searchValue}: TSearchBar): ReactElement {
export function SearchBar({searchLabel, searchPlaceholder, searchValue, set_searchValue}: TSearchBar): ReactElement {
return (
<div className={'w-full'}>
<label
Expand Down
16 changes: 8 additions & 8 deletions apps/common/components/SettingsOverwrite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ type TWrappedInput = {
onSave: (value: string) => void;
}

function WrappedInput({title, initialValue, onSave}: TWrappedInput): ReactElement {
const [isFocused, set_isFocused] = useState(false);
const [value, set_value] = useState(initialValue);
const isInitialValue = useMemo((): boolean => value === initialValue, [value, initialValue]);
function WrappedInput({title, initialValue, onSave}: TWrappedInput): ReactElement {
const [isFocused, set_isFocused] = useState(false);
const [value, set_value] = useState(initialValue);
const isInitialValue = useMemo((): boolean => value === initialValue, [value, initialValue]);

return (
<label>
Expand Down Expand Up @@ -44,11 +44,11 @@ function WrappedInput({title, initialValue, onSave}: TWrappedInput): ReactElemen
);
}

function SettingsOverwrite(): ReactElement {
const {onUpdateBaseSettings, onUpdateNetworks, settings: baseAPISettings} = useSettings();
function SettingsOverwrite(): ReactElement {
const {onUpdateBaseSettings, onUpdateNetworks, settings: baseAPISettings} = useSettings();
// eslint-disable-next-line @typescript-eslint/naming-convention
const {value, set} = useLocalStorageValue<boolean>('yearn.finance/feedback-popover');
const [, set_nonce] = useState(0);
const {value, set} = useLocalStorageValue<boolean>('yearn.finance/feedback-popover');
const [, set_nonce] = useState(0);

return (
<div className={'bg-neutral-100 p-10'}>
Expand Down
6 changes: 3 additions & 3 deletions apps/common/components/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ type TSwitch = {
};

function Switch(props: TSwitch): ReactElement {
const {isEnabled, onSwitch} = props;
const [isEnabledState, set_isEnabledState] = useState(isEnabled);
const {isEnabled, onSwitch} = props;
const [isEnabledState, set_isEnabledState] = useState(isEnabled);

function safeOnSwitch(): void {
function safeOnSwitch(): void {
if (onSwitch) {
onSwitch(!isEnabled);
} else {
Expand Down
2 changes: 1 addition & 1 deletion apps/common/components/TokenDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {TDropdownItemProps, TDropdownOption, TDropdownProps} from '@common/


function DropdownItem({option, balanceSource}: TDropdownItemProps): ReactElement {
const balance = useBalance(option.value, balanceSource);
const balance = useBalance(option.value, balanceSource);

return (
<Combobox.Option value={option}>
Expand Down
2 changes: 1 addition & 1 deletion apps/common/components/TokenIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function TokenIcon({
}): ReactElement {
const [imageType, set_imageType] = useState<'Vault' | 'Underlying' | 'Fallback'>('Vault');

function renderMultipleAssetImage(): ReactElement {
function renderMultipleAssetImage(): ReactElement {
if (token?.underlyingTokensAddresses?.length === 2) {
return (
<div className={'flex flex-row items-center justify-center'}>
Expand Down
8 changes: 4 additions & 4 deletions apps/common/components/ValueAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {formatAmount} from '@yearn-finance/web-lib/utils/format.number';

import type {ReactElement} from 'react';

function ValueAnimation({
function ValueAnimation({
identifier,
value,
defaultValue,
Expand All @@ -20,14 +20,14 @@ function ValueAnimation({
suffix?: string,
className?: string
}): ReactElement {
const hasBeenTriggerd = useRef<boolean>(false);
const hasBeenTriggerd = useRef<boolean>(false);

function initZero(): void {
function initZero(): void {
const words = document.getElementsByClassName(identifier) as HTMLCollectionOf<HTMLSpanElement>;
words[0].style.opacity = '1';
}

function onStartAnimation(): void {
function onStartAnimation(): void {
hasBeenTriggerd.current = true;
const words = document.getElementsByClassName(identifier) as HTMLCollectionOf<HTMLSpanElement>;
const wordArray: HTMLSpanElement[][] = [];
Expand Down
10 changes: 5 additions & 5 deletions apps/common/contexts/useMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ export type TMenu = {
menu: TCurrentMenu,
onOpenMenu: VoidFunction,
}
const defaultProps: TMenu = {
const defaultProps: TMenu = {
menu: {
app: [],
isOpen: false
},
onOpenMenu: (): void => undefined
};

const MenuContext = createContext<TMenu>(defaultProps);
const MenuContext = createContext<TMenu>(defaultProps);
export const MenuContextApp = ({children}: {children: React.ReactElement}): React.ReactElement => {
const {pathname} = useRouter();
const [menu, set_menu] = useState<TCurrentMenu>(defaultProps.menu);
const {pathname} = useRouter();
const [menu, set_menu] = useState<TCurrentMenu>(defaultProps.menu);

const onOpenMenu = useCallback((): void => {
if (pathname.startsWith('/ycrv')) {
Expand All @@ -54,7 +54,7 @@ export const MenuContextApp = ({children}: {children: React.ReactElement}): Reac
/* 🔵 - Yearn Finance ******************************************************
** Setup and render the Context provider to use in the app.
***************************************************************************/
const contextValue = useMemo((): TMenu => ({
const contextValue = useMemo((): TMenu => ({
menu,
onOpenMenu
}), [menu, onOpenMenu]);
Expand Down
Loading

0 comments on commit 3dcfdaf

Please sign in to comment.