From c0d8deff8a3241444baef5e6b3a01e02073fe7ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lcio=20Franco?= Date: Tue, 19 Mar 2024 17:10:16 -0400 Subject: [PATCH] fix: biomejs (#1150) Enable `biomejs` rules again. Only **safe fixes** have been applied. The code is still the same. --- .changeset/three-seas-remember.md | 7 + biome.json | 43 +- examples/cra-dapp/src/App.tsx | 13 +- packages/app/.storybook/main.ts | 8 +- packages/app/.storybook/preview.tsx | 7 +- packages/app/jest.config.ts | 1 - packages/app/jest.setup.ts | 10 +- packages/app/load.envs.js | 3 + packages/app/playwright.config.ts | 3 +- packages/app/playwright/commons/gas.ts | 3 +- packages/app/playwright/commons/seedWallet.ts | 2 +- packages/app/playwright/commons/text.ts | 4 +- packages/app/playwright/crx/crx.test.ts | 36 +- packages/app/playwright/crx/utils/popup.ts | 2 +- packages/app/playwright/crx/utils/test.ts | 5 +- packages/app/playwright/e2e/Accounts.test.ts | 2 +- .../app/playwright/e2e/ChangePassword.test.ts | 2 +- .../app/playwright/e2e/HomeWallet.test.ts | 2 +- packages/app/playwright/e2e/Networks.test.ts | 4 +- .../app/playwright/e2e/RecoverWallet.test.ts | 6 +- .../app/playwright/e2e/ReportError.test.ts | 4 +- .../playwright/e2e/SendTransaction.test.ts | 10 +- .../app/playwright/e2e/UnlockScreen.test.ts | 2 +- .../playwright/e2e/ViewRecoveryPhrase.test.ts | 2 +- packages/app/playwright/mocks/database.ts | 15 +- packages/app/playwright/types.d.ts | 2 - packages/app/public/mockServiceWorker.js | 17 +- packages/app/src/mocks/localStorage.ts | 3 +- .../systems/Account/__mocks__/accounts.tsx | 4 +- .../AccountForm/AccountForm.test.tsx | 2 +- .../AccountInfo/AccountInfo.stories.tsx | 2 +- .../AccountInfo/AccountInfo.test.tsx | 2 +- .../components/AccountItem/AccountItem.tsx | 2 +- .../components/AccountList/AccountList.tsx | 3 +- .../BalanceWidget/BalanceWidget.test.tsx | 2 +- .../components/EthAddress/EthAddress.tsx | 2 +- .../ImportAccountForm.test.tsx | 2 +- .../systems/Account/hooks/useAccountForm.ts | 1 + .../src/systems/Account/hooks/useAccounts.tsx | 2 +- .../Account/machines/accountsMachine.test.ts | 2 +- .../Account/machines/accountsMachine.tsx | 2 +- .../machines/addAccountMachine.test.ts | 2 +- .../Account/machines/addAccountMachine.tsx | 1 - .../Account/machines/editAccountMachine.tsx | 1 - .../Account/machines/exportAccountMachine.tsx | 1 - .../Account/machines/importAccountMachine.tsx | 1 - .../pages/Accounts/Accounts.stories.tsx | 2 +- .../pages/EditAccount/EditAccount.stories.tsx | 2 +- .../ExportAccount/ExportAccount.stories.tsx | 2 +- .../pages/ExportAccount/ExportAccount.tsx | 2 +- .../ImportAccount/ImportAccount.stories.tsx | 2 +- .../Account/pages/Logout/Logout.stories.tsx | 2 +- .../systems/Account/services/account.test.ts | 2 +- .../src/systems/Account/services/account.ts | 13 +- .../src/systems/Asset/__mocks__/assets.tsx | 4 +- .../Asset/components/AssetForm/AssetForm.tsx | 2 +- .../components/AssetList/AssetListLoading.tsx | 1 + .../components/AssetSelect/AssetSelect.tsx | 2 +- .../app/src/systems/Asset/hooks/useAsset.tsx | 2 +- .../src/systems/Asset/hooks/useAssetForm.tsx | 7 +- .../systems/Asset/machines/assetsMachine.tsx | 3 +- .../app/src/systems/Asset/services/assets.ts | 2 + .../CRX/background/actions/keepAwake.ts | 1 - .../app/src/systems/CRX/background/index.ts | 2 +- .../background/services/BackgroundService.ts | 16 +- .../services/CommunicationProtocol.ts | 6 +- .../background/services/DatabaseObservable.ts | 4 +- .../CRX/background/services/PopUpService.ts | 2 +- .../CRX/background/services/VaultService.ts | 6 +- packages/app/src/systems/CRX/config.ts | 2 +- .../CRX/scripts/executeContentScript.ts | 1 + packages/app/src/systems/CRX/utils/error.ts | 5 +- packages/app/src/systems/CRX/utils/popups.ts | 3 +- .../AmountVisibility/AmountVisibility.tsx | 2 +- .../components/ConnectInfo/ConnectInfo.tsx | 2 +- .../ContentHeader/ContentHeader.stories.tsx | 2 +- .../ContentHeader/ContentHeader.tsx | 2 +- .../ControlledField/ControlledField.test.tsx | 5 +- .../ControlledField/ControlledField.tsx | 5 +- .../components/ImageLoader/ImageLoader.tsx | 4 +- .../InputSecurePassword.tsx | 1 + .../systems/Core/components/Layout/Layout.tsx | 6 +- .../systems/Core/components/Layout/TopBar.tsx | 6 +- .../Core/components/Mnemonic/Mnemonic.tsx | 11 +- .../Core/components/OriginTag/OriginTag.tsx | 2 +- .../components/PrivateRoute/PrivateRoute.tsx | 2 +- .../Core/components/Providers/Providers.tsx | 3 +- .../components/PublicRoute/PublicRoute.tsx | 2 +- .../components/SearchInput/SearchInput.tsx | 2 +- .../components/TestWrapper/TestWrapper.tsx | 2 +- .../app/src/systems/Core/hooks/useStorage.tsx | 3 +- .../src/systems/Core/hooks/useUnlockForm.tsx | 4 +- .../src/systems/Core/machines/fetchMachine.ts | 11 +- .../app/src/systems/Core/services/core.ts | 1 + packages/app/src/systems/Core/styles/core.ts | 6 +- packages/app/src/systems/Core/types.ts | 4 +- .../app/src/systems/Core/utils/address.tsx | 4 +- .../app/src/systems/Core/utils/database.ts | 16 +- packages/app/src/systems/Core/utils/json.ts | 4 +- .../app/src/systems/Core/utils/machine.ts | 8 +- .../app/src/systems/Core/utils/promise.ts | 2 +- packages/app/src/systems/Core/utils/route.ts | 7 +- .../app/src/systems/Core/utils/storage.ts | 3 +- .../app/src/systems/Core/utils/storybook.ts | 4 +- .../app/src/systems/Core/utils/string.tsx | 4 +- packages/app/src/systems/Core/utils/wallet.ts | 2 +- .../DApp/__mocks__/dapp-transaction.ts | 2 +- .../systems/DApp/hooks/useConnectRequest.tsx | 5 +- .../DApp/hooks/useTransactionRequest.tsx | 1 - .../DApp/machines/addAssetRequestMachine.tsx | 6 +- .../machines/addNetworkRequestMachine.tsx | 6 +- .../DApp/machines/connectRequestMachine.ts | 4 +- .../machines/messageRequestMachine.test.ts | 2 +- .../DApp/machines/messageRequestMachine.tsx | 4 +- .../machines/transactionRequestMachine.tsx | 12 +- .../pages/AddAssetRequest/AddAssetRequest.tsx | 2 +- .../AddNetworkRequest/AddNetworkRequest.tsx | 2 +- .../ConnectionRequest/ConnectionRequest.tsx | 6 +- .../SignatureRequest/SignatureRequest.tsx | 4 +- .../TransactionRequest.stories.tsx | 2 +- .../TransactionRequest/TransactionRequest.tsx | 2 +- .../src/systems/DApp/services/connection.ts | 7 +- .../Providers/ReportErrorProvider.tsx | 2 +- .../systems/Error/hooks/useReportError.tsx | 2 +- .../Error/machines/reportErrorMachine.tsx | 3 +- .../ReportErrors/ReportErrors.stories.tsx | 2 +- .../Error/pages/ReportErrors/ReportErrors.tsx | 4 +- .../Error/services/ReportErrorService.tsx | 4 + .../src/systems/Error/utils/parseFuelError.ts | 4 +- .../Faucet/components/FaucetDialog.tsx | 2 +- .../src/systems/Faucet/hooks/useOpenFaucet.ts | 2 +- .../Faucet/machines/captchaMachine.tsx | 1 - .../Faucet/machines/faucetMachine.test.ts | 2 +- .../systems/Faucet/machines/faucetMachine.tsx | 3 +- .../UserAddressCard/UserAddressCard.tsx | 2 +- .../NetworkDropdown/NetworkDropdown.tsx | 3 +- .../components/NetworkForm/NetworkForm.tsx | 4 +- .../components/NetworkItem/NetworkItem.tsx | 2 +- .../NetworkReviewCard/NetworkReviewCard.tsx | 2 +- .../NetworkSelector/NetworkSelector.tsx | 2 +- .../src/systems/Network/hooks/useChainInfo.ts | 1 + .../systems/Network/hooks/useNetworkForm.ts | 1 + .../src/systems/Network/hooks/useNetworks.ts | 2 +- .../Network/machines/chainInfoMachine.ts | 14 +- .../Network/machines/networksMachine.test.ts | 8 +- .../Network/machines/networksMachine.ts | 12 +- .../pages/AddNetwork/AddNetwork.stories.tsx | 2 +- .../Network/pages/AddNetwork/AddNetwork.tsx | 8 +- .../pages/Networks/Networks.stories.tsx | 2 +- .../UpdateNetwork/UpdateNetwork.stories.tsx | 2 +- .../systems/Network/services/network.test.ts | 1 - .../src/systems/Network/services/network.ts | 8 +- .../app/src/systems/Network/utils/url.tsx | 4 +- .../src/systems/Overlay/hooks/useOverlay.tsx | 2 +- .../Overlay/machines/overlayMachine.ts | 5 +- packages/app/src/systems/Overlay/types.ts | 4 +- .../app/src/systems/Send/__mocks__/send.tsx | 1 - .../Send/components/Send/Send.stories.tsx | 2 +- .../Send/components/SendSelect/SendSelect.tsx | 4 +- .../app/src/systems/Send/hooks/useSend.tsx | 8 +- .../src/systems/Send/machines/sendMachine.ts | 20 +- .../Send/pages/SendPage/SendPage.stories.tsx | 2 +- .../systems/Send/pages/SendPage/SendPage.tsx | 2 +- .../systems/Settings/__mocks__/connection.ts | 3 +- .../systems/Settings/__test__/testQueries.ts | 4 +- .../ConnectionEdit/ConnectionEdit.stories.tsx | 2 +- .../ConnectionEdit/ConnectionEdit.tsx | 6 +- .../ConnectionList/ConnectionList.stories.tsx | 2 +- .../ConnectionList/ConnectionList.tsx | 8 +- .../systems/Settings/hooks/useConnections.tsx | 2 +- .../Settings/machines/connectionsMachine.tsx | 2 +- .../Settings/machines/exportVaultMachine.ts | 1 - .../Settings/machines/settingsMachine.ts | 2 +- .../pages/ChangePassword/ChangePassword.tsx | 3 +- .../ViewSeedPhrase/ViewSeedPhrase.stories.tsx | 2 +- .../app/src/systems/Settings/services/abi.ts | 1 + .../systems/Sidebar/components/Menu/Menu.tsx | 2 +- .../Sidebar/components/Sidebar/Sidebar.tsx | 4 +- .../CreatePassword/CreatePassword.tsx | 2 +- .../components/MnemonicRead/MnemonicRead.tsx | 2 +- .../MnemonicWrite/MnemonicWrite.tsx | 2 +- .../SignUp/components/Stepper/Stepper.tsx | 2 +- .../WalletCreated/WalletCreated.tsx | 2 +- .../src/systems/SignUp/hooks/useSignUp.tsx | 1 + .../systems/SignUp/machines/signUpMachine.ts | 6 +- .../SignUp/pages/TermsOfUse/TermsOfUse.tsx | 2 +- packages/app/src/systems/SignUp/routes.tsx | 8 +- .../app/src/systems/SignUp/services/signup.ts | 1 + packages/app/src/systems/Store/index.tsx | 6 +- packages/app/src/systems/Store/types.ts | 6 +- .../Transaction/__mocks__/operation.tsx | 2 +- .../src/systems/Transaction/__mocks__/tx.ts | 12 +- .../ActivityItem/ActivityItem.stories.tsx | 4 + .../ActivityItem/ActivityItem.test.tsx | 4 +- .../ActivityList/ActivityListEmpty.tsx | 2 +- .../ActivityList/ActivityListLoading.tsx | 1 + .../components/TxContent/TxContent.tsx | 2 +- .../components/TxHeader/TxHeader.test.tsx | 2 +- .../Transaction/components/TxIcon/TxIcon.tsx | 2 +- .../components/TxOperations/TxOperations.tsx | 1 + .../TxRecipientCard/TxRecipientCard.tsx | 2 +- .../TxStatusAlert/TxStatusAlert.stories.tsx | 1 + .../Transaction/hooks/useContractIds.tsx | 1 + .../Transaction/hooks/useExplorerLink.tsx | 3 +- .../Transaction/hooks/useRawPayload.tsx | 4 +- .../hooks/useTransactionHistory.tsx | 2 +- .../systems/Transaction/hooks/useTxResult.tsx | 1 + .../machines/transactionHistoryMachine.tsx | 1 - .../machines/transactionMachine.tsx | 1 - .../pages/TxApprove/TxApprove.stories.tsx | 3 +- .../ViewActivity/ViewActivity.stories.tsx | 2 +- .../Transaction/services/transaction.test.ts | 6 +- .../Transaction/services/transaction.tsx | 17 +- .../app/src/systems/Transaction/types.tsx | 2 +- .../src/systems/Transaction/utils/color.ts | 2 - .../src/systems/Transaction/utils/error.tsx | 9 +- .../app/src/systems/Transaction/utils/icon.ts | 2 +- .../components/ResetDialog/ResetDialog.tsx | 2 +- .../src/systems/Unlock/hooks/useUnlock.tsx | 2 +- .../systems/Unlock/hooks/useUnlockForm.tsx | 4 +- .../systems/Unlock/machines/unlockMachine.tsx | 4 +- .../src/systems/Vault/__mocks__/mockUnlock.ts | 2 +- .../Vault/connectors/VaultCRXConnector.ts | 5 +- .../src/systems/Vault/services/VaultClient.ts | 2 + .../src/systems/Vault/services/VaultServer.ts | 4 +- packages/app/vite-utils/vite.base.config.ts | 4 +- packages/app/vite-utils/zip-build.plugin.ts | 7 +- packages/app/vite.config.ts | 1 + packages/connections/src/BaseConnection.ts | 21 +- .../connections/src/ContentProxyConnection.ts | 7 +- .../src/ExtensionPageConnection.ts | 4 +- packages/connections/src/utils/promise.ts | 2 +- packages/docs/examples/abis/Abi.tsx | 3 +- packages/docs/examples/abis/AddAbi.tsx | 3 +- packages/docs/examples/accounts/Accounts.tsx | 3 +- .../docs/examples/accounts/CurrentAccount.tsx | 4 +- packages/docs/examples/assets/AddAssets.tsx | 6 +- packages/docs/examples/assets/ListAssets.tsx | 1 - .../docs/examples/assets/TransferAssets.tsx | 9 +- .../examples/assets/hooks/AddAssetsHook.tsx | 10 +- .../assets/hooks/TransferAssetsHook.tsx | 7 +- .../examples/connecting/CheckConnection.tsx | 3 +- .../docs/examples/connecting/CheckWallet.tsx | 4 +- packages/docs/examples/connecting/Connect.tsx | 1 - .../docs/examples/connecting/Disconnect.tsx | 1 - .../examples/connectors/ListConnectors.tsx | 1 - .../examples/connectors/SelectConnector.tsx | 6 +- .../connectors/hooks/ConnectorUIHook.tsx | 2 +- .../connectors/hooks/SelectConnectorHook.tsx | 9 +- packages/docs/examples/events/Accounts.tsx | 11 +- .../docs/examples/events/CurrentAccount.tsx | 10 +- packages/docs/examples/events/Network.tsx | 12 +- .../docs/examples/networks/AddNetwork.tsx | 1 - .../docs/examples/networks/CurrentNetwork.tsx | 3 +- .../networks/hooks/AddNetworkHook.tsx | 5 +- .../docs/examples/signMessage/SignMessage.tsx | 1 - .../signMessage/hooks/SignMessageHook.tsx | 1 - packages/docs/next.config.mjs | 2 +- packages/docs/src/components/Blockquote.tsx | 3 +- packages/docs/src/components/Code.tsx | 3 +- packages/docs/src/components/Demo.tsx | 4 +- packages/docs/src/components/ExampleBox.tsx | 3 +- packages/docs/src/components/Heading.tsx | 3 +- packages/docs/src/components/List.tsx | 6 +- packages/docs/src/components/MobileMenu.tsx | 4 +- packages/docs/src/components/Paragraph.tsx | 3 +- packages/docs/src/components/Pre.tsx | 3 +- packages/docs/src/components/Provider.tsx | 8 +- packages/docs/src/components/SidebarLink.tsx | 3 +- .../docs/src/components/StyleProvider.tsx | 1 + packages/docs/src/components/Table.tsx | 5 +- packages/docs/src/hooks/useDocContext.tsx | 2 +- packages/docs/src/hooks/useFuel.tsx | 2 +- packages/docs/src/hooks/useIsConnected.tsx | 3 +- packages/docs/src/hooks/useLoading.tsx | 14 +- packages/docs/src/lib/api.ts | 5 +- packages/docs/src/lib/code-import.ts | 36 +- packages/docs/src/lib/toc.ts | 8 +- packages/docs/src/pages/_app.tsx | 6 +- packages/docs/src/pages/_document.tsx | 1 + packages/docs/src/type.d.ts | 2 +- packages/docs/src/utils/getAssetByChain.ts | 2 +- packages/e2e-contract-tests/fuels.config.ts | 4 +- packages/e2e-contract-tests/load.envs.js | 3 +- .../playwright/e2e/DepositHalfEth.test.ts | 8 +- .../e2e/ForwardAndMintMulticall.test.ts | 12 +- .../playwright/e2e/ForwardCustomAsset.test.ts | 10 +- .../playwright/e2e/ForwardEth.test.ts | 6 +- .../e2e/ForwardHalfAndExternalMint.test.ts | 14 +- .../playwright/e2e/ForwardHalfAndMint.test.ts | 12 +- .../e2e/ForwardHalfCustomAsset.test.ts | 10 +- .../playwright/e2e/MintAsset.test.ts | 12 +- .../e2e-contract-tests/playwright/e2e/test.ts | 2 +- .../playwright/e2e/utils/address.ts | 4 +- .../playwright/e2e/utils/contract.ts | 2 +- .../playwright/utils/setup.ts | 4 +- packages/e2e-contract-tests/src/App.tsx | 16 +- .../src/components/AssetConfigurationCard.tsx | 1 + .../components/DepositAndMintMultiCall.tsx | 1 + .../src/components/DepositHalfEthCard.tsx | 1 + .../src/components/ForwardCustomAssetCard.tsx | 1 + .../src/components/ForwardEthCard.tsx | 1 + .../ForwardHalfAndExternalMintCard.tsx | 1 + .../src/components/ForwardHalfAndMintCard.tsx | 1 + .../components/ForwardHalfCustomAssetCard.tsx | 1 + .../src/components/Header.tsx | 6 +- .../src/components/MintAssetCard.tsx | 1 + .../src/components/RevertCard.tsx | 2 + .../custom_asset_interactions.ts | 4 +- .../contracts/contracts/CustomAssetAbi.d.ts | 4 +- .../factories/CustomAssetAbi__factory.ts | 6 +- packages/e2e-contract-tests/src/main.tsx | 1 - .../e2e-contract-tests/src/utils/address.ts | 2 +- .../e2e-contract-tests/src/utils/assetId.ts | 2 +- packages/types/src/accounts.ts | 2 +- packages/types/src/error.ts | 3 +- packages/types/src/fuel.ts | 28 +- pnpm-lock.yaml | 479 +----------------- scripts/build-website/builds/utils.mjs | 1 - 319 files changed, 751 insertions(+), 1132 deletions(-) create mode 100644 .changeset/three-seas-remember.md diff --git a/.changeset/three-seas-remember.md b/.changeset/three-seas-remember.md new file mode 100644 index 0000000000..4ddb56b1d2 --- /dev/null +++ b/.changeset/three-seas-remember.md @@ -0,0 +1,7 @@ +--- +"@fuel-wallet/connections": patch +"@fuel-wallet/types": patch +"fuels-wallet": patch +--- + +ci: enable biomejs rules (as it was with eslint and prettier) diff --git a/biome.json b/biome.json index 9dd2be0f07..59257a4be5 100644 --- a/biome.json +++ b/biome.json @@ -15,48 +15,10 @@ "rules": { "recommended": true, "correctness": { - "noUnusedVariables": "off", - "useExhaustiveDependencies": "off", - "noEmptyPattern": "off" + "noUnusedVariables": "error" }, "style": { - "useImportType": "off", - "useEnumInitializers": "off", - "noUnusedTemplateLiteral": "off", - "noNonNullAssertion": "off", - "noInferrableTypes": "off", - "useNodejsImportProtocol": "off", - "useNumberNamespace": "off", - "useExportType": "off" - }, - "suspicious": { - "noArrayIndexKey": "off", - "noConfusingVoidType": "off", - "noExplicitAny": "off", - "noImplicitAnyLet": "off", - "noAssignInExpressions": "off", - "noShadowRestrictedNames": "off", - "noDoubleEquals": "off" - }, - "complexity": { - "noThisInStatic": "off", - "noStaticOnlyClass": "off", - "noForEach": "off", - "useOptionalChain": "off", - "noUselessSwitchCase": "off", - "useArrowFunction": "off", - "noUselessEmptyExport": "off", - "useLiteralKeys": "off" - }, - "performance": { - "noAccumulatingSpread": "off", - "noDelete": "off" - }, - "security": { - "noDangerouslySetInnerHtml": "off" - }, - "a11y": { - "useButtonType": "off" + "noNonNullAssertion": "off" } } }, @@ -85,6 +47,7 @@ "**/build", "**/dist", "**/dist-crx", + "**/contracts", "pnpm-lock.yaml" ] } diff --git a/examples/cra-dapp/src/App.tsx b/examples/cra-dapp/src/App.tsx index 2a0d441df9..68d6b36bc0 100644 --- a/examples/cra-dapp/src/App.tsx +++ b/examples/cra-dapp/src/App.tsx @@ -1,8 +1,7 @@ -/* eslint-disable no-console */ import { useAccounts, - useDisconnect, useConnectUI, + useDisconnect, useIsConnected, } from '@fuels/react'; import './App.css'; @@ -19,6 +18,7 @@ function App() {
{isConnected && ( - + )} -
diff --git a/packages/app/.storybook/main.ts b/packages/app/.storybook/main.ts index 96eddc93a0..e4d083ec82 100644 --- a/packages/app/.storybook/main.ts +++ b/packages/app/.storybook/main.ts @@ -1,7 +1,7 @@ -import tsconfigpath from 'vite-tsconfig-paths'; -import { mergeConfig } from 'vite'; -import type { StorybookConfig } from '@storybook/react-vite'; import { join } from 'node:path'; +import type { StorybookConfig } from '@storybook/react-vite'; +import { mergeConfig } from 'vite'; +import tsconfigpath from 'vite-tsconfig-paths'; import { resolveLinkDeps } from '../vite-utils/vite.base.config'; @@ -28,7 +28,7 @@ const config: StorybookConfig = { name: '@storybook/react-vite', options: {}, }, - async viteFinal(config: any) { + async viteFinal(config) { return mergeConfig(config, { ...resolveLinkDeps(), base: join(process.env.STORYBOOK_BASE_URL || config.base || ''), diff --git a/packages/app/.storybook/preview.tsx b/packages/app/.storybook/preview.tsx index 518e91221e..be0a166cb4 100644 --- a/packages/app/.storybook/preview.tsx +++ b/packages/app/.storybook/preview.tsx @@ -1,12 +1,12 @@ -import React from 'react'; import { darkTheme, lightTheme } from '@fuel-ui/react'; import { themes } from '@storybook/theming'; -import { mswDecorator, initialize } from 'msw-storybook-addon'; +import { initialize, mswDecorator } from 'msw-storybook-addon'; +import React from 'react'; import { withRouter } from 'storybook-addon-react-router-v6'; import { Providers } from '../src/systems/Core/components'; import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport'; -import { WALLET_WIDTH, WALLET_HEIGHT } from '../src/config'; +import { WALLET_HEIGHT, WALLET_WIDTH } from '../src/config'; import theme from './theme'; @@ -58,6 +58,7 @@ export const parameters = { export const decorators = [ mswDecorator, withRouter, + // biome-ignore lint/suspicious/noExplicitAny: (Story: any) => ( diff --git a/packages/app/jest.config.ts b/packages/app/jest.config.ts index e03b70cf0e..ec25303ed2 100644 --- a/packages/app/jest.config.ts +++ b/packages/app/jest.config.ts @@ -5,7 +5,6 @@ import { defaultsESM as tsjPreset } from 'ts-jest/presets'; import { getPublicEnvs } from './load.envs'; import pkg from './package.json'; -// eslint-disable-next-line @typescript-eslint/no-unused-vars const { globals, preset, ...baseConfig } = baseDefaultConfig; const config: JestConfigWithTsJest = { diff --git a/packages/app/jest.setup.ts b/packages/app/jest.setup.ts index 8afa4bbe3d..249be7499b 100644 --- a/packages/app/jest.setup.ts +++ b/packages/app/jest.setup.ts @@ -1,13 +1,19 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ +// biome-ignore lint/style/useNodejsImportProtocol: import { webcrypto } from 'crypto'; -import { TextEncoder, TextDecoder } from 'util'; +// biome-ignore lint/style/useNodejsImportProtocol: +import { TextDecoder, TextEncoder } from 'util'; import { localStorageMock } from './src/mocks/localStorage'; +// biome-ignore lint/suspicious/noExplicitAny: (global as any).TextEncoder = TextEncoder; +// biome-ignore lint/suspicious/noExplicitAny: (global as any).TextDecoder = TextDecoder; +// biome-ignore lint/suspicious/noExplicitAny: (global as any).ArrayBuffer = ArrayBuffer; +// biome-ignore lint/suspicious/noExplicitAny: (global as any).Uint8Array = Uint8Array; +// biome-ignore lint/suspicious/noExplicitAny: (global as any).structuredClone = (val: any) => JSON.parse(JSON.stringify(val)); // https://github.com/jsdom/jsdom/issues/1724#issuecomment-720727999 diff --git a/packages/app/load.envs.js b/packages/app/load.envs.js index fa8710ea54..d91bac4e54 100644 --- a/packages/app/load.envs.js +++ b/packages/app/load.envs.js @@ -1,5 +1,7 @@ const { config } = require('dotenv'); +// biome-ignore lint/style/useNodejsImportProtocol: const { resolve } = require('path'); +// biome-ignore lint/style/useNodejsImportProtocol: const { readFileSync } = require('fs'); function getVersion() { @@ -22,6 +24,7 @@ function getEnvName() { } // Load from more specific env file to generic -> +// biome-ignore lint/complexity/noForEach: [getEnvName(), '.env'].forEach((envFile) => { if (!envFile) return; config({ diff --git a/packages/app/playwright.config.ts b/packages/app/playwright.config.ts index c88914751a..cba9e50469 100644 --- a/packages/app/playwright.config.ts +++ b/packages/app/playwright.config.ts @@ -1,5 +1,6 @@ -import { defineConfig } from '@playwright/test'; +// biome-ignore lint/style/useNodejsImportProtocol: import { join } from 'path'; +import { defineConfig } from '@playwright/test'; import './load.envs'; const distDirectory = join(__dirname, './dist'); diff --git a/packages/app/playwright/commons/gas.ts b/packages/app/playwright/commons/gas.ts index 9fca68b728..7c57c1948f 100644 --- a/packages/app/playwright/commons/gas.ts +++ b/packages/app/playwright/commons/gas.ts @@ -1,5 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -import type { Provider, BN } from 'fuels'; +import type { BN, Provider } from 'fuels'; // TODO: remove this function when SDK make transactions with correct gas configs export const getGasConfig = async (provider: Provider) => { diff --git a/packages/app/playwright/commons/seedWallet.ts b/packages/app/playwright/commons/seedWallet.ts index 2c29942181..302d8fc058 100644 --- a/packages/app/playwright/commons/seedWallet.ts +++ b/packages/app/playwright/commons/seedWallet.ts @@ -2,7 +2,7 @@ import type { Page } from '@playwright/test'; import type { BN } from 'fuels'; import { Address, BaseAssetId, Provider, Wallet } from 'fuels'; -import { getAccount, ALT_ASSET } from '../mocks'; +import { ALT_ASSET, getAccount } from '../mocks'; import { getGasConfig } from './gas'; diff --git a/packages/app/playwright/commons/text.ts b/packages/app/playwright/commons/text.ts index 0842c810aa..21d28b9b23 100644 --- a/packages/app/playwright/commons/text.ts +++ b/packages/app/playwright/commons/text.ts @@ -4,8 +4,8 @@ import { expect } from '@playwright/test'; export async function hasText( page: Page, text: string | RegExp, - position: number = 0, - timeout: number = 5000 + position = 0, + timeout = 5000 ) { const textFound = page.getByText(text).nth(position); await expect(textFound).toHaveText(text, { diff --git a/packages/app/playwright/crx/crx.test.ts b/packages/app/playwright/crx/crx.test.ts index a3c25fd4e4..1e0f7758ad 100644 --- a/packages/app/playwright/crx/crx.test.ts +++ b/packages/app/playwright/crx/crx.test.ts @@ -1,22 +1,22 @@ -import { expect } from '@playwright/test'; +import { type Locator, expect } from '@playwright/test'; import { + type Account, + type Asset, + Provider, Signer, + Wallet, bn, hashMessage, - Wallet, - Provider, - type Account, - type Asset, } from 'fuels'; import { - seedWallet, getButtonByText, getByAriaLabel, + getElementByText, hasText, - waitAriaLabel, reload, - getElementByText, + seedWallet, + waitAriaLabel, } from '../commons'; import { CUSTOM_ASSET_INPUT, @@ -26,13 +26,13 @@ import { } from '../mocks'; import { - test, - waitWalletToLoad, getAccountByName, - switchAccount, - waitAccountPage, getWalletAccounts, hideAccount, + switchAccount, + test, + waitAccountPage, + waitWalletToLoad, } from './utils'; const WALLET_PASSWORD = 'Qwe123456$'; @@ -102,7 +102,7 @@ test.describe('FuelWallet Extension', () => { try { await window.fuel.ping(); return true; - } catch (err) { + } catch (_err) { return testConnection(); } } @@ -293,7 +293,7 @@ test.describe('FuelWallet Extension', () => { await test.step('Current authorized current Account', async () => { const authorizedAccount = await switchAccount(popupPage, 'Account 1'); await getByAriaLabel(popupPage, 'Accounts').click({ delay: 1000 }); - await getByAriaLabel(popupPage, `Close dialog`).click(); + await getByAriaLabel(popupPage, 'Close dialog').click(); const currentAccountPromise = await blankPage.evaluate(async () => { return window.fuel.currentAccount(); }); @@ -388,7 +388,7 @@ test.describe('FuelWallet Extension', () => { return blankPage.evaluate( async ([senderAddress, receiverAddress, amount]) => { const receiver = window.createAddress(receiverAddress as string); - const wallet = await window.fuel!.getWallet( + const wallet = await window.fuel?.getWallet( senderAddress as string ); @@ -581,7 +581,7 @@ test.describe('FuelWallet Extension', () => { const networkItemsCount = await items.count(); expect(networkItemsCount).toEqual(2); - let selectedNetworkItem; + let selectedNetworkItem: Locator; for (let i = 0; i < networkItemsCount; i += 1) { const isSelected = await items.nth(i).getAttribute('data-active'); if (isSelected === 'true') { @@ -606,7 +606,7 @@ test.describe('FuelWallet Extension', () => { // Switch to account 2 await switchAccount(popupPage, 'Account 2'); await getByAriaLabel(popupPage, 'Accounts').click({ delay: 1000 }); - await getByAriaLabel(popupPage, `Close dialog`).click(); + await getByAriaLabel(popupPage, 'Close dialog').click(); const onChangeAccountPromise = blankPage.evaluate(() => { return new Promise((resolve) => { @@ -628,7 +628,7 @@ test.describe('FuelWallet Extension', () => { // Switch to account 2 await switchAccount(popupPage, 'Account 2'); await getByAriaLabel(popupPage, 'Accounts').click({ delay: 1000 }); - await getByAriaLabel(popupPage, `Close dialog`).click(); + await getByAriaLabel(popupPage, 'Close dialog').click(); const onChangeAccountPromise = blankPage.evaluate(() => { return new Promise((resolve) => { diff --git a/packages/app/playwright/crx/utils/popup.ts b/packages/app/playwright/crx/utils/popup.ts index e694c8b6be..b56cbe6cd1 100644 --- a/packages/app/playwright/crx/utils/popup.ts +++ b/packages/app/playwright/crx/utils/popup.ts @@ -48,7 +48,7 @@ export async function hideAccount(popupPage: Page, name: string) { await hasText(popupPage, 'Show hidden accounts'); await popupPage.getByText(name).isHidden(); - await getByAriaLabel(popupPage, `Close dialog`).click(); + await getByAriaLabel(popupPage, 'Close dialog').click(); } export async function waitAccountPage(popupPage: Page, name: string) { diff --git a/packages/app/playwright/crx/utils/test.ts b/packages/app/playwright/crx/utils/test.ts index f9274ec82e..ee2668b74e 100644 --- a/packages/app/playwright/crx/utils/test.ts +++ b/packages/app/playwright/crx/utils/test.ts @@ -1,7 +1,7 @@ -/* eslint-disable no-empty-pattern */ +// biome-ignore lint/style/useNodejsImportProtocol: +import path from 'path'; import type { BrowserContext } from '@playwright/test'; import { test as base, chromium } from '@playwright/test'; -import path from 'path'; const pathToExtension = path.join(__dirname, '../../../dist-crx'); @@ -34,6 +34,7 @@ test.afterAll(({ context }) => { }); test.use({ + // biome-ignore lint/correctness/noEmptyPattern: context: ({}, use) => { use(context); }, diff --git a/packages/app/playwright/e2e/Accounts.test.ts b/packages/app/playwright/e2e/Accounts.test.ts index 9fbab153ba..b1d5085a8d 100644 --- a/packages/app/playwright/e2e/Accounts.test.ts +++ b/packages/app/playwright/e2e/Accounts.test.ts @@ -12,7 +12,7 @@ import { waitUrl, } from '../commons'; import type { MockData } from '../mocks'; -import { mockData, WALLET_PASSWORD } from '../mocks'; +import { WALLET_PASSWORD, mockData } from '../mocks'; test.describe('Account', () => { let browser: Browser; diff --git a/packages/app/playwright/e2e/ChangePassword.test.ts b/packages/app/playwright/e2e/ChangePassword.test.ts index d3eaf7d9bd..0e554dd15e 100644 --- a/packages/app/playwright/e2e/ChangePassword.test.ts +++ b/packages/app/playwright/e2e/ChangePassword.test.ts @@ -2,7 +2,7 @@ import type { Browser, Page } from '@playwright/test'; import test, { chromium } from '@playwright/test'; import { getButtonByText, getByAriaLabel, hasText, visit } from '../commons'; -import { mockData, WALLET_PASSWORD } from '../mocks'; +import { WALLET_PASSWORD, mockData } from '../mocks'; test.describe('ChangePassword', () => { let browser: Browser; diff --git a/packages/app/playwright/e2e/HomeWallet.test.ts b/packages/app/playwright/e2e/HomeWallet.test.ts index 798fbf8bc7..3675bed030 100644 --- a/packages/app/playwright/e2e/HomeWallet.test.ts +++ b/packages/app/playwright/e2e/HomeWallet.test.ts @@ -5,8 +5,8 @@ import { getButtonByText, getByAriaLabel, hasText, - visit, reload, + visit, } from '../commons'; import { mockData } from '../mocks'; diff --git a/packages/app/playwright/e2e/Networks.test.ts b/packages/app/playwright/e2e/Networks.test.ts index b984d26463..2ba498a254 100644 --- a/packages/app/playwright/e2e/Networks.test.ts +++ b/packages/app/playwright/e2e/Networks.test.ts @@ -2,12 +2,12 @@ import type { Browser, Page } from '@playwright/test'; import test, { chromium, expect } from '@playwright/test'; import { - visit, + getButtonByText, getByAriaLabel, getInputByName, - getButtonByText, hasText, reload, + visit, } from '../commons'; import { mockData } from '../mocks'; diff --git a/packages/app/playwright/e2e/RecoverWallet.test.ts b/packages/app/playwright/e2e/RecoverWallet.test.ts index c8eb060c0f..41a9b97104 100644 --- a/packages/app/playwright/e2e/RecoverWallet.test.ts +++ b/packages/app/playwright/e2e/RecoverWallet.test.ts @@ -2,11 +2,11 @@ import type { Browser, Page } from '@playwright/test'; import test, { chromium, expect } from '@playwright/test'; import { - getByAriaLabel, getButtonByText, - visit, - hasText, + getByAriaLabel, getElementByText, + hasText, + visit, } from '../commons'; import { logout } from '../commons/logout'; import { WALLET_PASSWORD } from '../mocks'; diff --git a/packages/app/playwright/e2e/ReportError.test.ts b/packages/app/playwright/e2e/ReportError.test.ts index c9d8deb668..b28789bb75 100644 --- a/packages/app/playwright/e2e/ReportError.test.ts +++ b/packages/app/playwright/e2e/ReportError.test.ts @@ -1,7 +1,7 @@ import type { Browser, BrowserContext, Page } from '@playwright/test'; import test, { chromium, expect } from '@playwright/test'; -import { visit, hasText, getButtonByText, reload } from '../commons'; +import { getButtonByText, hasText, reload, visit } from '../commons'; import { mockData } from '../mocks'; test.describe('ReportError', () => { @@ -16,7 +16,7 @@ test.describe('ReportError', () => { await mockData(page); }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: async function getPageErrors(page: Page): Promise { return page.evaluate(async () => { const fuelDB = window.fuelDB; diff --git a/packages/app/playwright/e2e/SendTransaction.test.ts b/packages/app/playwright/e2e/SendTransaction.test.ts index e97fedda81..cb7284933d 100644 --- a/packages/app/playwright/e2e/SendTransaction.test.ts +++ b/packages/app/playwright/e2e/SendTransaction.test.ts @@ -1,16 +1,16 @@ import type { Account } from '@fuel-wallet/types'; import type { Browser, Page } from '@playwright/test'; import test, { chromium, expect } from '@playwright/test'; -import { bn, Provider, Wallet } from 'fuels'; +import { Provider, Wallet, bn } from 'fuels'; import { getButtonByText, - hasText, - visit, - getInputByName, getByAriaLabel, - hasAriaLabel, getElementByText, + getInputByName, + hasAriaLabel, + hasText, + visit, } from '../commons'; import { seedWallet } from '../commons/seedWallet'; import { ALT_ASSET, mockData } from '../mocks'; diff --git a/packages/app/playwright/e2e/UnlockScreen.test.ts b/packages/app/playwright/e2e/UnlockScreen.test.ts index 88d905d9eb..449a24905f 100644 --- a/packages/app/playwright/e2e/UnlockScreen.test.ts +++ b/packages/app/playwright/e2e/UnlockScreen.test.ts @@ -2,7 +2,7 @@ import type { Browser, Page } from '@playwright/test'; import test, { chromium } from '@playwright/test'; import { getByAriaLabel, hasText, reload, visit } from '../commons'; -import { mockData, WALLET_PASSWORD } from '../mocks'; +import { WALLET_PASSWORD, mockData } from '../mocks'; test.describe('UnlockScreen', () => { let browser: Browser; diff --git a/packages/app/playwright/e2e/ViewRecoveryPhrase.test.ts b/packages/app/playwright/e2e/ViewRecoveryPhrase.test.ts index 5aeecd5f1d..8c0abee709 100644 --- a/packages/app/playwright/e2e/ViewRecoveryPhrase.test.ts +++ b/packages/app/playwright/e2e/ViewRecoveryPhrase.test.ts @@ -7,7 +7,7 @@ import { getElementByText, hasText, } from '../commons'; -import { mockData, WALLET_PASSWORD } from '../mocks'; +import { WALLET_PASSWORD, mockData } from '../mocks'; test.describe('ViewSeedPhrase', () => { let browser: Browser; diff --git a/packages/app/playwright/mocks/database.ts b/packages/app/playwright/mocks/database.ts index e91ba8c4c4..0cef725f1b 100644 --- a/packages/app/playwright/mocks/database.ts +++ b/packages/app/playwright/mocks/database.ts @@ -1,11 +1,11 @@ import type { AssetData, Connection, NetworkData } from '@fuel-wallet/types'; import type { Page } from '@playwright/test'; import type { - WalletManagerAccount as WalletAccount, Account, Asset, + WalletManagerAccount as WalletAccount, } from 'fuels'; -import { WalletManager, Mnemonic, encrypt, Address } from 'fuels'; +import { Address, Mnemonic, WalletManager, encrypt } from 'fuels'; import { getByAriaLabel } from '../commons/locator'; import { hasText } from '../commons/text'; @@ -116,7 +116,7 @@ export async function createManager(mnemonic: string) { return walletManager; } -export function createAccount(wallet: WalletAccount, index: number = 0) { +export function createAccount(wallet: WalletAccount, index = 0) { return { address: wallet.address.toAddress(), balance: '0', @@ -129,10 +129,7 @@ export function createAccount(wallet: WalletAccount, index: number = 0) { }; } -export function createAccounts( - manager: WalletManager, - numberOfAccounts: number = 1 -) { +export function createAccounts(manager: WalletManager, numberOfAccounts = 1) { return Promise.all( new Array(numberOfAccounts).fill(0).map(async (_, index) => { const walletAccount = await manager.addAccount(); @@ -178,7 +175,7 @@ export async function serializeVault( export async function mockData( page: Page, - numberOfAccounts: number = 1, + numberOfAccounts = 1, networks: Array = DEFAULT_NETWORKS ) { await visit(page, '/'); @@ -246,7 +243,7 @@ export async function unlock(page, password = WALLET_PASSWORD) { await hasText(page, 'Welcome back'); await getByAriaLabel(page, 'Your Password').fill(password); await getByAriaLabel(page, 'Unlock wallet').click(); - } catch (err) { + } catch (_err) { // Ignore } } diff --git a/packages/app/playwright/types.d.ts b/packages/app/playwright/types.d.ts index 890ded06d2..97f28b90fa 100644 --- a/packages/app/playwright/types.d.ts +++ b/packages/app/playwright/types.d.ts @@ -6,5 +6,3 @@ declare global { createAddress: (string: string) => Address; } } - -export {}; diff --git a/packages/app/public/mockServiceWorker.js b/packages/app/public/mockServiceWorker.js index 061388aa39..6bc27df61a 100644 --- a/packages/app/public/mockServiceWorker.js +++ b/packages/app/public/mockServiceWorker.js @@ -1,6 +1,3 @@ -/* eslint-disable */ -/* tslint:disable */ - /** * Mock Service Worker (0.49.1). * @see https://github.com/mswjs/msw @@ -11,15 +8,15 @@ const INTEGRITY_CHECKSUM = '3d6b9f06410d179a7f7404d4bf4c3c70'; const activeClientIds = new Set(); -self.addEventListener('install', function () { +self.addEventListener('install', () => { self.skipWaiting(); }); -self.addEventListener('activate', function (event) { +self.addEventListener('activate', (event) => { event.waitUntil(self.clients.claim()); }); -self.addEventListener('message', async function (event) { +self.addEventListener('message', async (event) => { const clientId = event.source.id; if (!clientId || !self.clients) { @@ -84,7 +81,7 @@ self.addEventListener('message', async function (event) { } }); -self.addEventListener('fetch', function (event) { +self.addEventListener('fetch', (event) => { const { request } = event; const accept = request.headers.get('accept') || ''; @@ -145,7 +142,7 @@ async function handleRequest(event, requestId) { // Ensure MSW is active and ready to handle the message, otherwise // this message will pend indefinitely. if (client && activeClientIds.has(client.id)) { - (async function () { + (async () => { const clonedResponse = response.clone(); sendToClient(client, { type: 'RESPONSE', @@ -207,7 +204,7 @@ async function getResponse(event, client, requestId) { // comply with the server's CORS preflight check. // Operate with the headers as an object because request "Headers" // are immutable. - delete headers['x-msw-bypass']; + headers['x-msw-bypass'] = undefined; return fetch(clonedRequest, { headers }); } @@ -280,7 +277,7 @@ function sendToClient(client, message) { const channel = new MessageChannel(); channel.port1.onmessage = (event) => { - if (event.data && event.data.error) { + if (event.data?.error) { return reject(event.data.error); } diff --git a/packages/app/src/mocks/localStorage.ts b/packages/app/src/mocks/localStorage.ts index 916de771a3..7d79713d36 100644 --- a/packages/app/src/mocks/localStorage.ts +++ b/packages/app/src/mocks/localStorage.ts @@ -1,8 +1,9 @@ class LocalStorageMock { - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: [key: string]: any; clear() { + // biome-ignore lint/complexity/noForEach: Object.keys(this).forEach((key) => { delete this[key]; }); diff --git a/packages/app/src/systems/Account/__mocks__/accounts.tsx b/packages/app/src/systems/Account/__mocks__/accounts.tsx index 7fd7b23619..4a6e66f217 100644 --- a/packages/app/src/systems/Account/__mocks__/accounts.tsx +++ b/packages/app/src/systems/Account/__mocks__/accounts.tsx @@ -1,5 +1,5 @@ -import { WalletManager, Signer } from 'fuels'; -import { db, Storage } from '~/systems/Core'; +import { Signer, WalletManager } from 'fuels'; +import { Storage, db } from '~/systems/Core'; import { AccountService } from '../services'; import { IndexedDBStorage } from '../utils'; diff --git a/packages/app/src/systems/Account/components/AccountForm/AccountForm.test.tsx b/packages/app/src/systems/Account/components/AccountForm/AccountForm.test.tsx index a728b617a0..70b3ed9de7 100644 --- a/packages/app/src/systems/Account/components/AccountForm/AccountForm.test.tsx +++ b/packages/app/src/systems/Account/components/AccountForm/AccountForm.test.tsx @@ -1,4 +1,4 @@ -import { render, testA11y, screen } from '@fuel-ui/test-utils'; +import { render, screen, testA11y } from '@fuel-ui/test-utils'; import { MOCK_ACCOUNTS } from '../../__mocks__'; import { useAccountForm } from '../../hooks/useAccountForm'; diff --git a/packages/app/src/systems/Account/components/AccountInfo/AccountInfo.stories.tsx b/packages/app/src/systems/Account/components/AccountInfo/AccountInfo.stories.tsx index 513c2af79e..172d1a691a 100644 --- a/packages/app/src/systems/Account/components/AccountInfo/AccountInfo.stories.tsx +++ b/packages/app/src/systems/Account/components/AccountInfo/AccountInfo.stories.tsx @@ -1,5 +1,5 @@ import { Box } from '@fuel-ui/react'; -import type { StoryFn, Meta } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { MOCK_ACCOUNTS } from '~/systems/Account'; import { AccountInfo } from './AccountInfo'; diff --git a/packages/app/src/systems/Account/components/AccountInfo/AccountInfo.test.tsx b/packages/app/src/systems/Account/components/AccountInfo/AccountInfo.test.tsx index 3f682d930e..a5275d63bf 100644 --- a/packages/app/src/systems/Account/components/AccountInfo/AccountInfo.test.tsx +++ b/packages/app/src/systems/Account/components/AccountInfo/AccountInfo.test.tsx @@ -1,6 +1,6 @@ import { render, screen, testA11y, waitFor } from '@fuel-ui/test-utils'; import { AccountService, MOCK_ACCOUNTS } from '~/systems/Account'; -import { shortAddress, TestWrapper } from '~/systems/Core'; +import { TestWrapper, shortAddress } from '~/systems/Core'; import { AccountInfo } from './AccountInfo'; diff --git a/packages/app/src/systems/Account/components/AccountItem/AccountItem.tsx b/packages/app/src/systems/Account/components/AccountItem/AccountItem.tsx index 43f9b1f33e..903c3663d9 100644 --- a/packages/app/src/systems/Account/components/AccountItem/AccountItem.tsx +++ b/packages/app/src/systems/Account/components/AccountItem/AccountItem.tsx @@ -115,7 +115,7 @@ export const AccountItem: AccountItemComponent = ({ /> onAction={(action: any) => { if (action === 'update') onUpdate?.(account.address); if (action === 'export') onExport?.(account.address); diff --git a/packages/app/src/systems/Account/components/AccountList/AccountList.tsx b/packages/app/src/systems/Account/components/AccountList/AccountList.tsx index 255982d1da..402e7cbaea 100644 --- a/packages/app/src/systems/Account/components/AccountList/AccountList.tsx +++ b/packages/app/src/systems/Account/components/AccountList/AccountList.tsx @@ -37,6 +37,7 @@ export function AccountList({ {isLoading && ( {[...Array(3)].map((_, i) => { + // biome-ignore lint/suspicious/noArrayIndexKey: return ; })} @@ -67,7 +68,7 @@ export function AccountList({ variant="link" onPress={toggle} css={styles.hiddenBtn} - aria-label={`Toggle hidden accounts`} + aria-label={'Toggle hidden accounts'} > {showHidden ? 'Hide' : 'Show'} hidden accounts diff --git a/packages/app/src/systems/Account/components/BalanceWidget/BalanceWidget.test.tsx b/packages/app/src/systems/Account/components/BalanceWidget/BalanceWidget.test.tsx index 3b43cb75c9..60a6fd0e3b 100644 --- a/packages/app/src/systems/Account/components/BalanceWidget/BalanceWidget.test.tsx +++ b/packages/app/src/systems/Account/components/BalanceWidget/BalanceWidget.test.tsx @@ -1,7 +1,7 @@ import { screen, testA11y } from '@fuel-ui/test-utils'; import { fireEvent } from '@storybook/testing-library'; import { act } from 'react-dom/test-utils'; -import { shortAddress, TestWrapper } from '~/systems/Core'; +import { TestWrapper, shortAddress } from '~/systems/Core'; import { renderWithProvider } from '~/systems/Core/__tests__/utils'; import { MOCK_ACCOUNTS } from '../../__mocks__'; diff --git a/packages/app/src/systems/Account/components/EthAddress/EthAddress.tsx b/packages/app/src/systems/Account/components/EthAddress/EthAddress.tsx index 204b6a99ba..5249ec9590 100644 --- a/packages/app/src/systems/Account/components/EthAddress/EthAddress.tsx +++ b/packages/app/src/systems/Account/components/EthAddress/EthAddress.tsx @@ -1,6 +1,6 @@ import type { ThemeUtilsCSS } from '@fuel-ui/css'; import { cssObj } from '@fuel-ui/css'; -import { Copyable, Box, Text, Tooltip } from '@fuel-ui/react'; +import { Box, Copyable, Text, Tooltip } from '@fuel-ui/react'; import { bn } from 'fuels'; import { isValidEthAddress, shortAddress } from '~/systems/Core'; diff --git a/packages/app/src/systems/Account/components/ImportAccountForm/ImportAccountForm.test.tsx b/packages/app/src/systems/Account/components/ImportAccountForm/ImportAccountForm.test.tsx index d5e54fa9fb..e837d66fe9 100644 --- a/packages/app/src/systems/Account/components/ImportAccountForm/ImportAccountForm.test.tsx +++ b/packages/app/src/systems/Account/components/ImportAccountForm/ImportAccountForm.test.tsx @@ -1,4 +1,4 @@ -import { render, testA11y, screen } from '@fuel-ui/test-utils'; +import { render, screen, testA11y } from '@fuel-ui/test-utils'; import { useImportAccountForm } from '../../hooks/useImportAccountForm'; diff --git a/packages/app/src/systems/Account/hooks/useAccountForm.ts b/packages/app/src/systems/Account/hooks/useAccountForm.ts index eaa7dc2438..709c7cfd1f 100644 --- a/packages/app/src/systems/Account/hooks/useAccountForm.ts +++ b/packages/app/src/systems/Account/hooks/useAccountForm.ts @@ -35,6 +35,7 @@ export function useAccountForm(opts: UseAddAccountOpts = {}) { defaultValues: opts.defaultValues || DEFAULT_VALUES, }); + // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { opts.defaultValues && form.reset(opts.defaultValues); }, [opts.defaultValues?.name]); diff --git a/packages/app/src/systems/Account/hooks/useAccounts.tsx b/packages/app/src/systems/Account/hooks/useAccounts.tsx index 9038c084cb..282868b1f3 100644 --- a/packages/app/src/systems/Account/hooks/useAccounts.tsx +++ b/packages/app/src/systems/Account/hooks/useAccounts.tsx @@ -1,7 +1,7 @@ import type { AssetData } from '@fuel-wallet/types'; import { bn } from 'fuels'; import { useEffect, useRef } from 'react'; -import { store, Services } from '~/store'; +import { Services, store } from '~/store'; import { useAssets } from '~/systems/Asset'; import { useOverlay } from '~/systems/Overlay'; diff --git a/packages/app/src/systems/Account/machines/accountsMachine.test.ts b/packages/app/src/systems/Account/machines/accountsMachine.test.ts index 4cb5e06fcb..789469dc72 100644 --- a/packages/app/src/systems/Account/machines/accountsMachine.test.ts +++ b/packages/app/src/systems/Account/machines/accountsMachine.test.ts @@ -1,6 +1,6 @@ import { bn } from 'fuels'; import { interpret } from 'xstate'; -import { db, Storage } from '~/systems/Core'; +import { Storage, db } from '~/systems/Core'; import { expectStateMatch } from '~/systems/Core/__tests__/utils'; import { MOCK_ACCOUNTS, createMockAccount } from '../__mocks__'; diff --git a/packages/app/src/systems/Account/machines/accountsMachine.tsx b/packages/app/src/systems/Account/machines/accountsMachine.tsx index cd3d4ad04a..cb754f6f55 100644 --- a/packages/app/src/systems/Account/machines/accountsMachine.tsx +++ b/packages/app/src/systems/Account/machines/accountsMachine.tsx @@ -33,6 +33,7 @@ export type AccountsMachineEvents = | { type: 'REFRESH_ACCOUNTS'; input?: null } | { type: 'RELOAD_BALANCE'; input?: null } | { type: 'SET_CURRENT_ACCOUNT'; input: AccountInputs['setCurrentAccount'] } + // biome-ignore lint/suspicious/noConfusingVoidType: | { type: 'LOGOUT'; input?: void } | { type: 'TOGGLE_HIDE_ACCOUNT'; @@ -64,7 +65,6 @@ const fetchAccount = { export const accountsMachine = createMachine( { - // eslint-disable-next-line @typescript-eslint/consistent-type-imports tsTypes: {} as import('./accountsMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/Account/machines/addAccountMachine.test.ts b/packages/app/src/systems/Account/machines/addAccountMachine.test.ts index 237315d325..632bd46b21 100644 --- a/packages/app/src/systems/Account/machines/addAccountMachine.test.ts +++ b/packages/app/src/systems/Account/machines/addAccountMachine.test.ts @@ -33,7 +33,7 @@ describe('addAccountMachine', () => { await expectStateMatch(service, 'idle'); const accounts = await AccountService.getAccounts(); - expect(accounts?.[1].name).toBe(`Account 2`); + expect(accounts?.[1].name).toBe('Account 2'); }); }); }); diff --git a/packages/app/src/systems/Account/machines/addAccountMachine.tsx b/packages/app/src/systems/Account/machines/addAccountMachine.tsx index bdc9c959e3..b7e40e1d96 100644 --- a/packages/app/src/systems/Account/machines/addAccountMachine.tsx +++ b/packages/app/src/systems/Account/machines/addAccountMachine.tsx @@ -24,7 +24,6 @@ export type AddAccountMachineEvents = { export const addAccountMachine = createMachine( { - // eslint-disable-next-line @typescript-eslint/consistent-type-imports tsTypes: {} as import('./addAccountMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/Account/machines/editAccountMachine.tsx b/packages/app/src/systems/Account/machines/editAccountMachine.tsx index 6a50d17f25..3bfc66ee49 100644 --- a/packages/app/src/systems/Account/machines/editAccountMachine.tsx +++ b/packages/app/src/systems/Account/machines/editAccountMachine.tsx @@ -29,7 +29,6 @@ export type EditAccountMachineEvents = { export const editAccountMachine = createMachine( { - // eslint-disable-next-line @typescript-eslint/consistent-type-imports tsTypes: {} as import('./editAccountMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/Account/machines/exportAccountMachine.tsx b/packages/app/src/systems/Account/machines/exportAccountMachine.tsx index 40b0263faa..d284351f46 100644 --- a/packages/app/src/systems/Account/machines/exportAccountMachine.tsx +++ b/packages/app/src/systems/Account/machines/exportAccountMachine.tsx @@ -32,7 +32,6 @@ export type ExportAccountMachineEvents = { export const exportAccountMachine = createMachine( { - // eslint-disable-next-line @typescript-eslint/consistent-type-imports tsTypes: {} as import('./exportAccountMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/Account/machines/importAccountMachine.tsx b/packages/app/src/systems/Account/machines/importAccountMachine.tsx index a1d123fdda..5629bb3a28 100644 --- a/packages/app/src/systems/Account/machines/importAccountMachine.tsx +++ b/packages/app/src/systems/Account/machines/importAccountMachine.tsx @@ -23,7 +23,6 @@ export type ImportAccountMachineEvents = { export const importAccountMachine = createMachine( { - // eslint-disable-next-line @typescript-eslint/consistent-type-imports tsTypes: {} as import('./importAccountMachine.typegen').Typegen0, schema: { context: {}, diff --git a/packages/app/src/systems/Account/pages/Accounts/Accounts.stories.tsx b/packages/app/src/systems/Account/pages/Accounts/Accounts.stories.tsx index 3baa9d03a0..67289b4f2f 100644 --- a/packages/app/src/systems/Account/pages/Accounts/Accounts.stories.tsx +++ b/packages/app/src/systems/Account/pages/Accounts/Accounts.stories.tsx @@ -1,5 +1,5 @@ import { Box, Button } from '@fuel-ui/react'; -import type { StoryFn, Meta } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { store } from '~/store'; import { Layout } from '~/systems/Core'; diff --git a/packages/app/src/systems/Account/pages/EditAccount/EditAccount.stories.tsx b/packages/app/src/systems/Account/pages/EditAccount/EditAccount.stories.tsx index c14c519811..8686fc4015 100644 --- a/packages/app/src/systems/Account/pages/EditAccount/EditAccount.stories.tsx +++ b/packages/app/src/systems/Account/pages/EditAccount/EditAccount.stories.tsx @@ -1,5 +1,5 @@ import { Box, Button } from '@fuel-ui/react'; -import type { StoryFn, Meta } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { store } from '~/store'; import { Layout } from '~/systems/Core'; diff --git a/packages/app/src/systems/Account/pages/ExportAccount/ExportAccount.stories.tsx b/packages/app/src/systems/Account/pages/ExportAccount/ExportAccount.stories.tsx index 8a9a02b6c3..2b64f3abf3 100644 --- a/packages/app/src/systems/Account/pages/ExportAccount/ExportAccount.stories.tsx +++ b/packages/app/src/systems/Account/pages/ExportAccount/ExportAccount.stories.tsx @@ -1,5 +1,5 @@ import { Box, Button, Text } from '@fuel-ui/react'; -import type { StoryFn, Meta } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { store } from '~/store'; import { Layout } from '~/systems/Core'; diff --git a/packages/app/src/systems/Account/pages/ExportAccount/ExportAccount.tsx b/packages/app/src/systems/Account/pages/ExportAccount/ExportAccount.tsx index 2ca2467316..a481932b34 100644 --- a/packages/app/src/systems/Account/pages/ExportAccount/ExportAccount.tsx +++ b/packages/app/src/systems/Account/pages/ExportAccount/ExportAccount.tsx @@ -1,5 +1,5 @@ import { cssObj } from '@fuel-ui/css'; -import { Card, Copyable, Dialog, Text, Box, Alert } from '@fuel-ui/react'; +import { Alert, Box, Card, Copyable, Dialog, Text } from '@fuel-ui/react'; import { styles as coreStyles } from '~/systems/Core'; import { OverlayDialogTopbar } from '~/systems/Overlay'; import { UnlockCard } from '~/systems/Unlock'; diff --git a/packages/app/src/systems/Account/pages/ImportAccount/ImportAccount.stories.tsx b/packages/app/src/systems/Account/pages/ImportAccount/ImportAccount.stories.tsx index cda6886fe1..569905b3c0 100644 --- a/packages/app/src/systems/Account/pages/ImportAccount/ImportAccount.stories.tsx +++ b/packages/app/src/systems/Account/pages/ImportAccount/ImportAccount.stories.tsx @@ -1,5 +1,5 @@ import { Box, Button } from '@fuel-ui/react'; -import type { StoryFn, Meta } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { store } from '~/store'; import { Layout } from '~/systems/Core'; diff --git a/packages/app/src/systems/Account/pages/Logout/Logout.stories.tsx b/packages/app/src/systems/Account/pages/Logout/Logout.stories.tsx index 0a00aebc74..15aee5b71c 100644 --- a/packages/app/src/systems/Account/pages/Logout/Logout.stories.tsx +++ b/packages/app/src/systems/Account/pages/Logout/Logout.stories.tsx @@ -1,5 +1,5 @@ import { Box, Button } from '@fuel-ui/react'; -import type { StoryFn, Meta } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { store } from '~/store'; import { Layout } from '~/systems/Core'; diff --git a/packages/app/src/systems/Account/services/account.test.ts b/packages/app/src/systems/Account/services/account.test.ts index 02dbbd8994..9f569b1af5 100644 --- a/packages/app/src/systems/Account/services/account.test.ts +++ b/packages/app/src/systems/Account/services/account.test.ts @@ -1,4 +1,4 @@ -import { bn, BaseAssetId } from 'fuels'; +import { BaseAssetId, bn } from 'fuels'; import { mockServer } from '~/mocks/server'; import { mockBalancesOnGraphQL } from '~/systems/Asset/__mocks__/assets'; diff --git a/packages/app/src/systems/Account/services/account.ts b/packages/app/src/systems/Account/services/account.ts index 1ca7b8ac71..864f0d7ab8 100644 --- a/packages/app/src/systems/Account/services/account.ts +++ b/packages/app/src/systems/Account/services/account.ts @@ -1,5 +1,5 @@ import type { Account } from '@fuel-wallet/types'; -import { Address, bn, Provider } from 'fuels'; +import { Address, Provider, bn } from 'fuels'; import { isEth } from '~/systems/Asset/utils/asset'; import type { Maybe } from '~/systems/Core/types'; import { db } from '~/systems/Core/utils/database'; @@ -41,6 +41,7 @@ export type AccountInputs = { }; }; +// biome-ignore lint/complexity/noStaticOnlyClass: export class AccountService { static async addAccount(input: AccountInputs['addAccount']) { return db.transaction('rw', db.accounts, async () => { @@ -107,7 +108,7 @@ export class AccountService { }, }); return nextAccount ?? account; - } catch (error) { + } catch (_error) { const nextAccount = await AccountService.setBalance({ data: { address: account.address || '', @@ -130,6 +131,7 @@ export class AccountService { } static toMap(accounts: Account[]) { + // biome-ignore lint/performance/noAccumulatingSpread: return accounts.reduce((obj, acc) => ({ ...obj, [acc.address]: acc }), {}); } @@ -168,8 +170,9 @@ export class AccountService { }); } - static async checkAccountNameExists(name: string = '') { + static async checkAccountNameExists(name = '') { const accounts = await AccountService.getAccounts(); + // biome-ignore lint/complexity/noThisInStatic: const exitsAccountWithName = this.filterByName(accounts, name).length > 0; return exitsAccountWithName; } @@ -186,7 +189,7 @@ export class AccountService { return name || desiredName; } - static filterByName(accounts: Account[], name: string = '') { + static filterByName(accounts: Account[], name = '') { return accounts.filter((account) => account.name.toLowerCase().includes(name.toLowerCase()) ); @@ -197,7 +200,7 @@ export class AccountService { // Private methods // ---------------------------------------------------------------------------- -async function getBalances(providerUrl: string, publicKey: string = '0x00') { +async function getBalances(providerUrl: string, publicKey = '0x00') { const provider = await Provider.create(providerUrl!); const address = Address.fromPublicKey(publicKey); const balances = await provider.getBalances(address); diff --git a/packages/app/src/systems/Asset/__mocks__/assets.tsx b/packages/app/src/systems/Asset/__mocks__/assets.tsx index fc32d86c05..fdf70cc4e4 100644 --- a/packages/app/src/systems/Asset/__mocks__/assets.tsx +++ b/packages/app/src/systems/Asset/__mocks__/assets.tsx @@ -1,5 +1,5 @@ import type { BigNumberish } from 'fuels'; -import { bn, BaseAssetId } from 'fuels'; +import { BaseAssetId, bn } from 'fuels'; import { graphql } from 'msw'; import { fuelAssets } from '~/systems/Core'; @@ -58,7 +58,7 @@ type BalanceNode = { }; export function mockBalancesOnGraphQL(nodes: BalanceNode[] = MOCK_ASSETS_NODE) { - return graphql.query('getBalances', (req, res, ctx) => { + return graphql.query('getBalances', (_req, res, ctx) => { return res(ctx.data({ balances: { edges: nodes } })); }); } diff --git a/packages/app/src/systems/Asset/components/AssetForm/AssetForm.tsx b/packages/app/src/systems/Asset/components/AssetForm/AssetForm.tsx index abc30c9f59..ab18a96fd6 100644 --- a/packages/app/src/systems/Asset/components/AssetForm/AssetForm.tsx +++ b/packages/app/src/systems/Asset/components/AssetForm/AssetForm.tsx @@ -1,4 +1,4 @@ -import { Input, Box } from '@fuel-ui/react'; +import { Box, Input } from '@fuel-ui/react'; import { ControlledField } from '~/systems/Core'; import type { UseAssetFormReturn } from '../../hooks/useAssetForm'; diff --git a/packages/app/src/systems/Asset/components/AssetList/AssetListLoading.tsx b/packages/app/src/systems/Asset/components/AssetList/AssetListLoading.tsx index 0ba74c2903..5306c530c2 100644 --- a/packages/app/src/systems/Asset/components/AssetList/AssetListLoading.tsx +++ b/packages/app/src/systems/Asset/components/AssetList/AssetListLoading.tsx @@ -10,6 +10,7 @@ export function AssetListLoading({ items = 5 }: AssetListLoadingProps) { return ( {Array.from({ length: items }).map((_, idx) => ( + // biome-ignore lint/suspicious/noArrayIndexKey: ))} diff --git a/packages/app/src/systems/Asset/components/AssetSelect/AssetSelect.tsx b/packages/app/src/systems/Asset/components/AssetSelect/AssetSelect.tsx index a9842a0c60..11317d27a2 100644 --- a/packages/app/src/systems/Asset/components/AssetSelect/AssetSelect.tsx +++ b/packages/app/src/systems/Asset/components/AssetSelect/AssetSelect.tsx @@ -107,7 +107,7 @@ export function AssetSelect({ autoFocus aria-label="Actions" css={styles.menu} - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: onAction={(assetId: any) => onSelect(assetId.toString())} > {(items || []).map((item) => { diff --git a/packages/app/src/systems/Asset/hooks/useAsset.tsx b/packages/app/src/systems/Asset/hooks/useAsset.tsx index 9831bb80d3..38457414fe 100644 --- a/packages/app/src/systems/Asset/hooks/useAsset.tsx +++ b/packages/app/src/systems/Asset/hooks/useAsset.tsx @@ -12,7 +12,7 @@ const selectors = { }, }; -export function useAsset(assetId: string = '') { +export function useAsset(assetId = '') { const asset = store.useSelector(Services.assets, selectors.asset(assetId)); return asset; diff --git a/packages/app/src/systems/Asset/hooks/useAssetForm.tsx b/packages/app/src/systems/Asset/hooks/useAssetForm.tsx index 1e5c4c1567..31c81fd241 100644 --- a/packages/app/src/systems/Asset/hooks/useAssetForm.tsx +++ b/packages/app/src/systems/Asset/hooks/useAssetForm.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ - import { yupResolver } from '@hookform/resolvers/yup'; import { isB256 } from 'fuels'; import { useEffect } from 'react'; @@ -15,15 +13,17 @@ export type AssetFormValues = { symbol: string; }; +// biome-ignore lint/suspicious/noExplicitAny: function isValidId(id: any) { return isB256(id); } +// biome-ignore lint/suspicious/noExplicitAny: function isValidUrl(url: any) { if (url === '') return true; try { new URL(url); - } catch (e) { + } catch (_e) { return false; } return true; @@ -70,6 +70,7 @@ export function useAssetForm(opts: UseAddAssetOpts = {}) { defaultValues: opts.defaultValues || DEFAULT_VALUES, }); + // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { opts.defaultValues && form.reset(opts.defaultValues); }, [JSON.stringify(opts.defaultValues)]); diff --git a/packages/app/src/systems/Asset/machines/assetsMachine.tsx b/packages/app/src/systems/Asset/machines/assetsMachine.tsx index b251bb7042..2d5f968312 100644 --- a/packages/app/src/systems/Asset/machines/assetsMachine.tsx +++ b/packages/app/src/systems/Asset/machines/assetsMachine.tsx @@ -32,6 +32,7 @@ type MachineServices = { data: boolean; }; setListedAssets: { + // biome-ignore lint/suspicious/noConfusingVoidType: data: void; }; }; @@ -45,7 +46,7 @@ type MachineEvents = export const assetsMachine = createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./assetsMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/Asset/services/assets.ts b/packages/app/src/systems/Asset/services/assets.ts index 31933eadff..8fcea09bd6 100644 --- a/packages/app/src/systems/Asset/services/assets.ts +++ b/packages/app/src/systems/Asset/services/assets.ts @@ -27,6 +27,7 @@ export type AssetInputs = { }; }; +// biome-ignore lint/complexity/noStaticOnlyClass: export class AssetService { static async upsertAsset(input: AssetInputs['upsertAsset']) { return db.transaction('rw!', db.assets, async () => { @@ -156,6 +157,7 @@ export class AssetService { if (trimmedAssets.length !== uniqueAssetsBySymbol.length) { throw new Error('Asset with same symbol being added multiple times'); } + // biome-ignore lint/complexity/noForEach: trimmedAssets.forEach((obj) => { if ( !Number.isInteger(obj.decimals) || diff --git a/packages/app/src/systems/CRX/background/actions/keepAwake.ts b/packages/app/src/systems/CRX/background/actions/keepAwake.ts index 7c7b63b817..4a5e258968 100644 --- a/packages/app/src/systems/CRX/background/actions/keepAwake.ts +++ b/packages/app/src/systems/CRX/background/actions/keepAwake.ts @@ -1,7 +1,6 @@ chrome.alarms.create('KeepAwake', { periodInMinutes: 1 }); chrome.alarms.onAlarm.addListener((alarm) => { if (alarm.name === 'KeepAwake') { - // eslint-disable-next-line no-console console.debug('[FUEL WALLET] KeepAwake signal'); } }); diff --git a/packages/app/src/systems/CRX/background/index.ts b/packages/app/src/systems/CRX/background/index.ts index 1f5aac29b5..0ac7ec82c3 100644 --- a/packages/app/src/systems/CRX/background/index.ts +++ b/packages/app/src/systems/CRX/background/index.ts @@ -1,3 +1,3 @@ -import './actions/onInstall'; import './actions/keepAwake'; +import './actions/onInstall'; import './communication'; diff --git a/packages/app/src/systems/CRX/background/services/BackgroundService.ts b/packages/app/src/systems/CRX/background/services/BackgroundService.ts index 981e60f18e..a19c12991b 100644 --- a/packages/app/src/systems/CRX/background/services/BackgroundService.ts +++ b/packages/app/src/systems/CRX/background/services/BackgroundService.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { BACKGROUND_SCRIPT_NAME } from '@fuel-wallet/types'; import type { Connection } from '@fuel-wallet/types'; import { CONTENT_SCRIPT_NAME, MessageTypes } from '@fuels/connectors'; @@ -63,9 +62,9 @@ export class BackgroundService { setupListeners() { this.communicationProtocol.on(MessageTypes.request, async (event) => { if (event.target !== BACKGROUND_SCRIPT_NAME) return; - const origin = event.sender!.origin!; - const title = event.sender!.tab!.title!; - const favIconUrl = event.sender!.tab!.favIconUrl!; + const origin = event.sender?.origin!; + const title = event.sender?.tab?.title!; + const favIconUrl = event.sender?.tab?.favIconUrl!; const response = await this.server.receive(event.request, { origin, title, @@ -82,12 +81,15 @@ export class BackgroundService { }); } + // biome-ignore lint/suspicious/noExplicitAny: externalMethods(methods: Array) { + // biome-ignore lint/complexity/noForEach: methods.forEach((method) => { let methodName = method; if (method.name) { methodName = method.name; } + // biome-ignore lint/suspicious/noExplicitAny: this.server.addMethod(methodName, this[methodName].bind(this) as any); }); } @@ -110,7 +112,7 @@ export class BackgroundService { Address.fromString(address || '0x00').toString() ); if (!hasAccessToAddress) { - throw new Error(`address is not authorized for this connection.`); + throw new Error('address is not authorized for this connection.'); } } @@ -137,7 +139,7 @@ export class BackgroundService { // Retrieve connection for use on accounts const connection = await ConnectionService.getConnection( - serverParams!.origin + serverParams?.origin ); // If the method is not `connect` or `isConnected` @@ -153,7 +155,7 @@ export class BackgroundService { }); } - async sendEvent(origin: string, eventName: string, params: any[]) { + async sendEvent(origin: string, eventName: string, params: T[]) { this.communicationProtocol.broadcast(origin, { target: CONTENT_SCRIPT_NAME, type: MessageTypes.event, diff --git a/packages/app/src/systems/CRX/background/services/CommunicationProtocol.ts b/packages/app/src/systems/CRX/background/services/CommunicationProtocol.ts index b3ffafecad..e71ee865fa 100644 --- a/packages/app/src/systems/CRX/background/services/CommunicationProtocol.ts +++ b/packages/app/src/systems/CRX/background/services/CommunicationProtocol.ts @@ -1,10 +1,10 @@ import { BaseConnection, createUUID } from '@fuel-wallet/connections'; import type { CommunicationEventArg } from '@fuel-wallet/types'; -import { VAULT_SCRIPT_NAME, BACKGROUND_SCRIPT_NAME } from '@fuel-wallet/types'; +import { BACKGROUND_SCRIPT_NAME, VAULT_SCRIPT_NAME } from '@fuel-wallet/types'; import { - MessageTypes, type CommunicationMessage, type EventMessage, + MessageTypes, } from '@fuels/connectors'; export class CommunicationProtocol extends BaseConnection { @@ -47,6 +47,7 @@ export class CommunicationProtocol extends BaseConnection { broadcast = (origins: Array | string, message: EventMessage) => { const originList = Array.isArray(origins) ? origins : [origins]; + // biome-ignore lint/complexity/noForEach: this.ports.forEach((port) => { if (originList.includes(port.sender?.origin || '')) { port.postMessage(message); @@ -90,6 +91,7 @@ export class CommunicationProtocol extends BaseConnection { }; destroy() { + // biome-ignore lint/complexity/noForEach: this.ports.forEach((port) => port.disconnect()); this.ports.clear(); } diff --git a/packages/app/src/systems/CRX/background/services/DatabaseObservable.ts b/packages/app/src/systems/CRX/background/services/DatabaseObservable.ts index 4c8c112c98..2287f23c4b 100644 --- a/packages/app/src/systems/CRX/background/services/DatabaseObservable.ts +++ b/packages/app/src/systems/CRX/background/services/DatabaseObservable.ts @@ -1,8 +1,9 @@ +// biome-ignore lint/style/useNodejsImportProtocol: +import EventEmitter from 'events'; import type { DatabaseEventArg, DatabaseObservableEvent, } from '@fuel-wallet/types'; -import EventEmitter from 'events'; import { db } from '~/systems/Core/utils/database'; export class DatabaseObservable< @@ -15,6 +16,7 @@ export class DatabaseObservable< setupListeners() { db.on('changes', (changes) => { + // biome-ignore lint/complexity/noForEach: changes.forEach((change) => { switch (change.type) { case 1: diff --git a/packages/app/src/systems/CRX/background/services/PopUpService.ts b/packages/app/src/systems/CRX/background/services/PopUpService.ts index a4c5b7d677..36026a2768 100644 --- a/packages/app/src/systems/CRX/background/services/PopUpService.ts +++ b/packages/app/src/systems/CRX/background/services/PopUpService.ts @@ -87,7 +87,7 @@ export class PopUpService { if (this.session === message.session && message.ready && message.sender) { const tab = getTabFromSender(message.sender); this.tab = tab!; - this.tabId = tab!.id!; + this.tabId = tab?.id!; this.eventId = message.id; this.openingPromise.resolve(this); } diff --git a/packages/app/src/systems/CRX/background/services/VaultService.ts b/packages/app/src/systems/CRX/background/services/VaultService.ts index 1e4973b247..a07726ff5a 100644 --- a/packages/app/src/systems/CRX/background/services/VaultService.ts +++ b/packages/app/src/systems/CRX/background/services/VaultService.ts @@ -4,11 +4,11 @@ import { AUTO_LOCK_IN_MINUTES } from '~/config'; import { VaultServer } from '~/systems/Vault/services/VaultServer'; import { - saveSecret, - loadSecret, - getTimer, clearSession, + getTimer, + loadSecret, resetTimer, + saveSecret, } from '../../utils'; import type { CommunicationProtocol } from './CommunicationProtocol'; diff --git a/packages/app/src/systems/CRX/config.ts b/packages/app/src/systems/CRX/config.ts index 696cee9ac6..58e2273402 100644 --- a/packages/app/src/systems/CRX/config.ts +++ b/packages/app/src/systems/CRX/config.ts @@ -1,4 +1,4 @@ -import { Pages, CRXPages } from '~/systems/Core/types'; +import { CRXPages, Pages } from '~/systems/Core/types'; export const welcomeLink = () => chrome.runtime.getURL(`${CRXPages.signup}#${Pages.signUpWelcome()}`); diff --git a/packages/app/src/systems/CRX/scripts/executeContentScript.ts b/packages/app/src/systems/CRX/scripts/executeContentScript.ts index 7488528437..7d09467237 100644 --- a/packages/app/src/systems/CRX/scripts/executeContentScript.ts +++ b/packages/app/src/systems/CRX/scripts/executeContentScript.ts @@ -7,6 +7,7 @@ import fileName from './contentScript?script'; */ export async function executeContentScript() { chrome.tabs.query({ url: '' }, (tabs) => { + // biome-ignore lint/complexity/noForEach: tabs.forEach((tab) => { if (!tab.id) return; chrome.scripting diff --git a/packages/app/src/systems/CRX/utils/error.ts b/packages/app/src/systems/CRX/utils/error.ts index f63585183a..c1ad694687 100644 --- a/packages/app/src/systems/CRX/utils/error.ts +++ b/packages/app/src/systems/CRX/utils/error.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { ReportErrorService } from '~/systems/Error/services'; globalThis.addEventListener('error', (event) => { @@ -12,7 +11,9 @@ globalThis.addEventListener('error', (event) => { }); }); -export function errorBoundary any>(cb: T): ReturnType { +export function errorBoundary ReturnType>( + cb: T +): ReturnType { try { return cb(); } catch (err) { diff --git a/packages/app/src/systems/CRX/utils/popups.ts b/packages/app/src/systems/CRX/utils/popups.ts index dcbfa92952..0457866cd9 100644 --- a/packages/app/src/systems/CRX/utils/popups.ts +++ b/packages/app/src/systems/CRX/utils/popups.ts @@ -28,8 +28,7 @@ export async function showPopUp(params?: ShowPopUp | null) { }); return true; } - // eslint-disable-next-line no-empty - } catch (err) {} + } catch (_err) {} return false; } diff --git a/packages/app/src/systems/Core/components/AmountVisibility/AmountVisibility.tsx b/packages/app/src/systems/Core/components/AmountVisibility/AmountVisibility.tsx index 110cd9ac9a..bf5e6a2742 100644 --- a/packages/app/src/systems/Core/components/AmountVisibility/AmountVisibility.tsx +++ b/packages/app/src/systems/Core/components/AmountVisibility/AmountVisibility.tsx @@ -1,4 +1,4 @@ -import type { BigNumberish, BNInput } from 'fuels'; +import type { BNInput, BigNumberish } from 'fuels'; import { formatAmount } from '../../utils'; diff --git a/packages/app/src/systems/Core/components/ConnectInfo/ConnectInfo.tsx b/packages/app/src/systems/Core/components/ConnectInfo/ConnectInfo.tsx index fec404f21c..0d1f34a365 100644 --- a/packages/app/src/systems/Core/components/ConnectInfo/ConnectInfo.tsx +++ b/packages/app/src/systems/Core/components/ConnectInfo/ConnectInfo.tsx @@ -1,5 +1,5 @@ import { cssObj } from '@fuel-ui/css'; -import { Text, Avatar, Card, Box } from '@fuel-ui/react'; +import { Avatar, Box, Card, Text } from '@fuel-ui/react'; import type { Account } from '@fuel-wallet/types'; import { parseUrl, truncate } from '../../utils'; diff --git a/packages/app/src/systems/Core/components/ContentHeader/ContentHeader.stories.tsx b/packages/app/src/systems/Core/components/ContentHeader/ContentHeader.stories.tsx index 0058cb4483..333d805ff5 100644 --- a/packages/app/src/systems/Core/components/ContentHeader/ContentHeader.stories.tsx +++ b/packages/app/src/systems/Core/components/ContentHeader/ContentHeader.stories.tsx @@ -1,5 +1,5 @@ import { Text } from '@fuel-ui/react'; -import type { StoryFn, Meta } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { ContentHeader } from '.'; diff --git a/packages/app/src/systems/Core/components/ContentHeader/ContentHeader.tsx b/packages/app/src/systems/Core/components/ContentHeader/ContentHeader.tsx index dba515d877..549b10f6aa 100644 --- a/packages/app/src/systems/Core/components/ContentHeader/ContentHeader.tsx +++ b/packages/app/src/systems/Core/components/ContentHeader/ContentHeader.tsx @@ -1,5 +1,5 @@ import type { ThemeUtilsCSS } from '@fuel-ui/css'; -import { cx, cssObj } from '@fuel-ui/css'; +import { cssObj, cx } from '@fuel-ui/css'; import type { StackProps } from '@fuel-ui/react'; import { Box, Heading } from '@fuel-ui/react'; import type { ReactNode } from 'react'; diff --git a/packages/app/src/systems/Core/components/ControlledField/ControlledField.test.tsx b/packages/app/src/systems/Core/components/ControlledField/ControlledField.test.tsx index 0a8969e412..d12fec9c03 100644 --- a/packages/app/src/systems/Core/components/ControlledField/ControlledField.test.tsx +++ b/packages/app/src/systems/Core/components/ControlledField/ControlledField.test.tsx @@ -1,6 +1,5 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { Button, Input } from '@fuel-ui/react'; -import { waitFor, fireEvent, render, screen, act } from '@fuel-ui/test-utils'; +import { act, fireEvent, render, screen, waitFor } from '@fuel-ui/test-utils'; import { yupResolver } from '@hookform/resolvers/yup'; import { useForm } from 'react-hook-form'; import * as yup from 'yup'; @@ -78,7 +77,7 @@ describe('ControlledField', () => { const classList = Array.from(label.classList); expect(label).toBeInTheDocument(); - expect(classList.some((c: any) => c.includes('required'))).toBe(true); + expect(classList.some((c) => c.includes('required'))).toBe(true); expect(field).toBeDisabled(); }); }); diff --git a/packages/app/src/systems/Core/components/ControlledField/ControlledField.tsx b/packages/app/src/systems/Core/components/ControlledField/ControlledField.tsx index 7202acac6b..fbc6946656 100644 --- a/packages/app/src/systems/Core/components/ControlledField/ControlledField.tsx +++ b/packages/app/src/systems/Core/components/ControlledField/ControlledField.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import type { ThemeUtilsCSS } from '@fuel-ui/css'; import { Form } from '@fuel-ui/react'; import { mergeRefs } from '@react-aria/utils'; @@ -15,9 +14,11 @@ import { Controller } from 'react-hook-form'; type RenderProps = { field: ControllerRenderProps & { id: string }; fieldState: ControllerFieldState; + // biome-ignore lint/suspicious/noExplicitAny: formState: UseFormStateReturn; }; +// biome-ignore lint/suspicious/noExplicitAny: export type ControlledFieldProps = Omit, 'render'> & { css?: ThemeUtilsCSS; label?: ReactNode; @@ -30,6 +31,7 @@ export type ControlledFieldProps = Omit, 'render'> & { hideError?: boolean; }; +// biome-ignore lint/suspicious/noExplicitAny: export const ControlledField = forwardRef( ( { @@ -70,6 +72,7 @@ export const ControlledField = forwardRef( field: { ...props.field, id, + // biome-ignore lint/suspicious/noExplicitAny: ref: mergeRefs(props.field.ref, ref) as any, }, })} diff --git a/packages/app/src/systems/Core/components/ImageLoader/ImageLoader.tsx b/packages/app/src/systems/Core/components/ImageLoader/ImageLoader.tsx index 66d2c69b6e..153dc1a151 100644 --- a/packages/app/src/systems/Core/components/ImageLoader/ImageLoader.tsx +++ b/packages/app/src/systems/Core/components/ImageLoader/ImageLoader.tsx @@ -1,7 +1,7 @@ import type { ThemeUtilsCSS } from '@fuel-ui/css'; import { cssObj } from '@fuel-ui/css'; import type { ImageProps } from '@fuel-ui/react'; -import { ContentLoader, Box, Image } from '@fuel-ui/react'; +import { Box, ContentLoader, Image } from '@fuel-ui/react'; import { useState } from 'react'; export type ImageLoaderProps = Omit & { @@ -42,7 +42,7 @@ function Loader({ width, height, css }: ImageLoaderProps) { diff --git a/packages/app/src/systems/Core/components/InputSecurePassword/InputSecurePassword.tsx b/packages/app/src/systems/Core/components/InputSecurePassword/InputSecurePassword.tsx index 473a1d2588..afd5ac874d 100644 --- a/packages/app/src/systems/Core/components/InputSecurePassword/InputSecurePassword.tsx +++ b/packages/app/src/systems/Core/components/InputSecurePassword/InputSecurePassword.tsx @@ -43,6 +43,7 @@ export function InputSecurePassword({ unsafeList, }); + // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { onChangeStrength?.(strength); }, [strength]); diff --git a/packages/app/src/systems/Core/components/Layout/Layout.tsx b/packages/app/src/systems/Core/components/Layout/Layout.tsx index 8f21ed97cc..29b190d045 100644 --- a/packages/app/src/systems/Core/components/Layout/Layout.tsx +++ b/packages/app/src/systems/Core/components/Layout/Layout.tsx @@ -2,7 +2,7 @@ import type { ThemeUtilsCSS } from '@fuel-ui/css'; import { cssObj } from '@fuel-ui/css'; import { Box } from '@fuel-ui/react'; import type { FC, ReactNode } from 'react'; -import { forwardRef, useRef, useContext, createContext } from 'react'; +import { createContext, forwardRef, useContext, useRef } from 'react'; import { Helmet } from 'react-helmet'; import { useLocation } from 'react-router-dom'; import { IS_CRX_POPUP, WALLET_HEIGHT, WALLET_WIDTH } from '~/config'; @@ -24,7 +24,7 @@ type Context = { const ctx = createContext({}); type ContentProps = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: as?: any; children: ReactNode; css?: ThemeUtilsCSS; @@ -191,7 +191,7 @@ export const styles = { bottom: 0, width: '100%', height: '100vh', - background: `url(/signup.png?url)`, + background: 'url(/signup.png?url)', backgroundPosition: 'left', backgroundSize: 'cover', }, diff --git a/packages/app/src/systems/Core/components/Layout/TopBar.tsx b/packages/app/src/systems/Core/components/Layout/TopBar.tsx index 64ea99d816..fb2fc6689f 100644 --- a/packages/app/src/systems/Core/components/Layout/TopBar.tsx +++ b/packages/app/src/systems/Core/components/Layout/TopBar.tsx @@ -1,5 +1,5 @@ import { cssObj } from '@fuel-ui/css'; -import { FuelLogo, Icon, IconButton, Spinner, Text, Box } from '@fuel-ui/react'; +import { Box, FuelLogo, Icon, IconButton, Spinner, Text } from '@fuel-ui/react'; import type { ReactNode } from 'react'; import { useNavigate } from 'react-router-dom'; /** @@ -13,8 +13,8 @@ import { useOverlay } from '~/systems/Overlay'; import { useLayoutContext } from './Layout'; export enum TopBarType { - internal, - external, + internal = 0, + external = 1, } type TopBarProps = { diff --git a/packages/app/src/systems/Core/components/Mnemonic/Mnemonic.tsx b/packages/app/src/systems/Core/components/Mnemonic/Mnemonic.tsx index 2546f5d836..686dcdfb69 100644 --- a/packages/app/src/systems/Core/components/Mnemonic/Mnemonic.tsx +++ b/packages/app/src/systems/Core/components/Mnemonic/Mnemonic.tsx @@ -1,7 +1,8 @@ import { cssObj } from '@fuel-ui/css'; import { Box, Button, Grid, Icon, toast } from '@fuel-ui/react'; import { MNEMONIC_SIZES } from 'fuels'; -import React, { useEffect, useState } from 'react'; +import type { ClipboardEvent } from 'react'; +import { useEffect, useState } from 'react'; import { MnemonicInput } from './MnemonicInput'; @@ -71,10 +72,7 @@ export function Mnemonic({ setValue(fillArray(words, selectedMnemonicSize)); } - function handlePasteInput( - ev: React.ClipboardEvent, - idx: number - ) { + function handlePasteInput(ev: ClipboardEvent, idx: number) { const text = ev.clipboardData.getData('text/plain'); const words = splitSeedPhrase(text); @@ -107,6 +105,7 @@ export function Mnemonic({ setValue(newValue); } + // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { onChange?.(value); if (value.every((word) => Boolean(word.length))) { @@ -136,6 +135,7 @@ export function Mnemonic({ {type === 'read' ? ( {initialValue?.map((word, idx) => ( + // biome-ignore lint/suspicious/noArrayIndexKey: {word} @@ -145,6 +145,7 @@ export function Mnemonic({ {value.map((_, idx) => { return ( + // biome-ignore lint/suspicious/noArrayIndexKey: {idx + 1}
diff --git a/packages/app/src/systems/Core/components/OriginTag/OriginTag.tsx b/packages/app/src/systems/Core/components/OriginTag/OriginTag.tsx index 6a270a079d..a7ff059c0e 100644 --- a/packages/app/src/systems/Core/components/OriginTag/OriginTag.tsx +++ b/packages/app/src/systems/Core/components/OriginTag/OriginTag.tsx @@ -1,5 +1,5 @@ import { cssObj } from '@fuel-ui/css'; -import { Tag, Tooltip, Text } from '@fuel-ui/react'; +import { Tag, Text, Tooltip } from '@fuel-ui/react'; import { parseUrl } from '../../utils'; diff --git a/packages/app/src/systems/Core/components/PrivateRoute/PrivateRoute.tsx b/packages/app/src/systems/Core/components/PrivateRoute/PrivateRoute.tsx index a467401546..ee3ed7fd61 100644 --- a/packages/app/src/systems/Core/components/PrivateRoute/PrivateRoute.tsx +++ b/packages/app/src/systems/Core/components/PrivateRoute/PrivateRoute.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react'; import { Navigate, Outlet } from 'react-router-dom'; import { Pages } from '../../types'; -import { guards, RouteGuard } from '../RouteGuard'; +import { RouteGuard, guards } from '../RouteGuard'; type PrivateRouteProps = { redirect?: string; diff --git a/packages/app/src/systems/Core/components/Providers/Providers.tsx b/packages/app/src/systems/Core/components/Providers/Providers.tsx index 898608ea12..57f41ef47d 100644 --- a/packages/app/src/systems/Core/components/Providers/Providers.tsx +++ b/packages/app/src/systems/Core/components/Providers/Providers.tsx @@ -1,15 +1,14 @@ import { globalCss } from '@fuel-ui/css'; import { + ThemeProvider, darkTheme, lightTheme, loadIcons, setFuelThemes, - ThemeProvider, } from '@fuel-ui/react'; import type { ReactNode } from 'react'; import { StoreProvider } from '~/store'; -// eslint-disable-next-line import/no-unresolved import icons from '/icons/sprite.svg'; import { ErrorBoundary } from '~/systems/Error'; diff --git a/packages/app/src/systems/Core/components/PublicRoute/PublicRoute.tsx b/packages/app/src/systems/Core/components/PublicRoute/PublicRoute.tsx index 031272c29d..c9f3df80ef 100644 --- a/packages/app/src/systems/Core/components/PublicRoute/PublicRoute.tsx +++ b/packages/app/src/systems/Core/components/PublicRoute/PublicRoute.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react'; import { Navigate, Outlet } from 'react-router-dom'; import { Pages } from '../../types'; -import { guards, RouteGuard } from '../RouteGuard'; +import { RouteGuard, guards } from '../RouteGuard'; type PublicRouteProps = { redirect?: string; diff --git a/packages/app/src/systems/Core/components/SearchInput/SearchInput.tsx b/packages/app/src/systems/Core/components/SearchInput/SearchInput.tsx index ea70e62de0..d694296756 100644 --- a/packages/app/src/systems/Core/components/SearchInput/SearchInput.tsx +++ b/packages/app/src/systems/Core/components/SearchInput/SearchInput.tsx @@ -29,7 +29,7 @@ export function SearchInput({ * @fuel-ui automatically add role to input. So, we need to pass * role="null" in order to remove it and pass a11y tests * */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: role={null as any} aria-label="Search" value={value || ''} diff --git a/packages/app/src/systems/Core/components/TestWrapper/TestWrapper.tsx b/packages/app/src/systems/Core/components/TestWrapper/TestWrapper.tsx index 90f0923ccf..022cee1091 100644 --- a/packages/app/src/systems/Core/components/TestWrapper/TestWrapper.tsx +++ b/packages/app/src/systems/Core/components/TestWrapper/TestWrapper.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import type { ReactNode } from 'react'; import { BrowserRouter, MemoryRouter, useLocation } from 'react-router-dom'; @@ -10,6 +9,7 @@ const LocationDisplay = () => { }; export type TestWrapperProps = { + // biome-ignore lint/suspicious/noExplicitAny: initialEntries?: any[]; children?: ReactNode; }; diff --git a/packages/app/src/systems/Core/hooks/useStorage.tsx b/packages/app/src/systems/Core/hooks/useStorage.tsx index b6fefc1a35..eeb29b75fd 100644 --- a/packages/app/src/systems/Core/hooks/useStorage.tsx +++ b/packages/app/src/systems/Core/hooks/useStorage.tsx @@ -1,9 +1,8 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { useSyncExternalStore } from 'react'; import { Storage } from '../utils'; -export function useStorageItem(key: string, defaultValue?: T) { +export function useStorageItem(key: string, defaultValue?: T) { const state = useSyncExternalStore( Storage.subscribe, () => Storage.getItem(key) ?? defaultValue ?? null diff --git a/packages/app/src/systems/Core/hooks/useUnlockForm.tsx b/packages/app/src/systems/Core/hooks/useUnlockForm.tsx index 22b7a8318e..d4eeb9c915 100644 --- a/packages/app/src/systems/Core/hooks/useUnlockForm.tsx +++ b/packages/app/src/systems/Core/hooks/useUnlockForm.tsx @@ -27,11 +27,13 @@ export function useUnlockForm(formErrors?: UnlockFormValuesErrors) { }, }); + // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { const errors = formErrors || {}; + // biome-ignore lint/complexity/noForEach: Object.keys(errors).forEach((key) => { if (errors[key]) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: form.setError(key as any, { type: 'manual', message: errors[key], diff --git a/packages/app/src/systems/Core/machines/fetchMachine.ts b/packages/app/src/systems/Core/machines/fetchMachine.ts index b0943878e4..f0f10f18be 100644 --- a/packages/app/src/systems/Core/machines/fetchMachine.ts +++ b/packages/app/src/systems/Core/machines/fetchMachine.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { toast } from '@fuel-ui/react'; import type { TransitionConfig } from 'xstate'; import { assign, createMachine } from 'xstate'; @@ -28,14 +27,17 @@ export type CreateFetchMachineOpts = { const MAX_ATTEMPTS = 3; export const FetchMachine = { + // biome-ignore lint/suspicious/noExplicitAny: hasError(_: any, ev: { data: { error?: any } }) { return Boolean(ev.data?.error); }, + // biome-ignore lint/suspicious/noExplicitAny: errorState(state: string): TransitionConfig { return { cond: FetchMachine.hasError, target: state, actions: [ + // biome-ignore lint/suspicious/noExplicitAny: assign((ctx: any, ev: { data: { error?: any } }) => ({ ...ctx, error: ev.data.error.message, @@ -48,7 +50,7 @@ export const FetchMachine = { return createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./fetchMachine.typegen').Typegen0, schema: { context: {} as MachineContext, @@ -91,7 +93,7 @@ export const FetchMachine = { failed: { entry: ['assignError', 'showError'], type: 'final', - data: (ctx, ev) => ({ error: ev.data }), + data: (_ctx, ev) => ({ error: ev.data }), }, success: { type: 'final', @@ -103,14 +105,15 @@ export const FetchMachine = { actions: { showError: (_, ev) => { if (!opts.showError) return; + // biome-ignore lint/suspicious/noExplicitAny: const error = ev.data as any; toast.error(error.message); }, assignError: assign({ error: (_, ev) => ev.data, }), + // biome-ignore lint/suspicious/noExplicitAny: logError: (_, ev: { data: any }) => { - // eslint-disable-next-line no-console console.error(ev.data); }, incrementAttempts: assign({ diff --git a/packages/app/src/systems/Core/services/core.ts b/packages/app/src/systems/Core/services/core.ts index 7d15c6eab9..a5b136070f 100644 --- a/packages/app/src/systems/Core/services/core.ts +++ b/packages/app/src/systems/Core/services/core.ts @@ -1,6 +1,7 @@ import { db } from '../utils/database'; import { Storage } from '../utils/storage'; +// biome-ignore lint/complexity/noStaticOnlyClass: export class CoreService { static async clear() { await db.clear(); diff --git a/packages/app/src/systems/Core/styles/core.ts b/packages/app/src/systems/Core/styles/core.ts index 064e95678f..8d19e57e8a 100644 --- a/packages/app/src/systems/Core/styles/core.ts +++ b/packages/app/src/systems/Core/styles/core.ts @@ -1,9 +1,9 @@ import { cssObj } from '@fuel-ui/css'; -import { WALLET_WIDTH, WALLET_HEIGHT } from '~/config'; +import { WALLET_HEIGHT, WALLET_WIDTH } from '~/config'; export const scrollable = ( - regularColor: string = '$intentsBase1', - hoverColor: string = '$intentsBase10' + regularColor = '$intentsBase1', + hoverColor = '$intentsBase10' ) => cssObj({ overflowY: 'overlay', diff --git a/packages/app/src/systems/Core/types.ts b/packages/app/src/systems/Core/types.ts index 3ffa3f3aff..7a0035fbd9 100644 --- a/packages/app/src/systems/Core/types.ts +++ b/packages/app/src/systems/Core/types.ts @@ -5,8 +5,8 @@ import { route } from './utils/route'; export type Maybe = T | null | undefined; export enum CRXPages { - 'signup' = '/index.html', - 'popup' = '/popup.html', + signup = '/index.html', + popup = '/popup.html', } export const Pages = { diff --git a/packages/app/src/systems/Core/utils/address.tsx b/packages/app/src/systems/Core/utils/address.tsx index 8f03a052eb..0f9ac5f861 100644 --- a/packages/app/src/systems/Core/utils/address.tsx +++ b/packages/app/src/systems/Core/utils/address.tsx @@ -1,12 +1,12 @@ import { isB256 } from 'fuels'; -export function shortAddress(address: string = '') { +export function shortAddress(address = '') { return address.length > 10 ? `${address.slice(0, 6)}...${address.slice(-4)}` : address; } -export function isValidEthAddress(address: string = '') { +export function isValidEthAddress(address = '') { const isPadded = isB256(address) && address.slice(0, 26) === '0x000000000000000000000000'; const isEthAddress = /^0x[a-fA-F0-9]{40}$/.test(address); diff --git a/packages/app/src/systems/Core/utils/database.ts b/packages/app/src/systems/Core/utils/database.ts index 76a968e501..d7b2e01420 100644 --- a/packages/app/src/systems/Core/utils/database.ts +++ b/packages/app/src/systems/Core/utils/database.ts @@ -1,12 +1,12 @@ import { createUUID } from '@fuel-wallet/connections'; import type { + AbiTable, Account, - Vault, - Connection, - NetworkData, AssetData, - AbiTable, + Connection, FuelWalletError, + NetworkData, + Vault, } from '@fuel-wallet/types'; import type { Table } from 'dexie'; import Dexie from 'dexie'; @@ -28,11 +28,11 @@ export class FuelDB extends Dexie { super('FuelDB'); this.version(DATABASE_VERSION) .stores({ - vaults: `key`, - accounts: `&address, &name`, - networks: `&id, &url, &name`, + vaults: 'key', + accounts: '&address, &name', + networks: '&id, &url, &name', connections: 'origin', - transactions: `&id`, + transactions: '&id', assets: '&assetId, &name, $symbol', abis: '&contractId', errors: '&id', diff --git a/packages/app/src/systems/Core/utils/json.ts b/packages/app/src/systems/Core/utils/json.ts index 2c309a379d..c3796653c8 100644 --- a/packages/app/src/systems/Core/utils/json.ts +++ b/packages/app/src/systems/Core/utils/json.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ - -export function reparse(v: any) { +export function reparse(v: V) { return JSON.parse(JSON.stringify(v)); } diff --git a/packages/app/src/systems/Core/utils/machine.ts b/packages/app/src/systems/Core/utils/machine.ts index d5cf5d6ae2..8829366c42 100644 --- a/packages/app/src/systems/Core/utils/machine.ts +++ b/packages/app/src/systems/Core/utils/machine.ts @@ -1,5 +1,4 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import type { AnyInterpreter, StateFrom, Action } from 'xstate'; +import type { Action, AnyInterpreter, StateFrom } from 'xstate'; import { assign } from 'xstate'; import { waitFor } from 'xstate/lib/waitFor'; @@ -33,6 +32,7 @@ export async function waitForState< } return appState.context as T['context']; + // biome-ignore lint/suspicious/noExplicitAny: } catch (err: any) { if (err.cause === 'CustomState') throw err; throw new Error( @@ -41,14 +41,18 @@ export async function waitForState< } } +// biome-ignore lint/suspicious/noExplicitAny: export function assignError(): Action { + // biome-ignore lint/suspicious/noExplicitAny: return assign((ctx: any, ev: any) => ({ ...ctx, error: ev.data.error.message, })); } +// biome-ignore lint/suspicious/noExplicitAny: export function assignErrorMessage(message: string): Action { + // biome-ignore lint/suspicious/noExplicitAny: return assign((ctx: any) => ({ ...ctx, error: message, diff --git a/packages/app/src/systems/Core/utils/promise.ts b/packages/app/src/systems/Core/utils/promise.ts index dd37893008..4c651521f7 100644 --- a/packages/app/src/systems/Core/utils/promise.ts +++ b/packages/app/src/systems/Core/utils/promise.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ export type DeferPromise = { promise: Promise; resolve: (value: R) => void; @@ -6,6 +5,7 @@ export type DeferPromise = { }; export function deferPromise() { + // biome-ignore lint/suspicious/noExplicitAny: const defer: DeferPromise = {} as any; defer.promise = new Promise((resolve, reject) => { diff --git a/packages/app/src/systems/Core/utils/route.ts b/packages/app/src/systems/Core/utils/route.ts index fd18b01268..382725aeed 100644 --- a/packages/app/src/systems/Core/utils/route.ts +++ b/packages/app/src/systems/Core/utils/route.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ /** * Create a route that can be parsed using a typed-obj as param * @@ -21,9 +20,11 @@ * ^^ 'test' does not exist in type 'Record<"id", any>'. * ``` */ -export function route

(path: string) { +export function route

(path: string) { return function parse( + // biome-ignore lint/suspicious/noExplicitAny: params?: Record, + // biome-ignore lint/suspicious/noExplicitAny: query?: Record ): string { const split = path.match(/[^/]+/g); @@ -45,6 +46,7 @@ export function route

(path: string) { * searchStringify({ foo: 'bar', baz: 'qux' }); * // returns '?foo=bar&baz=qux' */ +// biome-ignore lint/suspicious/noExplicitAny: export function searchStringify(query?: Record) { const qs = new URLSearchParams(query).toString(); return qs.length ? `?${qs}` : ''; @@ -61,6 +63,7 @@ export function searchStringify(query?: Record) { * stringifyUrl('https://example.com', { foo: 'bar', baz: 'qux' }); * // returns 'https://example.com/?foo=bar&baz=qux' */ +// biome-ignore lint/suspicious/noExplicitAny: export function stringifyUrl(url: string, query?: Record) { const { href } = new URL(url, 'https://fuel.network/'); return `${href}${searchStringify(query)}`; diff --git a/packages/app/src/systems/Core/utils/storage.ts b/packages/app/src/systems/Core/utils/storage.ts index 0ea1d8761f..cb085adc79 100644 --- a/packages/app/src/systems/Core/utils/storage.ts +++ b/packages/app/src/systems/Core/utils/storage.ts @@ -1,5 +1,6 @@ -import { LocalStorage } from '@fuels/local-storage'; +// biome-ignore lint/style/useNodejsImportProtocol: import { EventEmitter } from 'events'; +import { LocalStorage } from '@fuels/local-storage'; const emitter = new EventEmitter(); export const Storage = new LocalStorage('fuel_', emitter); diff --git a/packages/app/src/systems/Core/utils/storybook.ts b/packages/app/src/systems/Core/utils/storybook.ts index 43f704c374..c2040d608e 100644 --- a/packages/app/src/systems/Core/utils/storybook.ts +++ b/packages/app/src/systems/Core/utils/storybook.ts @@ -1,12 +1,14 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import type { Story } from '@storybook/react'; export async function storyToComponent( story: Story, + // biome-ignore lint/suspicious/noExplicitAny: args: any = {}, + // biome-ignore lint/suspicious/noExplicitAny: loaded: any = {} ): Promise { return () => { + // biome-ignore lint/suspicious/noExplicitAny: const context: any = { id: '', kind: '', diff --git a/packages/app/src/systems/Core/utils/string.tsx b/packages/app/src/systems/Core/utils/string.tsx index 4171e0c28c..8c9dcadf02 100644 --- a/packages/app/src/systems/Core/utils/string.tsx +++ b/packages/app/src/systems/Core/utils/string.tsx @@ -12,10 +12,10 @@ export function getPhraseFromValue(value?: string | string[]) { return value || ''; } -export const uniqueId = (size: number = 13) => +export const uniqueId = (size = 13) => Math.random().toString(16).slice(2).slice(0, size); -export const truncate = (str: string, length: number = 30) => { +export const truncate = (str: string, length = 30) => { if (str.length > length) { return `${str.substring(0, length)}...`; } diff --git a/packages/app/src/systems/Core/utils/wallet.ts b/packages/app/src/systems/Core/utils/wallet.ts index 12ed697547..843ce9109d 100644 --- a/packages/app/src/systems/Core/utils/wallet.ts +++ b/packages/app/src/systems/Core/utils/wallet.ts @@ -1,5 +1,5 @@ import type { TransactionRequestLike, TransactionResponse } from 'fuels'; -import { transactionRequestify, hashMessage, WalletLocked } from 'fuels'; +import { WalletLocked, hashMessage, transactionRequestify } from 'fuels'; import { VaultService } from '~/systems/Vault'; export class WalletLockedCustom extends WalletLocked { diff --git a/packages/app/src/systems/DApp/__mocks__/dapp-transaction.ts b/packages/app/src/systems/DApp/__mocks__/dapp-transaction.ts index 8549dcd865..d9ed233793 100644 --- a/packages/app/src/systems/DApp/__mocks__/dapp-transaction.ts +++ b/packages/app/src/systems/DApp/__mocks__/dapp-transaction.ts @@ -1,4 +1,4 @@ -import { Address, bn, BaseAssetId, Provider, Wallet } from 'fuels'; +import { Address, BaseAssetId, Provider, Wallet, bn } from 'fuels'; import { TxService } from '~/systems/Transaction/services'; function getAddressFromString(address: string) { diff --git a/packages/app/src/systems/DApp/hooks/useConnectRequest.tsx b/packages/app/src/systems/DApp/hooks/useConnectRequest.tsx index 268111f432..621231bf4c 100644 --- a/packages/app/src/systems/DApp/hooks/useConnectRequest.tsx +++ b/packages/app/src/systems/DApp/hooks/useConnectRequest.tsx @@ -39,12 +39,13 @@ export function useConnectRequest() { const favIconUrl = useSelector(service, selectors.favIconUrl); const selectedAddresses = useSelector(service, selectors.selectedAddresses); const currentAccounts = useMemo(() => { - return (shownAccounts ?? []).filter( - (account) => selectedAddresses?.includes(account.address) + return (shownAccounts ?? []).filter((account) => + selectedAddresses?.includes(account.address) ); }, [selectedAddresses, shownAccounts]); const hasCurrentAccounts = !!selectedAddresses?.length; + // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { if (account && !hasCurrentAccounts) { service.send({ diff --git a/packages/app/src/systems/DApp/hooks/useTransactionRequest.tsx b/packages/app/src/systems/DApp/hooks/useTransactionRequest.tsx index 163016cf5f..2b09fe49b6 100644 --- a/packages/app/src/systems/DApp/hooks/useTransactionRequest.tsx +++ b/packages/app/src/systems/DApp/hooks/useTransactionRequest.tsx @@ -35,7 +35,6 @@ const selectors = { return { txApproveError, unlockError, grouped, general, hasGeneral }; }, status(externalLoading?: boolean) { - // eslint-disable-next-line react-hooks/rules-of-hooks return useCallback( (state: TransactionRequestState) => { const isLoading = state.hasTag('loading'); diff --git a/packages/app/src/systems/DApp/machines/addAssetRequestMachine.tsx b/packages/app/src/systems/DApp/machines/addAssetRequestMachine.tsx index be70e73be1..f94675ff88 100644 --- a/packages/app/src/systems/DApp/machines/addAssetRequestMachine.tsx +++ b/packages/app/src/systems/DApp/machines/addAssetRequestMachine.tsx @@ -3,7 +3,7 @@ import type { InterpreterFrom, StateFrom } from 'xstate'; import { assign, createMachine } from 'xstate'; import type { AssetInputs } from '~/systems/Asset'; import { AssetService } from '~/systems/Asset'; -import { assignErrorMessage, FetchMachine } from '~/systems/Core'; +import { FetchMachine, assignErrorMessage } from '~/systems/Core'; type MachineContext = { assets?: AssetData[]; @@ -36,13 +36,15 @@ type MachineEvents = type: 'START'; input: AddAssetInputs['start']; } + // biome-ignore lint/suspicious/noConfusingVoidType: | { type: 'APPROVE'; input: void } + // biome-ignore lint/suspicious/noConfusingVoidType: | { type: 'REJECT'; input: void }; export const addAssetRequestMachine = createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./addAssetRequestMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/DApp/machines/addNetworkRequestMachine.tsx b/packages/app/src/systems/DApp/machines/addNetworkRequestMachine.tsx index 89f31f5691..a0f6881476 100644 --- a/packages/app/src/systems/DApp/machines/addNetworkRequestMachine.tsx +++ b/packages/app/src/systems/DApp/machines/addNetworkRequestMachine.tsx @@ -1,7 +1,7 @@ import type { NetworkData } from '@fuel-wallet/types'; import type { InterpreterFrom, StateFrom } from 'xstate'; import { assign, createMachine } from 'xstate'; -import { assignErrorMessage, FetchMachine } from '~/systems/Core'; +import { FetchMachine, assignErrorMessage } from '~/systems/Core'; import type { NetworkInputs } from '~/systems/Network'; import { NetworkService } from '~/systems/Network'; import { store } from '~/systems/Store'; @@ -34,13 +34,15 @@ type MachineEvents = type: 'START'; input: AddNetworkInputs['start']; } + // biome-ignore lint/suspicious/noConfusingVoidType: | { type: 'APPROVE'; input: void } + // biome-ignore lint/suspicious/noConfusingVoidType: | { type: 'REJECT'; input: void }; export const addNetworkRequestMachine = createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./addNetworkRequestMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/DApp/machines/connectRequestMachine.ts b/packages/app/src/systems/DApp/machines/connectRequestMachine.ts index 628bedb14a..2cf05c3177 100644 --- a/packages/app/src/systems/DApp/machines/connectRequestMachine.ts +++ b/packages/app/src/systems/DApp/machines/connectRequestMachine.ts @@ -2,7 +2,7 @@ import type { Connection } from '@fuel-wallet/types'; import type { InterpreterFrom, StateFrom } from 'xstate'; import { assign, createMachine } from 'xstate'; import type { FetchResponse } from '~/systems/Core'; -import { assignErrorMessage, FetchMachine } from '~/systems/Core'; +import { FetchMachine, assignErrorMessage } from '~/systems/Core'; import { ConnectionService } from '../services'; @@ -49,7 +49,7 @@ type MachineEvents = export const connectRequestMachine = createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./connectRequestMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/DApp/machines/messageRequestMachine.test.ts b/packages/app/src/systems/DApp/machines/messageRequestMachine.test.ts index 1c2db700f3..c72da5a6dd 100644 --- a/packages/app/src/systems/DApp/machines/messageRequestMachine.test.ts +++ b/packages/app/src/systems/DApp/machines/messageRequestMachine.test.ts @@ -1,4 +1,4 @@ -import { hashMessage, Signer } from 'fuels'; +import { Signer, hashMessage } from 'fuels'; import { interpret } from 'xstate'; import type { MockVaultData } from '~/systems/Core/__tests__'; import { expectStateMatch, mockVault } from '~/systems/Core/__tests__'; diff --git a/packages/app/src/systems/DApp/machines/messageRequestMachine.tsx b/packages/app/src/systems/DApp/machines/messageRequestMachine.tsx index 9442010e22..7e0bbee8aa 100644 --- a/packages/app/src/systems/DApp/machines/messageRequestMachine.tsx +++ b/packages/app/src/systems/DApp/machines/messageRequestMachine.tsx @@ -2,7 +2,7 @@ import type { Account } from '@fuel-wallet/types'; import type { InterpreterFrom, StateFrom } from 'xstate'; import { assign, createMachine } from 'xstate'; import { AccountService } from '~/systems/Account'; -import { assignErrorMessage, FetchMachine } from '~/systems/Core'; +import { FetchMachine, assignErrorMessage } from '~/systems/Core'; import type { VaultInputs } from '~/systems/Vault'; import { VaultService } from '~/systems/Vault'; @@ -47,7 +47,7 @@ type MachineEvents = export const messageRequestMachine = createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./messageRequestMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/DApp/machines/transactionRequestMachine.tsx b/packages/app/src/systems/DApp/machines/transactionRequestMachine.tsx index 44c2fcb2ec..e25319a94f 100644 --- a/packages/app/src/systems/DApp/machines/transactionRequestMachine.tsx +++ b/packages/app/src/systems/DApp/machines/transactionRequestMachine.tsx @@ -1,15 +1,14 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import type { Account } from '@fuel-wallet/types'; import type { - TransactionSummary, BN, TransactionRequest, TransactionResponse, + TransactionSummary, } from 'fuels'; import type { InterpreterFrom, StateFrom } from 'xstate'; import { assign, createMachine } from 'xstate'; import { AccountService } from '~/systems/Account'; -import { assignErrorMessage, delay, FetchMachine } from '~/systems/Core'; +import { FetchMachine, assignErrorMessage, delay } from '~/systems/Core'; import type { NetworkInputs } from '~/systems/Network'; import { NetworkService } from '~/systems/Network'; import type { GroupedErrors, VMApiError } from '~/systems/Transaction'; @@ -77,7 +76,7 @@ type MachineEvents = export const transactionRequestMachine = createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./transactionRequestMachine.typegen').Typegen0, schema: { context: {} as MachineContext, @@ -276,6 +275,7 @@ export const transactionRequestMachine = createMachine( }), assignTxDryRunError: assign((ctx, ev) => { const txDryRunGroupedErrors = getGroupedErrors( + // biome-ignore lint/suspicious/noExplicitAny: (ev.data as any)?.error?.response?.errors ); return { @@ -292,8 +292,10 @@ export const transactionRequestMachine = createMachine( ...ctx, errors: { ...ctx.errors, + // biome-ignore lint/suspicious/noExplicitAny: txApproveError: (ev.data as any)?.error, }, + // biome-ignore lint/suspicious/noExplicitAny: error: (ev.data as any)?.error, }; }), @@ -325,7 +327,7 @@ export const transactionRequestMachine = createMachine( const { txResult } = await TxService.simulateTransaction(input); if (txResult.isStatusFailure) { // TODO: add reason for error failure if the sdk supports it - throw new Error(`The transaction will fail to run.`); + throw new Error('The transaction will fail to run.'); } return { txResult }; }, diff --git a/packages/app/src/systems/DApp/pages/AddAssetRequest/AddAssetRequest.tsx b/packages/app/src/systems/DApp/pages/AddAssetRequest/AddAssetRequest.tsx index 965ab1cc47..4ed666c0ba 100644 --- a/packages/app/src/systems/DApp/pages/AddAssetRequest/AddAssetRequest.tsx +++ b/packages/app/src/systems/DApp/pages/AddAssetRequest/AddAssetRequest.tsx @@ -2,7 +2,7 @@ import { cssObj } from '@fuel-ui/css'; import { Button, Card } from '@fuel-ui/react'; import { useAccounts } from '~/systems/Account'; import { AssetItem } from '~/systems/Asset'; -import { Layout, ConnectInfo, shortAddress } from '~/systems/Core'; +import { ConnectInfo, Layout, shortAddress } from '~/systems/Core'; import { useAddAssetRequest } from '../../hooks'; diff --git a/packages/app/src/systems/DApp/pages/AddNetworkRequest/AddNetworkRequest.tsx b/packages/app/src/systems/DApp/pages/AddNetworkRequest/AddNetworkRequest.tsx index eeceac2459..df70d02aa4 100644 --- a/packages/app/src/systems/DApp/pages/AddNetworkRequest/AddNetworkRequest.tsx +++ b/packages/app/src/systems/DApp/pages/AddNetworkRequest/AddNetworkRequest.tsx @@ -1,7 +1,7 @@ import { cssObj } from '@fuel-ui/css'; import { Button } from '@fuel-ui/react'; import { useAccounts } from '~/systems/Account'; -import { Layout, ConnectInfo } from '~/systems/Core'; +import { ConnectInfo, Layout } from '~/systems/Core'; import { NetworkReviewCard } from '~/systems/Network'; import { useAddNetworkRequest } from '../../hooks'; diff --git a/packages/app/src/systems/DApp/pages/ConnectionRequest/ConnectionRequest.tsx b/packages/app/src/systems/DApp/pages/ConnectionRequest/ConnectionRequest.tsx index f0d63d3813..19bea13537 100644 --- a/packages/app/src/systems/DApp/pages/ConnectionRequest/ConnectionRequest.tsx +++ b/packages/app/src/systems/DApp/pages/ConnectionRequest/ConnectionRequest.tsx @@ -1,12 +1,12 @@ import { cssObj } from '@fuel-ui/css'; -import { Button, Card, CardList, Box, Link, Text } from '@fuel-ui/react'; +import { Box, Button, Card, CardList, Link, Text } from '@fuel-ui/react'; import { AnimatePresence, motion } from 'framer-motion'; import { AccountItem } from '~/systems/Account/components/AccountItem'; import { - animations, - Layout, ConnectInfo, + Layout, PermissionCard, + animations, coreStyles, } from '~/systems/Core'; diff --git a/packages/app/src/systems/DApp/pages/SignatureRequest/SignatureRequest.tsx b/packages/app/src/systems/DApp/pages/SignatureRequest/SignatureRequest.tsx index 797982a216..6f7d73bf00 100644 --- a/packages/app/src/systems/DApp/pages/SignatureRequest/SignatureRequest.tsx +++ b/packages/app/src/systems/DApp/pages/SignatureRequest/SignatureRequest.tsx @@ -1,6 +1,6 @@ import { Box, Button, Card, Flex, HelperIcon, Text } from '@fuel-ui/react'; import { AccountInfo } from '~/systems/Account'; -import { Layout, ConnectInfo, coreStyles } from '~/systems/Core'; +import { ConnectInfo, Layout, coreStyles } from '~/systems/Core'; import { useSignatureRequest } from '../../hooks'; @@ -12,7 +12,7 @@ export function SignatureRequest() { return ( <> - + { + // biome-ignore lint/correctness/useExhaustiveDependencies: useEffect(() => { alert(`use this password to unlock: ${loaded.password}`); }, []); diff --git a/packages/app/src/systems/DApp/pages/TransactionRequest/TransactionRequest.tsx b/packages/app/src/systems/DApp/pages/TransactionRequest/TransactionRequest.tsx index 5ff0da127c..454f8aca18 100644 --- a/packages/app/src/systems/DApp/pages/TransactionRequest/TransactionRequest.tsx +++ b/packages/app/src/systems/DApp/pages/TransactionRequest/TransactionRequest.tsx @@ -2,7 +2,7 @@ import { cssObj } from '@fuel-ui/css'; import { Alert, Button } from '@fuel-ui/react'; import { TransactionStatus } from 'fuels'; import { useAssets } from '~/systems/Asset'; -import { Layout, ConnectInfo } from '~/systems/Core'; +import { ConnectInfo, Layout } from '~/systems/Core'; import { TopBarType } from '~/systems/Core/components/Layout/TopBar'; import { TxContent, TxHeader } from '~/systems/Transaction'; diff --git a/packages/app/src/systems/DApp/services/connection.ts b/packages/app/src/systems/DApp/services/connection.ts index f35196b3f3..6fe72ca13f 100644 --- a/packages/app/src/systems/DApp/services/connection.ts +++ b/packages/app/src/systems/DApp/services/connection.ts @@ -23,6 +23,7 @@ export type ConnectInputs = { }; }; +// biome-ignore lint/complexity/noStaticOnlyClass: export class ConnectionService { static async addConnection(input: ConnectInputs['connection']) { return db.transaction('rw', db.connections, async () => { @@ -105,16 +106,16 @@ export class ConnectionService { }); } - static filterByOrigin(connections: Connection[], origin: string = '') { + static filterByOrigin(connections: Connection[], origin = '') { if (!origin.length) return null; return connections.filter(hasOriginIncluded(origin)); } - static findByOrigin(connections: Connection[], origin: string = '') { + static findByOrigin(connections: Connection[], origin = '') { return connections.find(hasOriginIncluded(origin)); } - static excludeByOrigin(connections: Connection[], origin: string = '') { + static excludeByOrigin(connections: Connection[], origin = '') { if (!origin.length) return connections; return connections.filter((c) => !hasOriginIncluded(origin)(c)); } diff --git a/packages/app/src/systems/Error/components/Providers/ReportErrorProvider.tsx b/packages/app/src/systems/Error/components/Providers/ReportErrorProvider.tsx index da747b8c1e..d3abbab830 100644 --- a/packages/app/src/systems/Error/components/Providers/ReportErrorProvider.tsx +++ b/packages/app/src/systems/Error/components/Providers/ReportErrorProvider.tsx @@ -20,7 +20,7 @@ class ErrorBoundary extends React.Component< async componentDidCatch(error: Error, reactError: React.ErrorInfo) { await ReportErrorService.saveError({ error, - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: reactError: reactError as any, }); this.setState({ diff --git a/packages/app/src/systems/Error/hooks/useReportError.tsx b/packages/app/src/systems/Error/hooks/useReportError.tsx index 57884e866d..fdbc99b850 100644 --- a/packages/app/src/systems/Error/hooks/useReportError.tsx +++ b/packages/app/src/systems/Error/hooks/useReportError.tsx @@ -1,6 +1,6 @@ import { useMachine, useSelector } from '@xstate/react'; -import { reportErrorMachine, type ReportErrorMachineState } from '../machines'; +import { type ReportErrorMachineState, reportErrorMachine } from '../machines'; const selectors = { hasErrorsToReport(state: ReportErrorMachineState) { diff --git a/packages/app/src/systems/Error/machines/reportErrorMachine.tsx b/packages/app/src/systems/Error/machines/reportErrorMachine.tsx index da39cd8bd6..e1848345c6 100644 --- a/packages/app/src/systems/Error/machines/reportErrorMachine.tsx +++ b/packages/app/src/systems/Error/machines/reportErrorMachine.tsx @@ -13,6 +13,7 @@ export type ErrorMachineContext = { type MachineServices = { clearErrors: { + // biome-ignore lint/suspicious/noConfusingVoidType: data: void; }; reportErrors: { @@ -43,7 +44,7 @@ export type ErrorMachineEvents = export const reportErrorMachine = createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./reportErrorMachine.typegen').Typegen0, schema: { context: {} as ErrorMachineContext, diff --git a/packages/app/src/systems/Error/pages/ReportErrors/ReportErrors.stories.tsx b/packages/app/src/systems/Error/pages/ReportErrors/ReportErrors.stories.tsx index a182070ab0..7fd37cfcdf 100644 --- a/packages/app/src/systems/Error/pages/ReportErrors/ReportErrors.stories.tsx +++ b/packages/app/src/systems/Error/pages/ReportErrors/ReportErrors.stories.tsx @@ -1,4 +1,4 @@ -import type { StoryFn, Meta } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import { ReportErrors } from './ReportErrors'; diff --git a/packages/app/src/systems/Error/pages/ReportErrors/ReportErrors.tsx b/packages/app/src/systems/Error/pages/ReportErrors/ReportErrors.tsx index 64f0fc8d2a..50d6d8cfe3 100644 --- a/packages/app/src/systems/Error/pages/ReportErrors/ReportErrors.tsx +++ b/packages/app/src/systems/Error/pages/ReportErrors/ReportErrors.tsx @@ -1,6 +1,6 @@ import { cssObj } from '@fuel-ui/css'; -import { FuelLogo, Heading, Button, Box, Text, Input } from '@fuel-ui/react'; -import { WALLET_WIDTH, WALLET_HEIGHT } from '~/config'; +import { Box, Button, FuelLogo, Heading, Input, Text } from '@fuel-ui/react'; +import { WALLET_HEIGHT, WALLET_WIDTH } from '~/config'; import { coreStyles } from '~/systems/Core/styles'; import { useReportError } from '../../hooks'; diff --git a/packages/app/src/systems/Error/services/ReportErrorService.tsx b/packages/app/src/systems/Error/services/ReportErrorService.tsx index 600d26e1b4..5f679a9b35 100644 --- a/packages/app/src/systems/Error/services/ReportErrorService.tsx +++ b/packages/app/src/systems/Error/services/ReportErrorService.tsx @@ -5,14 +5,17 @@ import { db } from '~/systems/Core/utils/database'; import { createError, parseFuelError } from '../utils'; +// biome-ignore lint/complexity/noStaticOnlyClass: export class ReportErrorService { static async reportErrors() { + // biome-ignore lint/complexity/noThisInStatic: const errors = await this.getErrors(); Sentry.init({ release: APP_VERSION, dsn: VITE_SENTRY_DSN, environment: process.env.NODE_ENV, }); + // biome-ignore lint/complexity/noForEach: errors.forEach((e) => { Sentry.captureException(createError(e), { extra: e, @@ -32,6 +35,7 @@ export class ReportErrorService { } static async checkForErrors(): Promise { + // biome-ignore lint/complexity/noThisInStatic: const errors = await this.getErrors(); return errors.length > 0; } diff --git a/packages/app/src/systems/Error/utils/parseFuelError.ts b/packages/app/src/systems/Error/utils/parseFuelError.ts index cd77090474..8dee0afa3b 100644 --- a/packages/app/src/systems/Error/utils/parseFuelError.ts +++ b/packages/app/src/systems/Error/utils/parseFuelError.ts @@ -1,7 +1,7 @@ import { createUUID } from '@fuel-wallet/connections'; import type { FuelWalletError } from '@fuel-wallet/types'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any +// biome-ignore lint/suspicious/noExplicitAny: export function parseFuelError(error: any): FuelWalletError { return { ...error, @@ -11,7 +11,7 @@ export function parseFuelError(error: any): FuelWalletError { } export function createError(e: FuelWalletError): FuelWalletError | Error { - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: let syntheticError: any = e; if (e.error && 'stack' in e.error) { diff --git a/packages/app/src/systems/Faucet/components/FaucetDialog.tsx b/packages/app/src/systems/Faucet/components/FaucetDialog.tsx index fe6f2e8c1a..089aed6835 100644 --- a/packages/app/src/systems/Faucet/components/FaucetDialog.tsx +++ b/packages/app/src/systems/Faucet/components/FaucetDialog.tsx @@ -79,7 +79,7 @@ export function FaucetDialog() { intent="primary" onPress={() => handlers.startFaucet({ - address: account!.address || '', + address: account?.address || '', captcha: captcha.value, }) } diff --git a/packages/app/src/systems/Faucet/hooks/useOpenFaucet.ts b/packages/app/src/systems/Faucet/hooks/useOpenFaucet.ts index 3bf020b159..6129b4bfd9 100644 --- a/packages/app/src/systems/Faucet/hooks/useOpenFaucet.ts +++ b/packages/app/src/systems/Faucet/hooks/useOpenFaucet.ts @@ -14,7 +14,7 @@ export function useOpenFaucet() { const openFaucet = useCallback(() => { if (IS_CRX) { const url = stringifyUrl(VITE_FUEL_FAUCET_URL, { - address: account!.address, + address: account?.address, }); openTab(url); } else { diff --git a/packages/app/src/systems/Faucet/machines/captchaMachine.tsx b/packages/app/src/systems/Faucet/machines/captchaMachine.tsx index 6f0485e6ab..fc2e9c1d3e 100644 --- a/packages/app/src/systems/Faucet/machines/captchaMachine.tsx +++ b/packages/app/src/systems/Faucet/machines/captchaMachine.tsx @@ -15,7 +15,6 @@ export const captchaMachine = /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOhzEwGsCoBiRUABwHtZcAXXZ-BkAD0QBaAEwBGAKwkAbDIAcATgAMi4YtFT5AFikAaEAE8ho0cJKbRsk4s0BmcbNkB2JwF8XetFjyFSAd3QcNAAyzOgQtEEA8gCCACK8LGyc3LwCCKI2imaq4o6a8vay4tp6hunCstIqDjbCjuKi2s5uHhg4BMQk-oH4UCFhtHyw7OjsYCToAGZjAE7IUsrKRLSe7T5dAZy9-RAJrIEpSPyIUqbamuI2jjbqp7nipUJi0pqajqLyTjayNpqyLSBVt5OuwZuh8EkuPgaINhqNxlNZshxEsVm1gaRQeDIdwaHscTwjmk-vISOIpA1nIonMIUTYbI90n8SKJqu8VMI7B8bACgR1SAAbUIQSC0ADKAFEACoAfQAwtEAApSuUACWi+IOhNAxNEjhIFXk9OEMlOd0cjMEFlJjikjmcxQUxgubncIHwzBF8COfPW5CoeKOiS1qSMsiywnk8jylxk1kU9UtYikBvUwlsilqC0jvPR-I2PT6ws1yW1xwQgjsJAKH3uzkcJqcugMiAkKfEtIksg05ikrjdvpBYIhWsDTH2pdDCFqlQyRXe8j1GRs8mbZUaplZkczYnEUdpua8+aFYUgJahU47ojJte0CaNCc0lr3JEzxijl0cq-q8kPa06kwBAKZ5BhOF5EogmSaGSrwLPU4YNKyFotggnIkEUHZcumHZ9tYf4YiQeAQCKZbBpOEEVh8WRSLYbwIbSNhSCYjLqKSPziLkvx9nk7w8gOebrBA3BgOehw6ogtJZAoDj7jRxTUgyKFWraJC2va3GWIuWiiPh-KiWWaQiCu0hyEoKhqD2a5PA4qanD8+56v8rpAA */ createMachine( { - // eslint-disable-next-line @typescript-eslint/consistent-type-imports tsTypes: {} as import('./captchaMachine.typegen').Typegen0, schema: { context: {} as MachineContext, events: {} as MachineEvents }, context: { key: VITE_FAUCET_RECAPTCHA_KEY }, diff --git a/packages/app/src/systems/Faucet/machines/faucetMachine.test.ts b/packages/app/src/systems/Faucet/machines/faucetMachine.test.ts index e7e26e15e7..e4bc0c32ec 100644 --- a/packages/app/src/systems/Faucet/machines/faucetMachine.test.ts +++ b/packages/app/src/systems/Faucet/machines/faucetMachine.test.ts @@ -7,7 +7,7 @@ import type { FaucetMachineService, FaucetMachineState } from './faucetMachine'; import { faucetMachine } from './faucetMachine'; mockServer([ - rest.post('http://localhost:4041/dispense', (req, res, ctx) => { + rest.post('http://localhost:4041/dispense', (_req, res, ctx) => { return res( ctx.json({ status: 'Success', diff --git a/packages/app/src/systems/Faucet/machines/faucetMachine.tsx b/packages/app/src/systems/Faucet/machines/faucetMachine.tsx index 50b645b8c5..b5a4680052 100644 --- a/packages/app/src/systems/Faucet/machines/faucetMachine.tsx +++ b/packages/app/src/systems/Faucet/machines/faucetMachine.tsx @@ -29,6 +29,7 @@ type MachineContext = { type MachineServices = { faucet: { + // biome-ignore lint/suspicious/noConfusingVoidType: data: void; }; }; @@ -44,7 +45,7 @@ export const faucetMachine = createMachine( { predictableActionArguments: true, - // eslint-disable-next-line @typescript-eslint/consistent-type-imports + tsTypes: {} as import('./faucetMachine.typegen').Typegen0, schema: { context: {} as MachineContext, diff --git a/packages/app/src/systems/Home/components/UserAddressCard/UserAddressCard.tsx b/packages/app/src/systems/Home/components/UserAddressCard/UserAddressCard.tsx index 2d5d466cba..78a0360234 100644 --- a/packages/app/src/systems/Home/components/UserAddressCard/UserAddressCard.tsx +++ b/packages/app/src/systems/Home/components/UserAddressCard/UserAddressCard.tsx @@ -9,7 +9,7 @@ type Props = { export function UserAddressCard({ address }: Props) { const copyAccount = useCallback(() => { navigator.clipboard.writeText(address); - }, []); + }, [address]); return ( diff --git a/packages/app/src/systems/Network/components/NetworkDropdown/NetworkDropdown.tsx b/packages/app/src/systems/Network/components/NetworkDropdown/NetworkDropdown.tsx index f882a4c8f2..73d7abd2a2 100644 --- a/packages/app/src/systems/Network/components/NetworkDropdown/NetworkDropdown.tsx +++ b/packages/app/src/systems/Network/components/NetworkDropdown/NetworkDropdown.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { cssObj } from '@fuel-ui/css'; import { Button } from '@fuel-ui/react'; import type { NetworkData } from '@fuel-wallet/types'; @@ -16,7 +15,9 @@ export const NetworkDropdown = forwardRef( ({ selected, isDisabled, ...props }, ref) => { return (