diff --git a/biome.json b/biome.json index d5066bc..1455ea8 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.0.0/schema.json", + "$schema": "https://biomejs.dev/schemas/1.6.4/schema.json", "files": { "ignore": [ "node_modules", @@ -7,7 +7,7 @@ "dist", "contracts/cache", "contracts/out", - "contracts/generated", + "contracts/generated.ts", "keys.json", "symbols/generated" ] @@ -16,20 +16,22 @@ "enabled": true, "formatWithErrors": false, "indentStyle": "space", - "indentSize": 2, + "indentWidth": 2, "lineWidth": 80 }, "linter": { "enabled": true, "rules": { "recommended": true, - "nursery": { - "useExhaustiveDependencies": "error" + "complexity": { + "noForEach": "off" }, "correctness": { - "noUnusedVariables": "error" + "noUnusedVariables": "error", + "useExhaustiveDependencies": "off" }, "performance": { + "noAccumulatingSpread": "off", "noDelete": "off" }, "style": { @@ -39,6 +41,7 @@ "suspicious": { "noArrayIndexKey": "off", "noAssignInExpressions": "off", + "noConfusingVoidType": "off", "noExplicitAny": "off" } } diff --git a/bun.lockb b/bun.lockb index 93d2a17..7aabedc 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 7336a66..2135385 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "zustand": "^4.3.8" }, "devDependencies": { - "@biomejs/biome": "1.0.0", + "@biomejs/biome": "1.6.4", "@samrum/vite-plugin-web-extension": "^5.1.0", "@types/chroma-js": "^2.4.0", "@types/chrome": "^0.0.266", diff --git a/src/app.tsx b/src/app.tsx index 15e4884..fce28ee 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -181,7 +181,6 @@ function AccountsChangedEmitter() { const { sessions } = useSessionsStore() const prevAccounts = useRef() - // rome-ignore lint/nursery/useExhaustiveDependencies: useEffect(() => { if (!account) { prevAccounts.current = [] @@ -212,7 +211,6 @@ function NetworkChangedEmitter() { const { sessions } = useSessionsStore() const prevNetwork = useRef() - // rome-ignore lint/nursery/useExhaustiveDependencies: useEffect(() => { if (!network.chainId) return @@ -241,7 +239,6 @@ function SyncJsonRpcAccounts() { const client = useClient() const { getAccounts, setJsonRpcAccounts } = useAccountStore() - // rome-ignore lint/nursery/useExhaustiveDependencies: useEffect(() => { ;(async () => { const addresses = await client.getAddresses() diff --git a/src/components/Header.tsx b/src/components/Header.tsx index c4ebd95..83d9f89 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -261,8 +261,8 @@ function RpcUrl() { status === 'pending' ? 'surface/invert@0.5' : listening - ? 'surface/green' - : 'surface/red' + ? 'surface/green' + : 'surface/red' } borderWidth="1px" borderRadius="round" @@ -368,8 +368,8 @@ function MiningStatus() { ? automining ? 'Automine' : network.blockTime - ? `Interval: ${network.blockTime}s` - : 'On Demand' + ? `Interval: ${network.blockTime}s` + : 'On Demand' : ''} diff --git a/src/components/abi/AbiParametersInputs.tsx b/src/components/abi/AbiParametersInputs.tsx index c4301f8..b0c2a85 100644 --- a/src/components/abi/AbiParametersInputs.tsx +++ b/src/components/abi/AbiParametersInputs.tsx @@ -1,4 +1,4 @@ -import { type AbiFunction, type AbiParameter } from 'abitype' +import type { AbiFunction, AbiParameter } from 'abitype' import { useEffect, useMemo } from 'react' import { type RegisterOptions, diff --git a/src/components/abi/DecodedAbiParameters.tsx b/src/components/abi/DecodedAbiParameters.tsx index afd17e4..5fc2118 100644 --- a/src/components/abi/DecodedAbiParameters.tsx +++ b/src/components/abi/DecodedAbiParameters.tsx @@ -1,10 +1,11 @@ import * as Accordion from '@radix-ui/react-accordion' -import { - type AbiParameter, - type AbiParameterToPrimitiveType, - type AbiParametersToPrimitiveTypes, +import type { + AbiParameter, + AbiParameterToPrimitiveType, + AbiParametersToPrimitiveTypes, } from 'abitype' -import React, { useEffect, useMemo, useState } from 'react' +import type React from 'react' +import { useEffect, useMemo, useState } from 'react' import { type Hex, concat, decodeAbiParameters, stringify } from 'viem' import { Tooltip } from '~/components' diff --git a/src/design-system/components/Box.tsx b/src/design-system/components/Box.tsx index 207876f..dd2075e 100644 --- a/src/design-system/components/Box.tsx +++ b/src/design-system/components/Box.tsx @@ -52,7 +52,7 @@ export const Box = forwardRef( ) as [BackgroundColor, string] const applyColorScheme = (backgroundColor === 'accent' || backgroundColors[baseBackgroundColor]) && - (!opacity || parseFloat(opacity) > 0.5) + (!opacity || Number.parseFloat(opacity) > 0.5) const { scheme: accentColorScheme, diff --git a/src/design-system/components/Button.css.ts b/src/design-system/components/Button.css.ts index fb65ef6..bdcdc3b 100644 --- a/src/design-system/components/Button.css.ts +++ b/src/design-system/components/Button.css.ts @@ -36,4 +36,4 @@ export const buttonVariants = [ 'tint green', 'tint red', ] as const satisfies readonly `${ButtonKind} ${string}`[] -export type ButtonVariant = typeof buttonVariants[number] +export type ButtonVariant = (typeof buttonVariants)[number] diff --git a/src/design-system/components/ButtonSymbol.tsx b/src/design-system/components/ButtonSymbol.tsx index 1ce98c7..ac87bc4 100644 --- a/src/design-system/components/ButtonSymbol.tsx +++ b/src/design-system/components/ButtonSymbol.tsx @@ -5,7 +5,7 @@ import type { UnionOmit } from '~/utils/types' import { Tooltip } from '../../components' import type { SymbolName } from '../tokens' import { ButtonRoot, type ButtonRootProps } from './Button' -import { type ButtonHeight, type ButtonVariant } from './Button.css' +import type { ButtonHeight, ButtonVariant } from './Button.css' import { widthForHeight } from './ButtonSymbol.css' import { SFSymbol } from './SFSymbol' import type { SFSymbolProps } from './SFSymbol' diff --git a/src/design-system/components/ButtonText.tsx b/src/design-system/components/ButtonText.tsx index 89d0fe9..7ee0dad 100644 --- a/src/design-system/components/ButtonText.tsx +++ b/src/design-system/components/ButtonText.tsx @@ -3,7 +3,7 @@ import { forwardRef } from 'react' import { Box } from './Box' import type { BoxStyles } from './Box.css' import { ButtonRoot, type ButtonRootProps } from './Button' -import { type ButtonHeight, type ButtonVariant } from './Button.css' +import type { ButtonHeight, ButtonVariant } from './Button.css' import { Text, type TextProps } from './Text' type ButtonTextProps = ButtonRootProps diff --git a/src/design-system/components/Input.css.ts b/src/design-system/components/Input.css.ts index cde9f51..f113dde 100644 --- a/src/design-system/components/Input.css.ts +++ b/src/design-system/components/Input.css.ts @@ -18,7 +18,7 @@ export type InputKind = 'solid' export const inputVariants = [ 'solid', ] as const satisfies readonly `${InputKind}`[] -export type InputVariant = typeof inputVariants[number] +export type InputVariant = (typeof inputVariants)[number] export const heightStyles = styleVariants(inputHeights, (height) => [ { height }, diff --git a/src/design-system/components/Link.tsx b/src/design-system/components/Link.tsx index a31c846..a121cca 100644 --- a/src/design-system/components/Link.tsx +++ b/src/design-system/components/Link.tsx @@ -1,4 +1,5 @@ -import React, { forwardRef, useContext } from 'react' +import type React from 'react' +import { forwardRef, useContext } from 'react' import { Link as RouterLink } from 'react-router-dom' import { Box } from './Box' diff --git a/src/design-system/components/Select.css.ts b/src/design-system/components/Select.css.ts index 4ae69c7..6e624b2 100644 --- a/src/design-system/components/Select.css.ts +++ b/src/design-system/components/Select.css.ts @@ -16,7 +16,7 @@ export type SelectKind = 'solid' export const selectVariants = [ 'solid', ] as const satisfies readonly `${SelectKind}`[] -export type SelectVariant = typeof selectVariants[number] +export type SelectVariant = (typeof selectVariants)[number] export const heightStyles = styleVariants(selectHeights, (height) => [ { height }, diff --git a/src/design-system/components/Text.tsx b/src/design-system/components/Text.tsx index 18231c4..8fff4fb 100644 --- a/src/design-system/components/Text.tsx +++ b/src/design-system/components/Text.tsx @@ -204,7 +204,7 @@ export const TextTruncated = forwardRef( const letterWidth = fontAttributes[size].letterWidth const width_ = width - ? width - parseInt(heightForSize[size].replace('px', '')) + ? width - Number.parseInt(heightForSize[size].replace('px', '')) : undefined return typeof width_ === 'number' ? truncate(children || '', { @@ -235,7 +235,7 @@ export const TextTruncated = forwardRef( getAccounts({ rpcUrl: network.rpcUrl }), [accounts, network.rpcUrl], diff --git a/src/hooks/useAutoloadAbi.ts b/src/hooks/useAutoloadAbi.ts index 792ab27..b4edfbe 100644 --- a/src/hooks/useAutoloadAbi.ts +++ b/src/hooks/useAutoloadAbi.ts @@ -1,6 +1,6 @@ import { loaders, whatsabi } from '@shazow/whatsabi' import { queryOptions, useQuery } from '@tanstack/react-query' -import { type Address, type Client } from 'viem' +import type { Address, Client } from 'viem' import { createQueryKey } from '~/react-query' import { etherscanApiUrls } from '../constants/etherscan' import { useClient } from './useClient' @@ -22,8 +22,8 @@ export function useAutoloadAbiQueryOptions({ const client = useClient() return queryOptions({ enabled: enabled && Boolean(address), - gcTime: Infinity, - staleTime: Infinity, + gcTime: Number.POSITIVE_INFINITY, + staleTime: Number.POSITIVE_INFINITY, queryKey: autoloadAbiQueryKey([client.key, address!]), async queryFn() { if (!address) throw new Error('address is required') diff --git a/src/hooks/useContracts.ts b/src/hooks/useContracts.ts index fa818e8..cd370aa 100644 --- a/src/hooks/useContracts.ts +++ b/src/hooks/useContracts.ts @@ -27,7 +27,7 @@ export function useContractsQueryOptions({ const client = useClient() return queryOptions({ - staleTime: Infinity, + staleTime: Number.POSITIVE_INFINITY, enabled: Boolean( enabled && block?.number && diff --git a/src/hooks/useGetLogs.ts b/src/hooks/useGetLogs.ts index b77f67d..b6b3dfa 100644 --- a/src/hooks/useGetLogs.ts +++ b/src/hooks/useGetLogs.ts @@ -42,11 +42,11 @@ export function getLogsQueryOptions< enabled, gcTime: typeof fromBlock === 'bigint' && typeof toBlock === 'bigint' - ? Infinity + ? Number.POSITIVE_INFINITY : undefined, staleTime: typeof fromBlock === 'bigint' && typeof toBlock === 'bigint' - ? Infinity + ? Number.POSITIVE_INFINITY : undefined, queryKey: getLogsQueryKey([client.key, stringify(args)]), async queryFn() { diff --git a/src/hooks/useLookupSignature.ts b/src/hooks/useLookupSignature.ts index 7f654aa..5ba1da2 100644 --- a/src/hooks/useLookupSignature.ts +++ b/src/hooks/useLookupSignature.ts @@ -1,6 +1,6 @@ import { loaders } from '@shazow/whatsabi' import { queryOptions, useQuery } from '@tanstack/react-query' -import { type Client, type Hex } from 'viem' +import type { Client, Hex } from 'viem' import { createQueryKey } from '~/react-query' import { useClient } from './useClient' @@ -21,8 +21,8 @@ export function useLookupSignatureQueryOptions({ const client = useClient() return queryOptions({ enabled: enabled && Boolean(selector), - gcTime: Infinity, - staleTime: Infinity, + gcTime: Number.POSITIVE_INFINITY, + staleTime: Number.POSITIVE_INFINITY, queryKey: lookupSignatureQueryKey([client.key, selector!]), async queryFn() { if (!selector) throw new Error('selector is required') diff --git a/src/hooks/usePendingBlock.ts b/src/hooks/usePendingBlock.ts index 4b214f3..0f59f3f 100644 --- a/src/hooks/usePendingBlock.ts +++ b/src/hooks/usePendingBlock.ts @@ -1,5 +1,5 @@ import { type InfiniteData, useQuery } from '@tanstack/react-query' -import { type Block, type Client, type Transaction } from 'viem' +import type { Block, Client, Transaction } from 'viem' import { createQueryKey, diff --git a/src/hooks/usePrevious.ts b/src/hooks/usePrevious.ts index 52f8aa0..c7b7db7 100644 --- a/src/hooks/usePrevious.ts +++ b/src/hooks/usePrevious.ts @@ -3,7 +3,6 @@ import { useEffect, useRef } from 'react' export function usePrevious(newValue: T) { const previousRef = useRef() - // rome-ignore lint/nursery/useExhaustiveDependencies: useEffect(() => { previousRef.current = newValue }) diff --git a/src/hooks/useSnapshot.ts b/src/hooks/useSnapshot.ts index d12e3c1..c2479dc 100644 --- a/src/hooks/useSnapshot.ts +++ b/src/hooks/useSnapshot.ts @@ -21,7 +21,7 @@ export function useSnapshotQueryOptions({ }: UseSnapshotParameters) { const client = useClient() return queryOptions({ - gcTime: Infinity, + gcTime: Number.POSITIVE_INFINITY, staleTime: 0, enabled: Boolean(enabled && blockNumber), queryKey: getSnapshotQueryKey([client.key, (blockNumber || '').toString()]), diff --git a/src/messengers/transports/types.ts b/src/messengers/transports/types.ts index d2a0698..61fe7e7 100644 --- a/src/messengers/transports/types.ts +++ b/src/messengers/transports/types.ts @@ -40,7 +40,7 @@ export type Transport< }, ) => Promise /** Replies to `send`. */ - reply: ( + reply: ( /** A scoped topic that was sent from `send`. */ topic: TTopic, callback: CallbackFunction< diff --git a/src/messengers/transports/window.ts b/src/messengers/transports/window.ts index 2cbb362..960916e 100644 --- a/src/messengers/transports/window.ts +++ b/src/messengers/transports/window.ts @@ -41,8 +41,8 @@ export const createWindowTransport = ( const sender = event.source if (sender !== window) return - let error - let response + let error: unknown + let response: unknown try { response = await callback(event.data.payload, { connection: event.data.connection, diff --git a/src/screens/_layout.tsx b/src/screens/_layout.tsx index 36e0055..fd220f5 100644 --- a/src/screens/_layout.tsx +++ b/src/screens/_layout.tsx @@ -24,7 +24,6 @@ export default function Layout() { const showHeader = onboarded const isNetworkOffline = Boolean(network.rpcUrl && onboarded && !online) - // rome-ignore lint/nursery/useExhaustiveDependencies: useEffect(() => { contentMessenger.reply('pushRoute', async (route) => { navigate(route) diff --git a/src/screens/account-details.tsx b/src/screens/account-details.tsx index 622afd6..003bd5e 100644 --- a/src/screens/account-details.tsx +++ b/src/screens/account-details.tsx @@ -5,7 +5,7 @@ import { useNavigate, useParams, useSearchParams } from 'react-router-dom' import { toast } from 'sonner' import { type Address, - BaseError, + type BaseError, formatUnits, isAddress, parseUnits, diff --git a/src/screens/contract-details.tsx b/src/screens/contract-details.tsx index ccc1377..dbdd408 100644 --- a/src/screens/contract-details.tsx +++ b/src/screens/contract-details.tsx @@ -48,9 +48,9 @@ export default function ContractDetails() { .filter((abiItem) => abiItem.type === 'function') .map((abiItem) => ({ ...abiItem, - inputs: (abiItem as {} as AbiFunction).inputs || [], - outputs: (abiItem as {} as AbiFunction).outputs || [], - })) as {} as AbiFunction[] + inputs: (abiItem as unknown as AbiFunction).inputs || [], + outputs: (abiItem as unknown as AbiFunction).outputs || [], + })) as unknown as AbiFunction[] }, [abi]) const hasStateMutability = !abiFunctions?.some( @@ -74,7 +74,7 @@ export default function ContractDetails() { (abiItem.stateMutability === 'nonpayable' || abiItem.stateMutability === 'payable'), ) - return [read as {} as AbiFunction[], write as {} as AbiFunction[]] + return [read as unknown as AbiFunction[], write as unknown as AbiFunction[]] }, [abiFunctions, hasStateMutability]) //////////////////////////////////////////////////////////////////////// diff --git a/src/screens/networks.tsx b/src/screens/networks.tsx index 7048cdb..bc35c2c 100644 --- a/src/screens/networks.tsx +++ b/src/screens/networks.tsx @@ -155,8 +155,8 @@ function NetworkRow({ status === 'pending' ? 'surface/invert@0.5' : data - ? 'surface/green' - : 'surface/red' + ? 'surface/green' + : 'surface/red' } borderWidth="1px" borderRadius="round" diff --git a/src/screens/transaction-details.tsx b/src/screens/transaction-details.tsx index 3d14d5a..892bef3 100644 --- a/src/screens/transaction-details.tsx +++ b/src/screens/transaction-details.tsx @@ -76,8 +76,8 @@ export default function TransactionDetails() { receipt?.status === 'success' ? 'surface/green' : receipt?.status === 'reverted' - ? 'surface/red' - : 'surface/invert@0.5' + ? 'surface/red' + : 'surface/invert@0.5' } borderWidth="1px" borderRadius="round" diff --git a/src/storage/webext.ts b/src/storage/webext.ts index 2c651c8..144c5e6 100644 --- a/src/storage/webext.ts +++ b/src/storage/webext.ts @@ -11,7 +11,7 @@ export type WebextStorage = { ): () => void } -const noopStorage: typeof chrome.storage['local'] = { +const noopStorage: (typeof chrome.storage)['local'] = { getBytesInUse: () => Promise.resolve(0), QUOTA_BYTES: 0, clear: () => Promise.resolve(), diff --git a/src/utils/deepEqual.ts b/src/utils/deepEqual.ts index 302b1d7..21fb8ab 100644 --- a/src/utils/deepEqual.ts +++ b/src/utils/deepEqual.ts @@ -11,7 +11,7 @@ export function deepEqual(a: any, b: any) { if (Array.isArray(a) && Array.isArray(b)) { length = a.length - // rome-ignore lint/suspicious/noDoubleEquals: + // biome-ignore lint/suspicious/noDoubleEquals: if (length != b.length) return false for (i = length; i-- !== 0; ) if (!deepEqual(a[i], b[i])) return false return true @@ -38,7 +38,6 @@ export function deepEqual(a: any, b: any) { return true } - // true if both NaN, false otherwise - // rome-ignore lint/suspicious/noSelfCompare: + // biome-ignore lint/suspicious/noSelfCompare: return a !== a && b !== b }