Skip to content

Commit

Permalink
chore: apply new formatting rules after prettier upgrade (#657)
Browse files Browse the repository at this point in the history
* build(deps): update prettier from v2.8.7 to v3.0.3

* chore: apply new formatting rules after prettier upgrade
  • Loading branch information
theborakompanioni authored Sep 10, 2023
1 parent 6b45718 commit 2ebb1b5
Show file tree
Hide file tree
Showing 50 changed files with 261 additions and 209 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"jest-watch-typeahead": "^0.6.5",
"jest-websocket-mock": "^2.4.0",
"lint-staged": "^13.0.3",
"prettier": "^2.8.7",
"prettier": "^3.0.3",
"react-scripts": "^5.0.1",
"typescript": "^4.8.4"
},
Expand Down
22 changes: 11 additions & 11 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function App() {
setSession({ name, token })
setCurrentWallet({ name, token })
},
[setCurrentWallet]
[setCurrentWallet],
)

const stopWallet = useCallback(() => {
Expand All @@ -78,10 +78,10 @@ export default function App() {
console.info('Finished reloading wallet info.')
setReloadingWalletInfoCounter((current) => current - 1)
})
}, delay)
}, delay),
)
},
[reloadCurrentWalletInfo]
[reloadCurrentWalletInfo],
)

const router = createBrowserRouter(
Expand Down Expand Up @@ -170,11 +170,11 @@ export default function App() {
</>
)}
</Route>
</Route>
</Route>,
),
{
basename: window.JM.PUBLIC_PATH,
}
},
)

