From 5eff6011d808b7d607a272eec5401bec1e1013d5 Mon Sep 17 00:00:00 2001 From: Maximilian Schneider Date: Tue, 27 Apr 2021 12:28:04 +0300 Subject: [PATCH] satisfy linting errors --- components/Balances.tsx | 2 +- components/TopBar.tsx | 4 ---- hooks/useWallet.tsx | 2 -- stores/useNotificationStore.tsx | 2 +- stores/useWalletStore.tsx | 5 ++--- test/pages/index.test.tsx | 4 ++-- utils/tokens.tsx | 2 +- utils/wallet-adapters/sollet-extension.ts | 4 +++- 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/components/Balances.tsx b/components/Balances.tsx index 9b06d21..daea26f 100644 --- a/components/Balances.tsx +++ b/components/Balances.tsx @@ -3,7 +3,7 @@ import BN from 'bn.js' import useWalletStore from '../stores/useWalletStore' const Balances = () => { - var { tokenAccounts, mints } = useWalletStore((state) => state) + const { tokenAccounts, mints } = useWalletStore((state) => state) function fixedPointToNumber(value: BN, decimals: number) { const divisor = new BN(10).pow(new BN(decimals)) diff --git a/components/TopBar.tsx b/components/TopBar.tsx index 0741226..c2eaf7b 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -6,10 +6,7 @@ import { ChevronDownIcon, DuplicateIcon, LogoutIcon, - MenuIcon, - XIcon, } from '@heroicons/react/outline' -import { useRouter } from 'next/router' import ConnectWalletButton from './ConnectWalletButton' import WalletIcon from './WalletIcon' import useWalletStore from '../stores/useWalletStore' @@ -27,7 +24,6 @@ const WALLET_OPTIONS = [ ] const TopBar = () => { - const { asPath } = useRouter() const { connected, current: wallet } = useWalletStore((s) => s) const [isCopied, setIsCopied] = useState(false) diff --git a/hooks/useWallet.tsx b/hooks/useWallet.tsx index bc6d0d9..6948ffb 100644 --- a/hooks/useWallet.tsx +++ b/hooks/useWallet.tsx @@ -56,7 +56,6 @@ export default function useWallet() { ) useEffect(() => { - console.log('provider url changed', selectedProviderUrl) if (selectedProviderUrl) { setSavedProviderUrl(selectedProviderUrl) } @@ -66,7 +65,6 @@ export default function useWallet() { if (provider) { const updateWallet = () => { // hack to also update wallet synchronously in case it disconnects - // eslint-disable-next-line react-hooks/exhaustive-deps const wallet = new (provider.adapter || Wallet)( savedProviderUrl, endpoint diff --git a/stores/useNotificationStore.tsx b/stores/useNotificationStore.tsx index 8681d19..d7535eb 100644 --- a/stores/useNotificationStore.tsx +++ b/stores/useNotificationStore.tsx @@ -11,7 +11,7 @@ interface NotificationStore extends State { set: (x: any) => void } -const useNotificationStore = create((set, get) => ({ +const useNotificationStore = create((set, _get) => ({ notifications: [], set: (fn) => set(produce(fn)), })) diff --git a/stores/useWalletStore.tsx b/stores/useWalletStore.tsx index c7f4c61..107c85d 100644 --- a/stores/useWalletStore.tsx +++ b/stores/useWalletStore.tsx @@ -1,6 +1,6 @@ import create, { State } from 'zustand' import produce from 'immer' -import { Connection, PublicKey } from '@solana/web3.js' +import { Connection } from '@solana/web3.js' import { EndpointInfo, WalletAdapter } from '../@types/types' import { @@ -84,11 +84,10 @@ const useWalletStore = create((set, get) => ({ const connection = get().connection.current const connected = get().connected const tokenAccounts = get().tokenAccounts - const mints = get().mints const set = get().set if (connected) { - var fetchMints = tokenAccounts.map((a) => + const fetchMints = tokenAccounts.map((a) => getMint(connection, a.account.mint) ) const mintResults = await Promise.all(fetchMints) diff --git a/test/pages/index.test.tsx b/test/pages/index.test.tsx index cdd96fb..12f33d5 100644 --- a/test/pages/index.test.tsx +++ b/test/pages/index.test.tsx @@ -1,10 +1,10 @@ import React from 'react' -import { render, fireEvent } from '../testUtils' +import { render } from '../testUtils' import Home from '../../pages/index' describe('Home page', () => { it('renders', () => { - const { asFragment } = render(, {}) + render(, {}) expect(true).toBe(true) }) }) diff --git a/utils/tokens.tsx b/utils/tokens.tsx index b0a5dba..ab40271 100644 --- a/utils/tokens.tsx +++ b/utils/tokens.tsx @@ -1,4 +1,4 @@ -import { Connection, ParsedAccountData, PublicKey } from '@solana/web3.js' +import { Connection, PublicKey } from '@solana/web3.js' import { AccountInfo, AccountLayout, diff --git a/utils/wallet-adapters/sollet-extension.ts b/utils/wallet-adapters/sollet-extension.ts index cc2dd3f..2adf22b 100644 --- a/utils/wallet-adapters/sollet-extension.ts +++ b/utils/wallet-adapters/sollet-extension.ts @@ -8,7 +8,9 @@ export function SolletExtensionAdapter(_, network) { } return { - on: () => {}, + on: () => { + /* do nothing */ + }, connect: () => { notify({ message: 'Sollet Extension Error',