Skip to content

Commit

Permalink
chore: use biome 🚀 (#317)
Browse files Browse the repository at this point in the history
* chore: use biome

* chore: use biome
  • Loading branch information
gaboesquivel authored Aug 21, 2024
1 parent e948288 commit 7c30f06
Show file tree
Hide file tree
Showing 832 changed files with 20,112 additions and 50,322 deletions.
9 changes: 0 additions & 9 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/lighthouse/budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
}
]
}
]
]
19 changes: 0 additions & 19 deletions .github/workflows/lint.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
}
}
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,9 @@ Please refer to the [webapp README.md](/apps/webapp/README.md) for more details

### Packages

#### Config ESLint (`/packages/config-eslint`)

This package provides a shared ESLint configuration to ensure consistent coding styles and practices across the project's JavaScript and TypeScript codebases.

#### Config TypeScript (`/packages/config-typescript`)

Similar to `config-eslint`, this package offers a shared TypeScript configuration to standardize TypeScript compilation options across the project.
This package offers a shared TypeScript configuration to standardize TypeScript compilation options across the project.

#### Smartsale Contracts (`/packages/app-contracts`)

Expand Down
2 changes: 1 addition & 1 deletion apps/alchemy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"alchemy-sdk": "^3.4.1",
"dotenv": "^16.4.5"
}
}
}
20 changes: 10 additions & 10 deletions apps/alchemy/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('dotenv').config();
require('dotenv').config()
import { Alchemy, Network, WebhookType } from 'alchemy-sdk'

// authToken is required to use Notify APIs. Found on the top right corner of
Expand All @@ -7,22 +7,22 @@ async function createAddressActivityNotification() {
const settings = {
authToken: process.env.ALCHEMY_NOTIFY_TOKEN,
network: Network.MATIC_MAINNET, // Replace with your network.
};
}

const alchemy = new Alchemy(settings);
const alchemy = new Alchemy(settings)
const addressActivityWebhook = await alchemy.notify.createWebhook(
// TO DO: You will replace this URL in Step #3 of this guide!
// TO DO: You will replace this URL in Step #3 of this guide!
'https://webhook.site/f18c0350-6479-4686-b48a-3d16aa238b7b',
WebhookType.ADDRESS_ACTIVITY,
{
// use any address you want to monitor activity on!
addresses: ['0x6F76670A66e7909Af9B76f0D84E39317FCc0B2e1'],
network: Network.MATIC_MAINNET,
}
);
console.log(
'Alchemy Notify address activity notification created, go to https://dashboard.alchemy.com/notify to see details of your custom hook.'
);
},
)
console.log(
'Alchemy Notify address activity notification created, go to https://dashboard.alchemy.com/notify to see details of your custom hook.',
)
}

createAddressActivityNotification();
createAddressActivityNotification()
18 changes: 0 additions & 18 deletions apps/faucet/.eslintrc.cjs

This file was deleted.

24 changes: 1 addition & 23 deletions apps/faucet/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
This template provides a minimal setup to get React working in Vite with HMR.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname,
},
};
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
2 changes: 1 addition & 1 deletion apps/faucet/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"components": "@/components",
"utils": "@/lib/utils"
}
}
}
8 changes: 1 addition & 7 deletions apps/faucet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
Expand Down Expand Up @@ -36,13 +35,8 @@
"@types/node": "latest",
"@types/react": "18.x",
"@types/react-dom": "18.x",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^9.7.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.9",
"typescript": "^5.5.4",
"vite": "^5.3.4"
}
}
}
12 changes: 6 additions & 6 deletions apps/faucet/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FaucetForm } from "./components/faucet-form";
import { useUsdtBalance } from "./hooks/use-usdt-balance";
import { Button } from "./components/ui/button";
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { ConnectButton } from '@rainbow-me/rainbowkit'
import { FaucetForm } from './components/faucet-form'
import { Button } from './components/ui/button'
import { useUsdtBalance } from './hooks/use-usdt-balance'