if (settings.showOnboarding === true) {
Expand Down Expand Up @@ -244,7 +244,7 @@ const WalletInfoAutoReload = ({ currentWallet, reloadWalletInfo }: WalletInfoAut
const [currentRescanning, setCurrentRescanning] = useState(serviceInfo?.rescanning || false)
const rescanningFinished = useMemo(
() => previousRescanning === true && currentRescanning === false,
[previousRescanning, currentRescanning]
[previousRescanning, currentRescanning],
)

useEffect(() => {
Expand All @@ -258,7 +258,7 @@ const WalletInfoAutoReload = ({ currentWallet, reloadWalletInfo }: WalletInfoAut

reloadWalletInfo(RELOAD_WALLET_INFO_DELAY.AFTER_UNLOCK).catch((err) => console.error(err))
},
[currentWallet, reloadWalletInfo]
[currentWallet, reloadWalletInfo],
)

useEffect(
Expand All @@ -272,7 +272,7 @@ const WalletInfoAutoReload = ({ currentWallet, reloadWalletInfo }: WalletInfoAut
currentBalance: Api.AmountSats,
delay: Milliseconds,
maxCalls: number,
callCounter: number = 0
callCounter: number = 0,
) => {
if (callCounter >= maxCalls) return
const info = await reloadWalletInfo(delay)
Expand All @@ -287,12 +287,12 @@ const WalletInfoAutoReload = ({ currentWallet, reloadWalletInfo }: WalletInfoAut
reloadWhileBalanceChangesRecursively(
info.balanceSummary.calculatedTotalBalanceInSats,
RELOAD_WALLET_INFO_DELAY.AFTER_RESCAN,
MAX_RECURSIVE_WALLET_INFO_RELOADS
)
MAX_RECURSIVE_WALLET_INFO_RELOADS,
),
)
.catch((err) => console.error(err))
},
[currentWallet, rescanningFinished, reloadWalletInfo]
[currentWallet, rescanningFinished, reloadWalletInfo],
)

return <></>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CoinjoinPreconditionViolationAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ export const CoinjoinPreconditionViolationAlert = forwardRef(
}

return <></>
}
},
)
4 changes: 2 additions & 2 deletions src/components/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { ReactNode, PropsWithChildren, useState, useEffect, useRef } from 'react
const copyToClipboard = (
text: string,
fallbackInputField: HTMLInputElement,
errorMessage?: string
errorMessage?: string,
): Promise<boolean> => {
const copyToClipboardFallback = (
inputField: HTMLInputElement,
errorMessage = 'Cannot copy value to clipboard'
errorMessage = 'Cannot copy value to clipboard',
): Promise<boolean> =>
new Promise((resolve, reject) => {
inputField.select()
Expand Down
6 changes: 3 additions & 3 deletions src/components/CreateWallet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const BackupConfirmation = ({ wallet, onSuccess, onCancel }) => {

const isSeedBackupConfirmed = useMemo(
() => givenWords.every((word, index) => word === seedphrase[index]),
[givenWords, seedphrase]
[givenWords, seedphrase],
)

return (
Expand Down Expand Up @@ -108,7 +108,7 @@ export default function CreateWallet({ parentRoute, startWallet }) {
setAlert({ variant: 'danger', message })
}
},
[setAlert, setCreatedWallet, t]
[setAlert, setCreatedWallet, t],
)

const walletConfirmed = useCallback(() => {
Expand All @@ -123,7 +123,7 @@ export default function CreateWallet({ parentRoute, startWallet }) {

const isCreated = useMemo(
() => createdWallet?.walletFileName && createdWallet?.seedphrase && createdWallet?.password,
[createdWallet]
[createdWallet],
)
const canCreate = useMemo(() => !isCreated && !serviceInfo?.walletName, [isCreated, serviceInfo])
const [showBackupConfirmation, setShowBackupConfirmation] = useState(false)
Expand Down
2 changes: 1 addition & 1 deletion src/components/CreateWallet.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('<CreateWallet />', () => {
render(
<BrowserRouter>
<CreateWallet startWallet={startWallet} />
</BrowserRouter>
</BrowserRouter>,
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/EarnReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const EarnReportTable = ({ data }: EarnReportTableProps) => {
[SORT_KEYS.inputCount]: (array) => array.sort((a, b) => +a.inputCount - +b.inputCount),
[SORT_KEYS.inputAmountInSats]: (array) => array.sort((a, b) => +a.inputAmount - +b.inputAmount),
},
}
},
)

return (
Expand Down Expand Up @@ -362,7 +362,7 @@ export function EarnReportOverlay({ show, onHide }: rb.OffcanvasProps) {
setAlert({ variant: 'danger', message })
})
},
[t]
[t],
)

useEffect(() => {
Expand Down
16 changes: 8 additions & 8 deletions src/components/ImportWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const ImportWalletDetailsForm = ({
}
return errors
},
[t]
[t],
)

return (
Expand Down Expand Up @@ -249,7 +249,7 @@ const ImportWalletConfirmation = ({
password: walletDetails.password,
seedphrase: importDetails.mnemonicPhrase.join(' '),
}),
[walletDetails, importDetails]
[walletDetails, importDetails],
)

return (
Expand Down Expand Up @@ -331,7 +331,7 @@ export default function ImportWallet({ parentRoute, startWallet }: ImportWalletP
const isRecovered = useMemo(() => !!recoveredWallet?.walletFileName && recoveredWallet?.token, [recoveredWallet])
const canRecover = useMemo(
() => !isRecovered && !serviceInfo?.walletName && !serviceInfo?.rescanning,
[isRecovered, serviceInfo]
[isRecovered, serviceInfo],
)

const [step, setStep] = useState<ImportWalletSteps>(ImportWalletSteps.wallet_details)
Expand Down Expand Up @@ -369,7 +369,7 @@ export default function ImportWallet({ parentRoute, startWallet }: ImportWalletP
seedphrase,
gaplimit,
blockheight,
}: { walletname: Api.WalletName; password: string; seedphrase: string; gaplimit: number; blockheight: number }
}: { walletname: Api.WalletName; password: string; seedphrase: string; gaplimit: number; blockheight: number },
) => {
setAlert(undefined)

Expand Down Expand Up @@ -465,7 +465,7 @@ export default function ImportWallet({ parentRoute, startWallet }: ImportWalletP
updateConfigValues,
dispatchServiceInfo,
t,
]
],
)

return (
Expand Down Expand Up @@ -523,7 +523,7 @@ export default function ImportWallet({ parentRoute, startWallet }: ImportWalletP
t(
isSubmitting
? 'import_wallet.wallet_details.text_button_submitting'
: 'import_wallet.wallet_details.text_button_submit'
: 'import_wallet.wallet_details.text_button_submit',
)
}
/>
Expand All @@ -535,7 +535,7 @@ export default function ImportWallet({ parentRoute, startWallet }: ImportWalletP
t(
isSubmitting
? 'import_wallet.import_details.text_button_submitting'
: 'import_wallet.import_details.text_button_submit'
: 'import_wallet.import_details.text_button_submit',
)
}
onCancel={() => previousStep()}
Expand All @@ -553,7 +553,7 @@ export default function ImportWallet({ parentRoute, startWallet }: ImportWalletP
t(
isSubmitting
? 'import_wallet.confirmation.text_button_submitting'
: 'import_wallet.confirmation.text_button_submit'
: 'import_wallet.confirmation.text_button_submit',
)
}
onCancel={() => previousStep()}
Expand Down
16 changes: 8 additions & 8 deletions src/components/Jam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const DEST_ADDRESS_COUNT_TEST = 1
const getNewAddressesForTesting = (
walletInfo: WalletInfo,
count: number,
mixdepth: number
mixdepth: number,
): Array<Api.BitcoinAddress> => {
const externalBranch = walletInfo.data.display.walletinfo.accounts[mixdepth].branches.find((branch) => {
return branch.branch.split('\t')[0] === 'external addresses'
Expand All @@ -42,7 +42,7 @@ const getNewAddressesForTesting = (
const getNewAddressesForTestingOrEmpty = (
walletInfo: WalletInfo | undefined,
count: number,
mixdepth = 0
mixdepth = 0,
): Array<Api.BitcoinAddress | ''> => {
if (!walletInfo) {
return Array(count).fill('')
Expand All @@ -67,7 +67,7 @@ const isValidAddress = (candidate: any) => {
const isAddressReused = (
walletInfo: WalletInfo,
destination: Api.BitcoinAddress,
inputAddresses: Api.BitcoinAddress[]
inputAddresses: Api.BitcoinAddress[],
) => {
if (!destination) return false

Expand Down Expand Up @@ -164,18 +164,18 @@ export default function Jam({ wallet }: JamProps) {

const collaborativeOperationRunning = useMemo(
() => serviceInfo?.coinjoinInProgress || serviceInfo?.makerRunning || false,
[serviceInfo]
[serviceInfo],
)

const schedulerPreconditionSummary = useMemo(
() => buildCoinjoinRequirementSummary(walletInfo?.data.utxos.utxos || []),
[walletInfo]
[walletInfo],
)

const [useInsecureTestingSettings, setUseInsecureTestingSettings] = useState(false)
const addressCount = useMemo(
() => (useInsecureTestingSettings ? DEST_ADDRESS_COUNT_TEST : DEST_ADDRESS_COUNT_PROD),
[useInsecureTestingSettings]
[useInsecureTestingSettings],
)

const initialFormValues = useMemo<FormikValues>(() => {
Expand Down Expand Up @@ -207,7 +207,7 @@ export default function Jam({ wallet }: JamProps) {
setIsLoading(false)
})
},
[reloadServiceInfo, reloadCurrentWalletInfo, t]
[reloadServiceInfo, reloadCurrentWalletInfo, t],
)

useEffect(() => {
Expand Down Expand Up @@ -462,7 +462,7 @@ export default function Jam({ wallet }: JamProps) {
try {
const newAddresses = getNewAddressesForTestingOrEmpty(
walletInfo,
DEST_ADDRESS_COUNT_TEST
DEST_ADDRESS_COUNT_TEST,
)
newAddresses.forEach((newAddress, index) => {
setFieldValue(`dest${index + 1}`, newAddress, true)
Expand Down
2 changes: 1 addition & 1 deletion src/components/LogOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function LogOverlay({ currentWallet, show, onHide }: LogOverlayProps) {
setIsLoading(false)
})
},
[currentWallet, t]
[currentWallet, t],
)

useEffect(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function FastThemeToggle() {
settingsDispatch({ theme })
}
},
[settingsDispatch]
[settingsDispatch],
)

return (
Expand Down Expand Up @@ -250,11 +250,11 @@ export default function Navbar() {
const rescanInProgress = useMemo(() => serviceInfo?.rescanning === true, [serviceInfo])
const schedulerRunning = useMemo(
() => (serviceInfo?.coinjoinInProgress && serviceInfo?.schedule !== null) || false,
[serviceInfo]
[serviceInfo],
)
const singleCoinJoinRunning = useMemo(
() => (serviceInfo?.coinjoinInProgress && serviceInfo?.schedule === null) || false,
[serviceInfo]
[serviceInfo],
)

const joiningRoute = useMemo(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Onboarding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function Onboarding() {
icon: <Sprite symbol="shield-outline" width="11rem" height="11rem" />,
},
],
[t]
[t],
)

const next = useCallback(() => {
Expand Down
Loading

0 comments on commit 2ebb1b5

Please sign in to comment.