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: apply prettier config everywhere #1676

Merged
merged 3 commits into from
Oct 25, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions .changeset/happy-ghosts-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@talismn/chain-connector-evm": patch
"@talismn/chaindata-provider": patch
"@talismn/chain-connector": patch
"@talismn/balances-react": patch
"@talismn/on-chain-id": patch
"@talismn/token-rates": patch
"@talismn/balances": patch
"@talismn/scale": patch
"@talismn/util": patch
"@talismn/orb": patch
---

prettier fix
2 changes: 1 addition & 1 deletion apps/balances-demo/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" class="!overflow-auto">
<head>
<meta charset="UTF-8" />
Expand Down
4 changes: 2 additions & 2 deletions apps/balances-demo/src/components/Balances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Balances = () => {
"h-20 w-20 max-w-none justify-self-center bg-contain",
!(
/^https:\/\/raw.githubusercontent.com\/TalismanSociety\/chaindata\//i.test(
balance.token?.logo ?? ""
balance.token?.logo ?? "",
) && !/assets\/tokens\/coingecko/i.test(balance.token?.logo ?? "")
) && "rounded-full",
])}
Expand Down Expand Up @@ -61,7 +61,7 @@ export const Balances = () => {
<span className="flex items-center justify-start gap-2">
<span
className={classNames(
"overflow-hidden overflow-ellipsis whitespace-nowrap rounded-sm bg-[#1a1a1a] px-4 py-2 text-center font-bold"
"overflow-hidden overflow-ellipsis whitespace-nowrap rounded-sm bg-[#1a1a1a] px-4 py-2 text-center font-bold",
)}
style={{
color: balance.chain?.themeColor ?? balance.evmNetwork?.themeColor ?? undefined,
Expand Down
4 changes: 2 additions & 2 deletions apps/balances-demo/src/components/BalancesTotal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export const BalancesTotal = () => {
const total = (balances.sum.fiat("usd").total ?? 0).toLocaleString(undefined, currencyParams)
const available = (balances.sum.fiat("usd").transferable ?? 0).toLocaleString(
undefined,
currencyParams
currencyParams,
)

const locked = (balances.sum.fiat("usd").unavailable ?? 0).toLocaleString(
undefined,
currencyParams
currencyParams,
)

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/balances-demo/src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const Button = ({ className, ...props }: ButtonHTMLAttributes<HTMLButtonE
<button
className={classNames(
"bg-black-tertiary rounded-sm p-4 hover:bg-opacity-80 active:bg-opacity-65",
className
className,
)}
{...props}
/>
Expand Down
4 changes: 2 additions & 2 deletions apps/balances-demo/src/hooks/useExtensionAccounts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { web3AccountsSubscribe, web3Enable } from "@polkadot/extension-dapp"
import type { InjectedAccountWithMeta } from "@polkadot/extension-inject/types"
import { web3AccountsSubscribe, web3Enable } from "@polkadot/extension-dapp"
import { useAtomValue } from "jotai"
import { atomWithObservable } from "jotai/utils"
import { Observable } from "rxjs"
Expand Down Expand Up @@ -36,5 +36,5 @@ const accountsAtom = atomWithObservable(

// trigger abort signal when our component is unmounted
return () => abort.abort("Unsubscribed")
})
}),
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useChaindataProvider } from "@talismn/balances-react"
import type { CustomChain, CustomEvmNetwork, Token } from "@talismn/chaindata-provider"
import { useChaindataProvider } from "@talismn/balances-react"
import { useEffect } from "react"

const windowInject = globalThis as typeof globalThis & {
Expand Down
4 changes: 2 additions & 2 deletions apps/balances-demo/src/hooks/useSetCustomTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const useSetCustomTokens = (customTokensConfig: CustomTokensConfig) => {
const chaindataProvider = useChaindataProvider()
const customTokensConfigMemoised = useMemo(
() => customTokensConfig,
[JSON.stringify(customTokensConfig)] // eslint-disable-line react-hooks/exhaustive-deps
[JSON.stringify(customTokensConfig)], // eslint-disable-line react-hooks/exhaustive-deps
)

const evmNetworks = useEvmNetworks()
Expand All @@ -52,7 +52,7 @@ export const useSetCustomTokens = (customTokensConfig: CustomTokensConfig) => {
contractAddress,
evmNetwork: { id: evmChainId },
isCustom: true,
})
}),
)