export default function Component() {
const balance = useUsdtBalance();
const balance = useUsdtBalance()
return (
<div className="min-h-screen bg-[#f0f0f0]">
<nav className="flex items-center justify-between p-6 bg-white shadow-md">
Expand All @@ -28,5 +28,5 @@ export default function Component() {
</div>
</main>
</div>
);
)
}
33 changes: 16 additions & 17 deletions apps/faucet/src/components/add-token-to-metamask.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EVMTokenContractData } from "app-contracts";
import { useSwitchChain } from "wagmi";
import { Button } from "./ui/button";
import type { EVMTokenContractData } from 'app-contracts'
import { useSwitchChain } from 'wagmi'
import { Button } from './ui/button'

export function AddTokenToWallet({
address,
Expand All @@ -10,31 +10,31 @@ export function AddTokenToWallet({
name,
chainId,
}: EVMTokenContractData) {
const { switchChain } = useSwitchChain();
const { switchChain } = useSwitchChain()
// console.log({ address, symbol, decimals, image, name })
const addTokenToMetaMask = async () => {
try {
if (!window.ethereum && !window.ethereum.isMetaMask)
alert("MetaMask is not installed");
if (chainId) await switchChain({ chainId });
alert('MetaMask is not installed')
if (chainId) await switchChain({ chainId })
await window.ethereum.request({
method: "wallet_watchAsset",
method: 'wallet_watchAsset',
params: {
type: "ERC20",
type: 'ERC20',
options: {
address,
symbol,
decimals,
image,
},
},
});
alert("Token added to MetaMask");
})
alert('Token added to MetaMask')
} catch (error) {
console.error("Error adding token to MetaMask", error);
alert("Error adding token to MetaMask");
console.error('Error adding token to MetaMask', error)
alert('Error adding token to MetaMask')
}
};
}

return (
<Button
Expand All @@ -43,12 +43,11 @@ export function AddTokenToWallet({
>
Add {name} to MetaMask
</Button>
);
)
}

interface CustomWindow extends Window {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ethereum?: any;
ethereum?: any
}

declare let window: CustomWindow;
declare let window: CustomWindow
21 changes: 10 additions & 11 deletions apps/faucet/src/components/connect-metamask.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
"use client";
import { useConnect, useConnectors } from "wagmi";
import { Button } from "./ui/button";
'use client'
import { useConnect, useConnectors } from 'wagmi'
import { Button } from './ui/button'

export function ConnectWalletButton() {
const connectors = useConnectors();
const { connect } = useConnect();
const connectors = useConnectors()
const { connect } = useConnect()

const handleConnect = async () => {
// Find the WalletConnect connector
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const injectedConnector = connectors.find(
(connector) => connector.id === "injected",
);
(connector) => connector.id === 'injected',
)
if (injectedConnector) {
await connect({ connector: injectedConnector });
await connect({ connector: injectedConnector })
}
};
}

return (
<div>
Expand All @@ -24,5 +23,5 @@ export function ConnectWalletButton() {
</Button>
{/* {error && <p style={{ color: 'red' }}>{error.message}</p>} */}
</div>
);
)
}
21 changes: 10 additions & 11 deletions apps/faucet/src/components/connect-walletconnect.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
"use client";
import { useConnect, useConnectors } from "wagmi";
import { Button } from "./ui/button";
'use client'
import { useConnect, useConnectors } from 'wagmi'
import { Button } from './ui/button'

export function ConnectWalletButton() {
const connectors = useConnectors();
const { connect } = useConnect();
const connectors = useConnectors()
const { connect } = useConnect()

const handleConnect = async () => {
// Find the WalletConnect connector
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const walletConnectConnector = connectors.find(
(connector) => connector.id === "walletConnect",
);
(connector) => connector.id === 'walletConnect',
)
if (walletConnectConnector) {
await connect({ connector: walletConnectConnector });
await connect({ connector: walletConnectConnector })
}
};
}

return (
<div>
Expand All @@ -24,5 +23,5 @@ export function ConnectWalletButton() {
</Button>
{/* {error && <p style={{ color: 'red' }}>{error.message}</p>} */}
</div>
);
)
}
Loading

0 comments on commit 7c30f06

Please sign in to comment.