From 3eda4a06cad9df30b0db95d1de0ef57e569dff29 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Mon, 5 Feb 2024 20:56:07 -0300 Subject: [PATCH] chore: add biome as linter/formatter (#156) --- .eslintignore | 31 - .eslintrc.js | 61 - .github/workflows/pr.yaml | 5 +- .lintstagedrc.mjs | 3 +- .npmrc | 5 +- .prettierignore | 25 - .prettierrc.js | 17 - .vscode/extensions.json | 3 +- .vscode/settings.json | 2 +- biome.json | 80 + contracts/predicate/package.json | 4 +- contracts/predicate/scripts/run-predicate.ts | 8 +- docker/erc20-deployer/deployer/package.json | 4 +- docker/erc20-deployer/deployer/src/index.ts | 6 +- docker/l1-chain/hardhat/hardhat.config.ts | 2 +- docker/l1-chain/hardhat/package.json | 2 +- package.json | 62 +- packages/app-explorer/.eslintrc.js | 11 - packages/app-explorer/.storybook/preview.tsx | 8 +- packages/app-explorer/next.config.mjs | 4 +- .../app-explorer/src/app/global-error.tsx | 2 +- .../src/systems/Account/utils/tabs.ts | 2 +- .../Asset/components/AssetItem/AssetItem.tsx | 12 +- .../src/systems/Asset/hooks/useFuelAsset.ts | 2 +- .../src/systems/Block/actions/get-block.ts | 4 +- .../Block/components/BlockScreenAdvanced.tsx | 2 +- .../Block/components/BlockScreenSimple.tsx | 4 +- .../Contract/components/ContractAssetList.tsx | 2 +- .../systems/Core/components/Amount/Amount.tsx | 2 +- .../Core/components/CodeBlock/CodeBlock.tsx | 6 +- .../Core/components/EmptyCard/EmptyCard.tsx | 2 +- .../systems/Core/components/Footer/Footer.tsx | 8 +- .../systems/Core/components/Layout/Layout.tsx | 2 +- .../NavigationTab/NavigationTab.tsx | 2 +- .../Core/components/PageTitle/PageTitle.tsx | 2 +- .../Core/components/Pagination/Pagination.tsx | 4 +- .../Core/components/Search/SearchForm.tsx | 6 +- .../Core/components/Search/SearchInput.tsx | 12 +- .../Core/components/Search/SearchWidget.tsx | 8 +- .../systems/Core/components/TopNav/TopNav.tsx | 2 +- .../systems/Core/components/Utxos/Utxos.tsx | 2 +- .../src/systems/Core/utils/act-client.ts | 2 +- .../src/systems/Core/utils/act-server.ts | 4 +- .../src/systems/Core/utils/address.ts | 2 +- .../src/systems/Core/utils/asset.ts | 2 +- .../src/systems/Core/utils/sdk.ts | 2 +- .../component/TxAccountItem/TxAccountItem.tsx | 2 +- .../component/TxAssetItem/TxAssetItem.tsx | 2 +- .../component/TxIcon/TxIcon.stories.tsx | 2 +- .../Transaction/component/TxIcon/TxIcon.tsx | 2 +- .../Transaction/component/TxInput/TxInput.tsx | 4 +- .../component/TxScreen/TxScreenSimple.tsx | 4 +- .../component/TxScripts/TxScripts.tsx | 38 +- .../component/TxSummary/TxSummary.tsx | 14 +- .../Transactions/components/TxCard/TxCard.tsx | 8 +- .../components/TxList/TxListLoader.tsx | 2 +- packages/app-explorer/tailwind.config.ts | 2 +- packages/app-portal/.storybook/main.ts | 6 +- packages/app-portal/.storybook/preview.tsx | 6 +- packages/app-portal/load.envs.js | 4 +- packages/app-portal/package.json | 8 +- packages/app-portal/playwright.config.ts | 4 +- .../playwright/e2e/AssetList.test.ts | 6 +- .../app-portal/playwright/e2e/Bridge.test.ts | 94 +- .../playwright/e2e/fixtures/index.ts | 4 +- .../e2e/fixtures/utils/waitForExtenssions.ts | 4 +- .../app-portal/playwright/e2e/utils/bridge.ts | 4 +- .../app-portal/public/ecosystem/projects.json | 864 +-- packages/app-portal/src/main.tsx | 2 +- packages/app-portal/src/providers.tsx | 2 +- packages/app-portal/src/routes.tsx | 2 +- .../AccountConnectionInput.tsx | 2 +- .../AccountSwitchDialog.tsx | 14 +- .../Assets/components/AssetLogo/AssetLogo.tsx | 2 +- .../Assets/containers/AssetsDialog.tsx | 8 +- .../src/systems/Assets/hooks/useAssets.tsx | 6 +- .../systems/Assets/machines/assetsMachine.tsx | 2 +- .../src/systems/Assets/services/asset.tsx | 2 +- .../src/systems/Assets/utils/network.ts | 2 +- .../components/BridgeSteps/BridgeSteps.tsx | 2 +- .../BridgeTxItem/BridgeTxItem.stories.tsx | 2 +- .../components/BridgeTxItem/BridgeTxItem.tsx | 2 +- .../BridgeTxItemsLoading.tsx | 2 +- .../BridgeTxListNotConnected.tsx | 2 +- .../BridgeTxOverview/BridgeTxOverview.tsx | 2 +- .../systems/Bridge/containers/BridgeTabs.tsx | 4 +- .../app-portal/src/systems/Bridge/events.tsx | 4 +- .../src/systems/Bridge/hooks/useBridge.tsx | 12 +- .../src/systems/Bridge/hooks/useBridgeTxs.tsx | 3 +- .../systems/Bridge/machines/bridgeMachine.tsx | 4 +- .../Bridge/machines/bridgeTxsMachine.tsx | 18 +- .../src/systems/Bridge/pages/Bridge.tsx | 2 +- .../src/systems/Bridge/pages/BridgeHome.tsx | 2 +- .../src/systems/Bridge/pages/BridgeTxList.tsx | 4 +- .../app-portal/src/systems/Bridge/routes.tsx | 2 +- .../src/systems/Bridge/services/bridge.tsx | 20 +- .../RemoveAssetDialog/RemoveAssetDialog.tsx | 2 +- .../eth/containers/AddAssetFormDialog.tsx | 4 +- .../eth/containers/TxEthToFuelDialog.tsx | 2 +- .../eth/containers/TxListItemEthToFuel.tsx | 2 +- .../Chains/eth/contracts/FuelChainState.ts | 2 +- .../Chains/eth/hooks/useAddAssetForm.ts | 2 +- .../Chains/eth/hooks/useTxEthToFuel.tsx | 10 +- .../eth/machines/txEthToFuelMachine.tsx | 12 +- .../systems/Chains/eth/services/connectors.ts | 2 +- .../Chains/eth/services/txEthToFuel.ts | 26 +- .../src/systems/Chains/eth/utils/chain.ts | 2 +- .../systems/Chains/eth/utils/relayMessage.ts | 2 +- .../fuel/containers/TxFuelToEthDialog.tsx | 2 +- .../fuel/containers/TxListItemFuelToEth.tsx | 2 +- .../systems/Chains/fuel/hooks/useBalance.tsx | 4 +- .../fuel/hooks/useFuelAccountConnection.tsx | 6 +- .../Chains/fuel/hooks/useTxFuelToEth.tsx | 18 +- .../fuel/machines/txFuelToEthMachine.tsx | 10 +- .../Chains/fuel/services/txFuelToEth.ts | 34 +- .../src/systems/Chains/fuel/utils/chain.ts | 2 +- .../src/systems/Chains/fuel/utils/contract.ts | 2 +- .../src/systems/Chains/fuel/utils/getBlock.ts | 6 +- .../src/systems/Chains/fuel/utils/provider.ts | 6 +- .../systems/Chains/fuel/utils/relayMessage.ts | 18 +- .../systems/Chains/fuel/utils/transaction.ts | 6 +- .../src/systems/Core/components/Header.tsx | 2 +- .../src/systems/Core/components/Layout.tsx | 2 +- .../src/systems/Core/machines/fetchMachine.ts | 4 +- .../src/systems/Core/styles/core.ts | 7 +- .../src/systems/Core/utils/address.ts | 4 +- .../components/ProjectItem/ProjectItem.tsx | 25 +- .../systems/Ecosystem/hooks/useEcosystem.tsx | 2 +- .../Ecosystem/machines/ecosystemMachine.tsx | 4 +- .../src/systems/Ecosystem/pages/Ecosystem.tsx | 2 +- .../OverlayDialog/OverlayDialog.tsx | 2 +- .../src/systems/Overlay/hooks/useOverlay.tsx | 4 +- .../Overlay/machines/overlayMachine.ts | 2 +- .../Settings/providers/ConnectProvider.tsx | 4 +- .../providers/FuelNetworkProvider.tsx | 2 +- .../Settings/providers/FuelUiProvider.tsx | 2 +- .../app-portal/src/systems/Store/index.tsx | 4 +- packages/app-portal/src/types/index.tsx | 12 +- packages/app-portal/vite.config.ts | 2 +- packages/graphql/package.json | 14 +- packages/graphql/src/bin/index.ts | 2 +- packages/graphql/src/bin/server.ts | 6 +- packages/graphql/src/domains/Account.ts | 6 +- packages/graphql/src/domains/Block.ts | 2 +- packages/graphql/src/domains/Network.ts | 4 +- packages/graphql/src/domains/Operation.ts | 4 +- packages/graphql/src/domains/Token.ts | 6 +- .../src/domains/TransactionConnection.ts | 4 +- packages/graphql/src/server.ts | 6 +- packages/graphql/src/utils/address.ts | 2 +- packages/graphql/src/utils/cache.ts | 3 +- packages/graphql/src/utils/domain.ts | 5 +- packages/graphql/src/utils/executor.ts | 4 +- packages/graphql/src/utils/getFieldsValues.ts | 6 +- packages/graphql/src/utils/requireEnv.ts | 4 +- packages/notification-service/load.envs.js | 4 +- packages/notification-service/prisma/seed.ts | 2 +- packages/notification-service/src/index.ts | 2 +- .../src/services/mailService.ts | 4 +- .../notification-service/src/utils/address.ts | 4 +- .../src/utils/handleNewEthBlock.ts | 20 +- packages/storybook-addon-theme/package.json | 12 +- .../storybook-addon-theme/src/register.tsx | 2 +- packages/ui/.storybook/main.ts | 4 +- packages/ui/.storybook/preview.tsx | 6 +- packages/ui/package.json | 40 +- packages/ui/scripts/create-defs.mjs | 40 +- .../ui/src/components/Address/Address.tsx | 2 +- .../src/components/Address/useFuelAddress.tsx | 2 +- packages/ui/src/components/Asset/Asset.tsx | 4 +- packages/ui/src/components/Box/Container.tsx | 2 +- packages/ui/src/components/Box/HStack.tsx | 2 +- packages/ui/src/components/Box/VStack.tsx | 2 +- .../src/components/Breadcrumb/Breadcrumb.tsx | 4 +- packages/ui/src/components/Button/Button.tsx | 2 +- .../components/ButtonClose/ButtonClose.tsx | 2 +- .../components/ButtonGroup/ButtonGroup.tsx | 4 +- .../ui/src/components/CardList/CardList.tsx | 2 +- .../CardList/useCardListContext.tsx | 2 +- .../components/Collapsible/Collapsible.tsx | 10 +- .../ui/src/components/Copyable/Copyable.tsx | 2 +- packages/ui/src/components/Dialog/Dialog.tsx | 2 +- .../src/components/EntityItem/EntityItem.tsx | 2 +- packages/ui/src/components/Focus/Focus.tsx | 4 +- .../ui/src/components/Heading/Heading.tsx | 2 +- .../src/components/HelperIcon/HelperIcon.tsx | 2 +- packages/ui/src/components/Icon/Icon.tsx | 2 +- .../src/components/IconButton/IconButton.tsx | 4 +- packages/ui/src/components/Link/Link.tsx | 2 +- packages/ui/src/components/List/List.tsx | 2 +- .../LoadingWrapper/LoadingWrapper.tsx | 2 +- packages/ui/src/components/Nav/Nav.tsx | 2 +- .../ui/src/components/Popover/Popover.tsx | 2 +- .../ui/src/components/Separator/Separator.tsx | 2 +- .../ui/src/components/Spinner/Spinner.tsx | 2 +- packages/ui/src/components/Tabs/Tabs.tsx | 4 +- packages/ui/src/components/Text/Text.tsx | 4 +- packages/ui/src/components/Theme/Theme.tsx | 2 +- packages/ui/src/components/Toast/toaster.tsx | 16 +- packages/ui/src/components/Toast/useToast.tsx | 12 +- packages/ui/src/hooks/useStrictedChildren.tsx | 8 +- packages/ui/src/hooks/useVariants.tsx | 2 +- packages/ui/src/theme/tailwind-preset.ts | 8 +- packages/ui/src/utils/component.tsx | 6 +- packages/ui/src/utils/css.ts | 2 +- packages/ui/src/utils/helpers.ts | 14 +- pnpm-lock.yaml | 6226 +++++++++-------- scripts/deps.sh | 2 +- tsconfig.base.json | 3 + 209 files changed, 4264 insertions(+), 4265 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js delete mode 100644 .prettierignore delete mode 100644 .prettierrc.js create mode 100644 biome.json delete mode 100644 packages/app-explorer/.eslintrc.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 8f9efd8e6..000000000 --- a/.eslintignore +++ /dev/null @@ -1,31 +0,0 @@ -**/**/.* -**/build/** -**/coverage/ -**/dist/** -**/fuel-v2-contracts -**/generated/** -**/node_modules/** -**/public/storybook/** -**/public/ui/** -**/storybook-static -**/storybook-static/** -**/storybook/** -*.html -*.typegen.ts -.changeset -.eslintrc.js -.lintstagedrc.js -.next/* -.turbo -CHANGELOG.md -build -dist -generated -generated -node_modules -packages/app-portal/public/** -packages/app-portal/src/types -pnpm-lock.yaml -scripts/bridge/fuel-bridge -**/**/tsconfig.json -**.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 73a66b450..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,61 +0,0 @@ -const { dependencies } = require('./packages/app-explorer/package.json'); - -module.exports = { - root: true, - extends: [ - 'plugin:@fuels/typescript', - 'plugin:@fuels/jest', - 'plugin:@fuels/react', - ], - parserOptions: { - tsconfigRootDir: __dirname, - }, - settings: { - react: { - version: dependencies.react, - }, - 'import/resolver': { - // TODO: add this extensions in the npm-packs - [require.resolve('eslint-import-resolver-node')]: { - extensions: ['.js', '.jsx', '.ts', '.tsx'], - }, - [require.resolve('eslint-import-resolver-typescript')]: { - alwaysTryTypes: true, - }, - }, - }, - rules: { - // TODO: add this rules in the npm-packs - '@typescript-eslint/consistent-type-imports': [ - 'error', - { prefer: 'type-imports', fixStyle: 'separate-type-imports' }, - ], - 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'], - 'import/namespace': 'off', - 'import/order': [ - 'error', - { - groups: [ - ['builtin', 'external', 'internal'], - ['parent'], - ['sibling', 'index'], - ], - 'newlines-between': 'always', - alphabetize: { order: 'asc' }, - }, - ], - 'no-html-link-for-pages': 'off', - 'react-hooks/rules-of-hooks': 'off', - 'react/jsx-sort-props': [ - 'warn', - { - callbacksLast: true, - shorthandFirst: true, - noSortAlphabetically: true, - reservedFirst: true, - multiline: 'last', - reservedFirst: true, - }, - ], - }, -}; diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index d782cef40..21dcea7d1 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,4 +1,4 @@ -name: 'PR Checks' +name: "PR Checks" on: pull_request: @@ -47,6 +47,5 @@ jobs: - name: Run lint & ts:check run: | - pnpm build - pnpm lint:check + pnpm lint:ci pnpm ts:check diff --git a/.lintstagedrc.mjs b/.lintstagedrc.mjs index 35b003584..9c3a2f126 100644 --- a/.lintstagedrc.mjs +++ b/.lintstagedrc.mjs @@ -1,4 +1,3 @@ export default { - '**/*.(js|jsx|ts|jsx|md|mdx|json|html|css)': ['prettier --write'], - '**/*.ts?(x)': ['eslint'], + '**/*.(js|jsx|ts|tsx|md|json|mdx|html|css)': ['biome check --apply-unsafe'], }; diff --git a/.npmrc b/.npmrc index 921c36143..22a74cf76 100644 --- a/.npmrc +++ b/.npmrc @@ -27,7 +27,8 @@ save-workspace-protocol=rolling public-hoist-pattern[]=*tailwind-variants* public-hoist-pattern[]=*framer-motion* public-hoist-pattern[]=*@react-aria/interactions* -public-hoist-pattern[]=*eslint* -public-hoist-pattern[]=*prettier* public-hoist-pattern[]=*ts-node* public-hoist-pattern[]=@types* +public-hoist-pattern[]=*viem* +public-hoist-pattern[]=*wagmi* +public-hoist-pattern[]=*ethers* diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 930f9e20c..000000000 --- a/.prettierignore +++ /dev/null @@ -1,25 +0,0 @@ -**/**/.* -**/build/** -**/coverage/ -**/dist/** -**/fuel-v2-contracts -**/generated/** -**/node_modules/** -**/public/storybook/** -**/public/ui/** -**/storybook-static -**/storybook-static/** -**/storybook/** -*.typegen.ts -.next/* -.turbo -CHANGELOG.md -build -dist -generated -helm -node_modules -packages/app-portal/public/** -packages/app-portal/src/types -pnpm-lock.yaml -scripts/bridge/fuel-bridge diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 41af13216..000000000 --- a/.prettierrc.js +++ /dev/null @@ -1,17 +0,0 @@ -const fuelPrettierConfig = require('@fuels/prettier-config'); - -/** @type {import("prettier").Config} */ -module.exports = { - ...fuelPrettierConfig, - // trailingComma always adds comma on the end of functions params, that can cause - // issues, when a second param can't be undefined. - trailingComma: 'es5', - overrides: [ - { - files: '*.json', - options: { - trailingComma: 'none', - }, - }, - ], -}; diff --git a/.vscode/extensions.json b/.vscode/extensions.json index f82e7fbe8..3fd567d90 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,6 @@ { "recommendations": [ - "esbenp.prettier-vscode", - "dbaeumer.vscode-eslint", + "biomejs.biome", "statelyai.stately-vscode", "firsttris.vscode-jest-runner", "rust-lang.rust-analyzer", diff --git a/.vscode/settings.json b/.vscode/settings.json index 51dfdf9a9..72b9cd096 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "biomejs.biome", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" diff --git a/biome.json b/biome.json new file mode 100644 index 000000000..b2acb36d8 --- /dev/null +++ b/biome.json @@ -0,0 +1,80 @@ +{ + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", + "organizeImports": { + "enabled": true + }, + "formatter": { + "enabled": true, + "formatWithErrors": true, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 80 + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "style": { + "noNonNullAssertion": "off" + }, + "suspicious": { + "noExplicitAny": "warn", + "noImplicitAnyLet": "warn", + "noArrayIndexKey": "off", + "noConfusingVoidType": "off", + "noSelfCompare": "off" + }, + "correctness": { + "useExhaustiveDependencies": "off" + }, + "complexity": { + "noStaticOnlyClass": "off", + "noForEach": "warn", + "noBannedTypes": "off" + }, + "performance": { + "noAccumulatingSpread": "off" + }, + "a11y": { + "noSvgWithoutTitle": "off" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "single" + } + }, + "json": { + "parser": { + "allowTrailingCommas": true + } + }, + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "files": { + "ignore": [ + "**/node_modules", + "**/.turbo", + "**/.next", + "**/.vercel", + "**/dist", + "**/build", + "**/fuel-v2-contracts", + "**/coverage", + "**/generated", + "**/storybook-static", + "*.typegen.ts", + "./packages/app-explorer/public/storybook", + "./packages/app-explorer/public/ui", + "./packages/app-explorer/public/portal", + "./packages/app-explorer/public/portal-storybook", + "./packages/app-portal/public/**", + "./packages/app-portal/src/types", + "pnpm-lock.yaml" + ] + } +} diff --git a/contracts/predicate/package.json b/contracts/predicate/package.json index 0f889c140..f299c0c23 100644 --- a/contracts/predicate/package.json +++ b/contracts/predicate/package.json @@ -13,8 +13,8 @@ "license": "ISC", "devDependencies": { "dotenv": "16.4.1", - "fuels": "0.71.1", - "vitest": "1.2.1", + "fuels": "0.73.0", + "vitest": "1.2.2", "tsx": "4.7.0" } } diff --git a/contracts/predicate/scripts/run-predicate.ts b/contracts/predicate/scripts/run-predicate.ts index e0c01e4ab..c6793f0ac 100644 --- a/contracts/predicate/scripts/run-predicate.ts +++ b/contracts/predicate/scripts/run-predicate.ts @@ -1,13 +1,15 @@ -import { BaseAssetId, Predicate, Provider, Wallet, bn, hexlify } from 'fuels'; import { promises as fs } from 'node:fs'; import { resolve } from 'node:path'; +import { BaseAssetId, Predicate, Provider, Wallet, bn, hexlify } from 'fuels'; const { FUEL_PROVIDER, PRIVATE_KEY } = process.env; const BIN_PATH = resolve(__dirname, '../out/debug/predicate-app.bin'); const AMOUNT = 300_000; if (!FUEL_PROVIDER || !PRIVATE_KEY) { - throw new Error('Missing some config in .env file. Should have FUEL_PROVIDER and PRIVATE_KEY'); + throw new Error( + 'Missing some config in .env file. Should have FUEL_PROVIDER and PRIVATE_KEY', + ); } async function main() { @@ -43,7 +45,7 @@ async function main() { BaseAssetId, { gasPrice, - } + }, ); const res2 = await tx2.waitForResult(); console.log(`→ Transaction Id: ${res2.id}`); diff --git a/docker/erc20-deployer/deployer/package.json b/docker/erc20-deployer/deployer/package.json index f7fc0cf7d..57fbe663b 100644 --- a/docker/erc20-deployer/deployer/package.json +++ b/docker/erc20-deployer/deployer/package.json @@ -6,9 +6,9 @@ "dependencies": { "@fuel-bridge/test-utils": "next", "ethers": "5.7.2", - "fuels": "0.71.1" + "fuels": "0.73.0" }, "devDependencies": { - "ts-node": "^10.9.1" + "ts-node": "^10.9.2" } } diff --git a/docker/erc20-deployer/deployer/src/index.ts b/docker/erc20-deployer/deployer/src/index.ts index cf1aa3ab8..64ad01999 100644 --- a/docker/erc20-deployer/deployer/src/index.ts +++ b/docker/erc20-deployer/deployer/src/index.ts @@ -1,10 +1,10 @@ +import { createServer } from 'http'; import { getOrDeployECR20Contract, getOrDeployFuelTokenContract, getTokenId, setupEnvironment, } from '@fuel-bridge/test-utils'; -import { createServer } from 'http'; const { PORT, @@ -32,7 +32,7 @@ async function main() { gasPrice: 1, gasLimit: 1_000_000, }, - 9 + 9, ); const tokenId = getTokenId(FuelToken); await startServer({ @@ -44,7 +44,7 @@ async function main() { function startServer(deployments: Record) { return new Promise((resolve) => { - createServer(function (req, res) { + createServer((req, res) => { switch (req.url) { case '/health': res.writeHead(200, { 'Content-Type': 'text/plain' }); diff --git a/docker/l1-chain/hardhat/hardhat.config.ts b/docker/l1-chain/hardhat/hardhat.config.ts index 6a5981785..07cfef954 100644 --- a/docker/l1-chain/hardhat/hardhat.config.ts +++ b/docker/l1-chain/hardhat/hardhat.config.ts @@ -1,7 +1,7 @@ -import type { HardhatUserConfig } from 'hardhat/types'; import '@nomiclabs/hardhat-etherscan'; import '@openzeppelin/hardhat-upgrades'; import 'hardhat-typechain'; +import type { HardhatUserConfig } from 'hardhat/types'; const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || ''; const LOCALHOST_HTTP = process.env.LOCALHOST_HTTP || ''; diff --git a/docker/l1-chain/hardhat/package.json b/docker/l1-chain/hardhat/package.json index 1cbda2e05..e25ddf4ae 100644 --- a/docker/l1-chain/hardhat/package.json +++ b/docker/l1-chain/hardhat/package.json @@ -7,6 +7,6 @@ "license": "MIT", "dependencies": { "dotenv": "^10.0.0", - "hardhat": "^2.9.6" + "hardhat": "^2.19.5" } } diff --git a/package.json b/package.json index eec015af1..ff110b957 100644 --- a/package.json +++ b/package.json @@ -37,17 +37,15 @@ "dev:portal": "pnpm --filter=app-portal dev", "dev:graphql": "pnpm --filter=graphql dev", "dev:notification": "pnpm --filter=notification-service dev:notification", - "lint": "run-s lint:check prettier:check", - "lint:check": "eslint .", - "lint:fix": "pnpm lint:check --fix", + "lint": "biome check --apply-unsafe .", + "lint:ci": "biome lint --max-diagnostics=1000 --diagnostic-level=error .", + "format": "biome format --write .", "node:clean": "make -C ./docker clean", "node:logs": "make -C ./docker logs", "node:reset": "run-s node:stop node:clean node:start", "node:start": "make -C ./docker start", "node:stop": "make -C ./docker stop", "prepare": "husky install", - "prettier:check": "prettier --check .", - "prettier:format": "prettier --write .", "start": "pnpm turbo:run start", "storybook:portal": "pnpm turbo:run storybook --filter=app-portal", "test": "pnpm turbo:run test", @@ -61,64 +59,48 @@ "turbo:run": "./scripts/turbo.sh" }, "dependencies": { - "@fuels/eslint-plugin": "^0.1.4", - "@fuels/jest": "^0.1.4", - "@fuels/prettier-config": "^0.1.4", - "@fuels/ts-config": "^0.1.4", - "ethers": "6.10.0", - "fuels": "0.71.1", + "@fuels/jest": "^0.1.5", + "@fuels/ts-config": "^0.1.5", + "ethers": "5.7.2", + "fuels": "0.73.0", "jest": "29.7.0", - "lint-staged": "15.2.0" + "lint-staged": "15.2.2" }, "devDependencies": { "@babel/core": "^7.23.9", - "@fuels/eslint-plugin": "^0.1.4", - "@fuels/jest": "^0.1.4", - "@fuels/prettier-config": "^0.1.4", - "@fuels/tsup-config": "^0.1.4", + "@biomejs/biome": "1.5.3", + "@fuels/jest": "^0.1.5", + "@fuels/tsup-config": "^0.1.5", "@jest/types": "29.6.3", "@next/eslint-plugin-next": "^14.1.0", "@nomiclabs/hardhat-etherscan": "^3.1.8", "@openzeppelin/hardhat-upgrades": "^3.0.2", - "@playwright/test": "^1.41.1", - "@swc/core": "1.3.106", - "@swc/jest": "0.2.31", - "@types/jest": "29.5.11", - "@types/node": "20.11.6", - "@types/react": "^18.2.48", + "@playwright/test": "^1.41.2", + "@swc/core": "1.4.0", + "@swc/jest": "0.2.36", + "@types/jest": "29.5.12", + "@types/node": "20.11.16", + "@types/react": "^18.2.54", "@types/react-dom": "^18.2.18", - "@typescript-eslint/eslint-plugin": "^6.19.1", - "@typescript-eslint/parser": "^6.19.1", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", "@xstate/cli": "^0.5.17", "dotenv": "^16.4.1", - "eslint": "^8.56.0", - "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-node": "^0.3.9", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jest-dom": "^5.1.0", - "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-testing-library": "^6.2.0", "get-tsconfig": "4.7.2", "hardhat-typechain": "^0.3.5", - "husky": "^9.0.6", + "husky": "^9.0.10", "jest": "29.7.0", "jest-environment-jsdom": "29.7.0", "jest-transform-stub": "^2.0.0", - "lint-staged": "^15.2.0", + "lint-staged": "^15.2.2", "next": "14.1.0", "npm-run-all": "^4.1.5", - "prettier": "^3.2.4", "retus": "^1.1.2", "ts-jest": "^29.1.2", "ts-node": "10.9.2", "tsup": "8.0.1", "tsx": "4.7.0", - "turbo": "^1.11.3", + "turbo": "^1.12.2", "typescript": "5.3.3", "updates": "^15.1.1" }, diff --git a/packages/app-explorer/.eslintrc.js b/packages/app-explorer/.eslintrc.js deleted file mode 100644 index 090dcfb51..000000000 --- a/packages/app-explorer/.eslintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -const config = require('../../.eslintrc.js'); - -module.exports = { - extends: [ - 'plugin:@fuels/typescript', - 'plugin:@fuels/jest', - 'plugin:@fuels/react', - 'plugin:@fuels/next', - ], - rules: config.rules, -}; diff --git a/packages/app-explorer/.storybook/preview.tsx b/packages/app-explorer/.storybook/preview.tsx index 797151033..1a0b69a02 100644 --- a/packages/app-explorer/.storybook/preview.tsx +++ b/packages/app-explorer/.storybook/preview.tsx @@ -1,14 +1,14 @@ -import './fonts.css'; import '@fuels/ui/styles.css'; import '../src/app/globals.css'; +import './fonts.css'; +import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'; +import { Preview } from '@storybook/react'; import React from 'react'; import { withThemeDecorator } from 'storybook-addon-theme'; -import { Preview } from '@storybook/react'; -import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'; -import { Provider } from '../src/systems/Core/components/Provider'; import { ReactNode } from 'react'; +import { Provider } from '../src/systems/Core/components/Provider'; function ThemeWrapper({ children }: { children: ReactNode }) { const initTheme = localStorage.getItem('fuel-ui-theme') ?? 'dark'; diff --git a/packages/app-explorer/next.config.mjs b/packages/app-explorer/next.config.mjs index f6d300e7d..c87ebd29f 100644 --- a/packages/app-explorer/next.config.mjs +++ b/packages/app-explorer/next.config.mjs @@ -68,7 +68,7 @@ const config = { // Grab the existing rule that handles SVG imports const fileLoaderRule = config.module.rules.find((rule) => - rule.test?.test?.('.svg') + rule.test?.test?.('.svg'), ); config.module.rules.push( { @@ -88,7 +88,7 @@ const config = { }, }, ], - } + }, ); // Modify the file loader rule to ignore *.svg, since we have it handled now. fileLoaderRule.exclude = /\.svg$/i; diff --git a/packages/app-explorer/src/app/global-error.tsx b/packages/app-explorer/src/app/global-error.tsx index 9af179ba4..33bd3b8c0 100644 --- a/packages/app-explorer/src/app/global-error.tsx +++ b/packages/app-explorer/src/app/global-error.tsx @@ -1,6 +1,6 @@ 'use client'; -import './error.css'; import '@fuels/ui/styles.css'; +import './error.css'; import './globals.css'; import Cookies from 'js-cookie'; diff --git a/packages/app-explorer/src/systems/Account/utils/tabs.ts b/packages/app-explorer/src/systems/Account/utils/tabs.ts index 4c6278ff6..3cbe2fefa 100644 --- a/packages/app-explorer/src/systems/Account/utils/tabs.ts +++ b/packages/app-explorer/src/systems/Account/utils/tabs.ts @@ -1,5 +1,5 @@ export function isAllowedTab( - tab: string + tab: string, ): tab is 'assets' | 'transactions' | 'predicate' { return ['assets', 'transactions', 'predicate'].includes(tab); } diff --git a/packages/app-explorer/src/systems/Asset/components/AssetItem/AssetItem.tsx b/packages/app-explorer/src/systems/Asset/components/AssetItem/AssetItem.tsx index d5c3dbf4c..cec8da882 100644 --- a/packages/app-explorer/src/systems/Asset/components/AssetItem/AssetItem.tsx +++ b/packages/app-explorer/src/systems/Asset/components/AssetItem/AssetItem.tsx @@ -1,14 +1,14 @@ import type { HStackProps } from '@fuels/ui'; import { - HStack, - Text, - shortAddress, - Copyable, - Tooltip, Box, + Copyable, + Flex, + HStack, LoadingBox, LoadingWrapper, - Flex, + Text, + Tooltip, + shortAddress, } from '@fuels/ui'; import Image from 'next/image'; import { TxIcon } from '~/systems/Transaction/component/TxIcon/TxIcon'; diff --git a/packages/app-explorer/src/systems/Asset/hooks/useFuelAsset.ts b/packages/app-explorer/src/systems/Asset/hooks/useFuelAsset.ts index b7d6b2314..ad2603473 100644 --- a/packages/app-explorer/src/systems/Asset/hooks/useFuelAsset.ts +++ b/packages/app-explorer/src/systems/Asset/hooks/useFuelAsset.ts @@ -5,7 +5,7 @@ import { useMemo } from 'react'; export const useFuelAsset = (asset?: Asset | null) => { const fuelAsset = useMemo( () => (asset ? getAssetFuel(asset, CHAIN_IDS.fuel.beta4) : undefined), - [asset?.symbol, asset?.name, asset?.networks.length] + [asset?.symbol, asset?.name, asset?.networks.length], ); return fuelAsset; diff --git a/packages/app-explorer/src/systems/Block/actions/get-block.ts b/packages/app-explorer/src/systems/Block/actions/get-block.ts index 8088d0b4a..22b1bf120 100644 --- a/packages/app-explorer/src/systems/Block/actions/get-block.ts +++ b/packages/app-explorer/src/systems/Block/actions/get-block.ts @@ -14,7 +14,7 @@ const schema = z.object({ export const getBlock = act(schema, async (input) => { const id = input.id; const isAddressValid = isValidAddress(id); - const isValidBlockHeight = !isNaN(Number(id)); + const isValidBlockHeight = !Number.isNaN(Number(id)); if (!isValidBlockHeight && !isValidAddress) { throw new Error('Invalid block number or block id'); } @@ -35,7 +35,7 @@ const getProducer = ( | GetBlockByHeightQuery | { block: null; - } + }, ) => { // TODO use custom resolver once a fix is found let producer: string | null = null; diff --git a/packages/app-explorer/src/systems/Block/components/BlockScreenAdvanced.tsx b/packages/app-explorer/src/systems/Block/components/BlockScreenAdvanced.tsx index 0301639cc..dec0a6be7 100644 --- a/packages/app-explorer/src/systems/Block/components/BlockScreenAdvanced.tsx +++ b/packages/app-explorer/src/systems/Block/components/BlockScreenAdvanced.tsx @@ -1,4 +1,4 @@ -import type { Maybe, BlockItemFragment } from '@fuel-explorer/graphql'; +import type { BlockItemFragment, Maybe } from '@fuel-explorer/graphql'; import { VStack } from '@fuels/ui'; import { CodeBlock } from '~/systems/Core/components/CodeBlock/CodeBlock'; diff --git a/packages/app-explorer/src/systems/Block/components/BlockScreenSimple.tsx b/packages/app-explorer/src/systems/Block/components/BlockScreenSimple.tsx index e9a8923cd..cb713d298 100644 --- a/packages/app-explorer/src/systems/Block/components/BlockScreenSimple.tsx +++ b/packages/app-explorer/src/systems/Block/components/BlockScreenSimple.tsx @@ -3,12 +3,12 @@ import type { BlockItemFragment, Maybe } from '@fuel-explorer/graphql'; import { - VStack, - Grid, Address, + Grid, Icon, LoadingBox, LoadingWrapper, + VStack, } from '@fuels/ui'; import { IconListDetails } from '@tabler/icons-react'; import NextLink from 'next/link'; diff --git a/packages/app-explorer/src/systems/Contract/components/ContractAssetList.tsx b/packages/app-explorer/src/systems/Contract/components/ContractAssetList.tsx index 397175a05..07d13c834 100644 --- a/packages/app-explorer/src/systems/Contract/components/ContractAssetList.tsx +++ b/packages/app-explorer/src/systems/Contract/components/ContractAssetList.tsx @@ -15,7 +15,7 @@ type TabAssetsProps = { export function ContractAssetList({ balances }: TabAssetsProps) { const nonZeroBalances = balances?.edges.filter( - (contractBalance) => !bn(contractBalance.node.amount).isZero() + (contractBalance) => !bn(contractBalance.node.amount).isZero(), ); return ( diff --git a/packages/app-explorer/src/systems/Core/components/Amount/Amount.tsx b/packages/app-explorer/src/systems/Core/components/Amount/Amount.tsx index c9dff589c..1b8ea76b9 100644 --- a/packages/app-explorer/src/systems/Core/components/Amount/Amount.tsx +++ b/packages/app-explorer/src/systems/Core/components/Amount/Amount.tsx @@ -35,7 +35,7 @@ export function Amount({ as="div" className={cx( 'text-secondary text-sm flex items-center gap-2', - className + className, )} > {asset?.icon && !hideIcon ? ( diff --git a/packages/app-explorer/src/systems/Core/components/CodeBlock/CodeBlock.tsx b/packages/app-explorer/src/systems/Core/components/CodeBlock/CodeBlock.tsx index 29f6101db..2626497eb 100644 --- a/packages/app-explorer/src/systems/Core/components/CodeBlock/CodeBlock.tsx +++ b/packages/app-explorer/src/systems/Core/components/CodeBlock/CodeBlock.tsx @@ -3,10 +3,10 @@ import { Box, Button, Card, - ScrollArea, - Text, LoadingBox, LoadingWrapper, + ScrollArea, + Text, } from '@fuels/ui'; import { IconChevronUp } from '@tabler/icons-react'; import type { ReactNode } from 'react'; @@ -42,7 +42,7 @@ export function CodeBlock({ } function getTitle() { - if (title != undefined) return title; + if (title !== undefined) return title; if (type === 'json') return 'JSON'; return 'Code'; } diff --git a/packages/app-explorer/src/systems/Core/components/EmptyCard/EmptyCard.tsx b/packages/app-explorer/src/systems/Core/components/EmptyCard/EmptyCard.tsx index a180cd933..52ac975f5 100644 --- a/packages/app-explorer/src/systems/Core/components/EmptyCard/EmptyCard.tsx +++ b/packages/app-explorer/src/systems/Core/components/EmptyCard/EmptyCard.tsx @@ -1,6 +1,6 @@ 'use client'; import type { CardProps, HeadingProps, TextProps } from '@fuels/ui'; -import { Card, Heading, createComponent, Text, withNamespace } from '@fuels/ui'; +import { Card, Heading, Text, createComponent, withNamespace } from '@fuels/ui'; import { tv } from 'tailwind-variants'; import { ReactComponent as EmptySvg } from './empty.svg'; diff --git a/packages/app-explorer/src/systems/Core/components/Footer/Footer.tsx b/packages/app-explorer/src/systems/Core/components/Footer/Footer.tsx index 959313bba..9a28025b3 100644 --- a/packages/app-explorer/src/systems/Core/components/Footer/Footer.tsx +++ b/packages/app-explorer/src/systems/Core/components/Footer/Footer.tsx @@ -1,21 +1,21 @@ import { Box, Container, - HStack, - VStack, FuelLogo, + HStack, Heading, Icon, Link, List, Text, Theme, + VStack, } from '@fuels/ui'; import type { BaseProps } from '@fuels/ui'; import { - IconBrandTwitter, - IconBrandGithub, IconBrandDiscord, + IconBrandGithub, + IconBrandTwitter, } from '@tabler/icons-react'; import Image from 'next/image'; import { tv } from 'tailwind-variants'; diff --git a/packages/app-explorer/src/systems/Core/components/Layout/Layout.tsx b/packages/app-explorer/src/systems/Core/components/Layout/Layout.tsx index febcb702d..26fc75006 100644 --- a/packages/app-explorer/src/systems/Core/components/Layout/Layout.tsx +++ b/packages/app-explorer/src/systems/Core/components/Layout/Layout.tsx @@ -25,7 +25,7 @@ export function Layout({ children, contentClassName }: LayoutProps) { size="4" className={cx( 'py-8 pb-10 px-6 tablet:px-10 tablet:py-12 tablet:pb-8 laptop:py-16 laptop:pb-18 min-h-[80vh]', - contentClassName + contentClassName, )} > {children} diff --git a/packages/app-explorer/src/systems/Core/components/NavigationTab/NavigationTab.tsx b/packages/app-explorer/src/systems/Core/components/NavigationTab/NavigationTab.tsx index 5cc91dcea..524a783ed 100644 --- a/packages/app-explorer/src/systems/Core/components/NavigationTab/NavigationTab.tsx +++ b/packages/app-explorer/src/systems/Core/components/NavigationTab/NavigationTab.tsx @@ -1,5 +1,5 @@ import { Tabs } from '@fuels/ui'; -import type { TabsProps, IconProps } from '@fuels/ui'; +import type { IconProps, TabsProps } from '@fuels/ui'; import { Fragment } from 'react'; import type { ReactNode } from 'react'; import { tv } from 'tailwind-variants'; diff --git a/packages/app-explorer/src/systems/Core/components/PageTitle/PageTitle.tsx b/packages/app-explorer/src/systems/Core/components/PageTitle/PageTitle.tsx index 8ce617a6a..25895e5f5 100644 --- a/packages/app-explorer/src/systems/Core/components/PageTitle/PageTitle.tsx +++ b/packages/app-explorer/src/systems/Core/components/PageTitle/PageTitle.tsx @@ -1,6 +1,6 @@ 'use client'; import type { BaseProps } from '@fuels/ui'; -import { Heading, Badge, HStack } from '@fuels/ui'; +import { Badge, HStack, Heading } from '@fuels/ui'; import { tv } from 'tailwind-variants'; export type PageTitleProps = BaseProps<{ diff --git a/packages/app-explorer/src/systems/Core/components/Pagination/Pagination.tsx b/packages/app-explorer/src/systems/Core/components/Pagination/Pagination.tsx index 0461c223b..b74020995 100644 --- a/packages/app-explorer/src/systems/Core/components/Pagination/Pagination.tsx +++ b/packages/app-explorer/src/systems/Core/components/Pagination/Pagination.tsx @@ -1,5 +1,5 @@ import type { BaseProps } from '@fuels/ui'; -import { HStack, Button, cx } from '@fuels/ui'; +import { Button, HStack, cx } from '@fuels/ui'; import { IconArrowLeft, IconArrowRight } from '@tabler/icons-react'; type PaginationProps = BaseProps<{ @@ -17,7 +17,7 @@ export function Pagination({ page, onChange, ...props }: PaginationProps) { {...props} className={cx( 'w-full tablet:w-auto grid grid-cols-[auto_1fr_auto]', - props.className + props.className, )} >