chaindataProvider.setCustomTokens(customTokens)
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/.swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"dynamicImport": false
}
}
}
}
8 changes: 4 additions & 4 deletions apps/extension/src/@talisman/components/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const AccordionIcon: FC<{ isOpen: boolean; className?: string }> = ({
className={classNames(
"transition-transform duration-300 ease-in-out",
isOpen ? "rotate-0" : "rotate-[-90deg]",
className
className,
)}
>
<ChevronDownIcon />
Expand All @@ -44,7 +44,7 @@ export const Accordion: FC<{
if (container.scrollHeight !== contentHeight) setContentHeight(container.scrollHeight)
},
50,
{ trailing: true }
{ trailing: true },
) // prevent multiple re-renders in case of batch

const observer = new MutationObserver(updateContentHeight)
Expand All @@ -63,7 +63,7 @@ export const Accordion: FC<{
() => ({
height: contentHeight,
}),
[contentHeight]
[contentHeight],
)

const animate: TargetAndTransition = useMemo(
Expand All @@ -72,7 +72,7 @@ export const Accordion: FC<{

transitionEnd: { height: isOpen ? "auto" : 0 },
}),
[contentHeight, isOpen]
[contentHeight, isOpen],
)

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/@talisman/components/AppPill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const AppPill: FC<{ url?: string }> = ({ url }) => {
return (
<Tooltip>
<TooltipTrigger>
<div className="text-body-secondary bg-grey-800 flex max-w-[22rem] items-center gap-2 rounded-3xl px-4 py-2 text-sm font-light">
<div className="text-body-secondary bg-grey-800 flex max-w-[22rem] items-center gap-2 rounded-3xl px-4 py-2 text-sm font-light">
<Favicon url={url} className="text-base" />
<span className="overflow-hidden text-ellipsis whitespace-nowrap">{host}</span>
</div>
Expand Down
5 changes: 3 additions & 2 deletions apps/extension/src/@talisman/components/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { ChevronLeftIcon } from "@talismn/icons"
import { classNames } from "@talismn/util"
import { AnalyticsPage, sendAnalyticsEvent } from "@ui/api/analytics"
import { ButtonHTMLAttributes, DetailedHTMLProps, FC, useCallback } from "react"
import { useTranslation } from "react-i18next"
import { To, useNavigate } from "react-router-dom"

import { AnalyticsPage, sendAnalyticsEvent } from "@ui/api/analytics"

type BackButtonProps = DetailedHTMLProps<
ButtonHTMLAttributes<HTMLButtonElement>,
HTMLButtonElement
Expand Down Expand Up @@ -36,7 +37,7 @@ export const BackButton: FC<BackButtonProps> = ({ analytics, children, to, ...pr
onClick={handleBackClick}
className={classNames(
"allow-focus bg-grey-850 hover:bg-grey-800 text-grey-400 hover:text-grey-300 inline-flex items-center gap-2 rounded-sm py-3 pl-2 pr-4 text-sm",
props.className
props.className,
)}
>
<ChevronLeftIcon />
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/@talisman/components/Breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Breadcrumb: FC<{
onClick={onClick}
className={classNames(
"bg-grey-900 hover:bg-grey-800 hover:text-grey-300 h-[3.2rem] truncate rounded-sm px-4",
className
className,
)}
>
{label}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { CapsLockIcon } from "@talismn/icons"
import { classNames } from "@talismn/util"
import { useIsCapsLockOn } from "@ui/hooks/useIsCapsLockOn"
import { FC } from "react"
import { useTranslation } from "react-i18next"
import { Tooltip, TooltipContent, TooltipTrigger } from "talisman-ui"

import { useIsCapsLockOn } from "@ui/hooks/useIsCapsLockOn"

export const CapsLockWarningIcon: FC<{ className?: string }> = ({ className }) => {
const { t } = useTranslation()
const isCapsLockOn = useIsCapsLockOn()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { AlertTriangleIcon } from "@talismn/icons"
import { classNames } from "@talismn/util"
import { useIsCapsLockOn } from "@ui/hooks/useIsCapsLockOn"
import { FC } from "react"
import { useTranslation } from "react-i18next"

import { useIsCapsLockOn } from "@ui/hooks/useIsCapsLockOn"

export const CapsLockWarningMessage: FC<{ className?: string }> = ({ className }) => {
const { t } = useTranslation()
const isCapsLockOn = useIsCapsLockOn()
Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/@talisman/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const CodeBlock = ({ className, code }: CodeBlockProps) => {
return (
<pre
className={classNames(
"bg-grey-800 text-body-secondary scrollable scrollable-700 overflow-x-auto rounded-sm p-8 py-4",
className
"bg-grey-800 text-body-secondary scrollable scrollable-700 overflow-x-auto rounded-sm p-8 py-4",
className,
)}
>
<code className="[&>.hljs-string]:text-body [&>.hljs-number]:text-body">
Expand Down
7 changes: 4 additions & 3 deletions apps/extension/src/@talisman/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { DEBUG } from "@extension/shared"
import { ErrorBoundary as SentryErrorBoundary } from "@sentry/react"
import STATIC from "@talisman/theme/images/hand_open_static_dark.gif"
import { DexieError } from "dexie"
import { FC, ReactNode, useCallback } from "react"
import { Button } from "talisman-ui"

import { DEBUG } from "@extension/shared"
import STATIC from "@talisman/theme/images/hand_open_static_dark.gif"

const ErrorMessage: FC<{ error: unknown }> = ({ error }) => {
const isDbVersionError = (error as DexieError)?.inner?.name === "VersionError"

Expand All @@ -18,7 +19,7 @@ const ErrorMessage: FC<{ error: unknown }> = ({ error }) => {
}, [])

return (
<section className="max-w-screen text-body-secondary mx-auto flex h-[60rem] max-h-screen w-[40rem] flex-col overflow-hidden p-10 text-center">
<section className="max-w-screen text-body-secondary mx-auto flex h-[60rem] max-h-screen w-[40rem] flex-col overflow-hidden p-10 text-center">
<div className="flex flex-grow flex-col justify-center">
<h1 className="m-0 text-3xl font-bold">Oops !</h1>
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { MIGRATION_ERROR_MSG } from "@extension/core"
import { Component, ErrorInfo, FC, ReactNode } from "react"
import { ProcessAnimation } from "talisman-ui"

import { MIGRATION_ERROR_MSG } from "@extension/core"

const ErrorMessage: FC = () => (
<div className="text-whit mx-auto flex h-[60rem] w-[40rem] flex-col px-12 py-16 text-center">
<div className="flex grow flex-col justify-center font-bold">
Expand Down
7 changes: 4 additions & 3 deletions apps/extension/src/@talisman/components/Favicon.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { IS_FIREFOX } from "@extension/shared"
import { classNames } from "@talismn/util"
import { useFaviconUrl } from "@ui/hooks/useFaviconUrl"
import { FC } from "react"

import { IS_FIREFOX } from "@extension/shared"
import { useFaviconUrl } from "@ui/hooks/useFaviconUrl"

export const Favicon: FC<{ url: string; className?: string }> = ({ url, className }) => {
const iconUrl = useFaviconUrl(url)

return (
<span
className={classNames(
"flex h-[1.2em] w-[1.2em] shrink-0 items-center justify-center overflow-hidden rounded-full bg-black",
className
className,
)}
>
{!!iconUrl && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const FullScreenLocked = ({ className, title, subtitle }: Props) => (
<section
className={classNames(
"text-body-secondary flex select-none flex-col items-center",
className
className,
)}
>
<div className="relative">
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/@talisman/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const NavItem: FC<NavItemProps> = ({
const navClassName = classNames(
"hover:bg-grey-800 text-body-secondary hover:text-body flex w-full items-center justify-start gap-4 rounded-sm p-4 py-8 text-left",
isNavLink && "[&.active]:text-body",
className
className,
)

if (isNavLink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const NavigateWithQuery: FC<{ url: string; replace?: boolean }> = ({ url,

const to = useMemo(
() => (searchParams.size ? `${url}?${searchParams}` : url),
[url, searchParams]
[url, searchParams],
)

return <Navigate to={to} replace={replace} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sleep } from "@talismn/util"
import { Id, ToastContent, ToastOptions, toast } from "react-toastify"
import { Id, toast, ToastContent, ToastOptions } from "react-toastify"

import { Notification, NotificationProps } from "./Notification"

Expand Down Expand Up @@ -27,7 +27,7 @@ export const notifyCustom = (content: ToastContent<unknown>, options: ToastOptio
export const notifyUpdate = async (
toastId: Id,
content: NotificationProps,
options: ToastOptions = {}
options: ToastOptions = {},
) => {
// toast.isActive may return false if the toast is not yet rendered
await sleep(50)
Expand Down
9 changes: 5 additions & 4 deletions apps/extension/src/@talisman/components/OptionSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { FadeIn } from "@talisman/components/FadeIn"
import { classNames } from "@talismn/util"
import {
CSSProperties,
Expand All @@ -10,6 +9,8 @@ import {
useState,
} from "react"

import { FadeIn } from "@talisman/components/FadeIn"

const OptionButton = <O extends string>({
selected,
children,
Expand Down Expand Up @@ -37,7 +38,7 @@ const OptionButton = <O extends string>({
disabled={selected}
className={classNames(
"z-10 h-full px-7 py-2 transition-colors duration-150",
selected && "text-body-black"
selected && "text-body-black",
)}
onClick={() => onClick(option, buttonRef)}
>
Expand Down Expand Up @@ -71,14 +72,14 @@ export const OptionSwitch = <O extends string>({
})
if (onChange) onChange(option)
},
[onChange]
[onChange],
)

return (
<div
className={classNames(
"text-body-secondary inline-block h-14 rounded-full p-[0.25em]",
className
className,
)}
>
<div className="relative z-0 flex h-full items-center gap-2">
Expand Down
Loading
Loading