Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sort imports #802

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'jest-extended';
// Enable jest-dom functions
import '@testing-library/jest-dom';
// biome-ignore lint: Running linting with `unsafe` flag changes import to 'node:util' which breaks the CI. See https://nodejs.org/docs/latest-v18.x/api/util.html
import { TextEncoder, TextDecoder } from 'util';
import { TextDecoder, TextEncoder } from 'util';

global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder as typeof global.TextDecoder;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "packemon build --addEngines --addFiles --declaration && npx packemon validate --no-license --no-people --no-repo && tailwindcss -i ./src/styles/index.css -o ./src/tailwind.css --minify && tailwindcss -i ./src/styles/index-with-tailwind.css -o ./src/styles.css --minify",
"ci:format": "biome ci --linter-enabled=false --organize-imports-enabled=false",
"ci:lint": "biome ci --formatter-enabled=false --organize-imports-enabled=false",
"check": "biome check --write .",
"format": "biome format --write .",
"lint": "biome lint --write .",
"lint:unsafe": "biome lint --write --unsafe .",
Expand Down
4 changes: 2 additions & 2 deletions site/docs/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import { OnchainKitProvider } from '@coinbase/onchainkit';
// import { OnchainKitProvider } from '../../../src';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { WagmiProvider, createConfig, http } from 'wagmi';
import type { ReactNode } from 'react';
import { http, WagmiProvider, createConfig } from 'wagmi';
import { base } from 'wagmi/chains';
import { coinbaseWallet } from 'wagmi/connectors';
import type { ReactNode } from 'react';

import '@coinbase/onchainkit/styles.css';
// import '../../../src/styles.css';
Expand Down
4 changes: 2 additions & 2 deletions site/docs/components/AppWithRK.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import {
getDefaultConfig,
} from '@rainbow-me/rainbowkit';
import {
coinbaseWallet,
metaMaskWallet,
rainbowWallet,
coinbaseWallet,
} from '@rainbow-me/rainbowkit/wallets';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import type { ReactNode } from 'react';
import { WagmiProvider } from 'wagmi';
import { base } from 'wagmi/chains';
import type { ReactNode } from 'react';

import '@coinbase/onchainkit/styles.css';
// import '../../../src/styles.css';
Expand Down
2 changes: 1 addition & 1 deletion site/docs/components/SwapAmountInputContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type ReactElement, useState } from 'react';
import type { Token } from '@coinbase/onchainkit/token';
import { type ReactElement, useState } from 'react';

type SwapAmountInputContainer = {
children: (
Expand Down
4 changes: 2 additions & 2 deletions site/docs/components/SwapWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';
import { useCallback, type ReactNode } from 'react';
import { useAccount } from 'wagmi';
import type { BuildSwapTransaction } from '@coinbase/onchainkit/swap';
import type { Token } from '@coinbase/onchainkit/token';
import { type ReactNode, useCallback } from 'react';
import type { Address } from 'viem';
import { useAccount } from 'wagmi';

type SwapComponentsChildren = {
address: Address | undefined;
Expand Down
4 changes: 2 additions & 2 deletions site/docs/components/TokenSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useState } from 'react';
import { TokenSearch, TokenChip, TokenRow } from '@coinbase/onchainkit/token';
import { TokenChip, TokenRow, TokenSearch } from '@coinbase/onchainkit/token';
import type { Token } from '@coinbase/onchainkit/token';
import { useCallback, useState } from 'react';

const tokens: Token[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion site/docs/components/TokenSelectorContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type ReactElement, useState } from 'react';
import type { Token } from '@coinbase/onchainkit/token';
import { type ReactElement, useState } from 'react';

type TokenSelectorContainer = {
children: (token: Token, setToken: (t: Token) => void) => ReactElement;
Expand Down
2 changes: 1 addition & 1 deletion site/docs/components/WalletComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';
import App from './App.tsx';
import type { ReactNode } from 'react';
import App from './App.tsx';

type WalletComponentsReact = {
children: ReactNode;
Expand Down
6 changes: 3 additions & 3 deletions src/OnchainKitProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { base } from 'viem/chains';
import { render, screen, waitFor } from '@testing-library/react';
import { base } from 'viem/chains';
import '@testing-library/jest-dom';

import type { EASSchemaUid } from './identity/types';
import { describe, expect, it, vi } from 'vitest';
import { setOnchainKitConfig } from './OnchainKitConfig';
import { OnchainKitProvider } from './OnchainKitProvider';
import type { EASSchemaUid } from './identity/types';
import { useOnchainKit } from './useOnchainKit';
import { describe, expect, it, vi } from 'vitest';

const TestComponent = () => {
const { schemaId, apiKey } = useOnchainKit();
Expand Down
2 changes: 1 addition & 1 deletion src/OnchainKitProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createContext, useMemo } from 'react';
import { checkHashLength } from './utils/checkHashLength';
import { ONCHAIN_KIT_CONFIG, setOnchainKitConfig } from './OnchainKitConfig';
import type { OnchainKitContextType, OnchainKitProviderReact } from './types';
import { checkHashLength } from './utils/checkHashLength';

export const OnchainKitContext =
createContext<OnchainKitContextType>(ONCHAIN_KIT_CONFIG);
Expand Down
2 changes: 1 addition & 1 deletion src/farcaster/getFarcasterUserAddress.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getFarcasterUserAddress } from './getFarcasterUserAddress';
import { getCustodyAddressForFidNeynar } from '../utils/neynar/user/getCustodyAddressForFidNeynar';
import { getVerifiedAddressesForFidNeynar } from '../utils/neynar/user/getVerifiedAddressesForFidNeynar';
import { getFarcasterUserAddress } from './getFarcasterUserAddress';

vi.mock('../utils/neynar/user/getCustodyAddressForFidNeynar');
vi.mock('../utils/neynar/user/getVerifiedAddressesForFidNeynar');
Expand Down
2 changes: 1 addition & 1 deletion src/frame/components/FrameMetadata.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { FrameMetadata } from './FrameMetadata';
import { describe, it, expect } from 'vitest';

describe('FrameMetadata', () => {
it('renders', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/frame/getFrameHtmlResponse.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getFrameHtmlResponse } from './getFrameHtmlResponse';
import { describe, expect, it } from 'vitest';
import { getFrameHtmlResponse } from './getFrameHtmlResponse';

describe('getFrameHtmlResponse', () => {
it('should return correct HTML with all parameters', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/frame/getFrameMessage.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Address } from 'viem';
import { type Mock, describe, expect, it, vi } from 'vitest';
import { neynarFrameValidation } from '../utils/neynar/frame/neynarFrameValidation';
import { neynarBulkUserLookup } from '../utils/neynar/user/neynarBulkUserLookup';
import { getFrameMessage } from './getFrameMessage';
import { getMockFrameRequest } from './getMockFrameRequest';
import { neynarBulkUserLookup } from '../utils/neynar/user/neynarBulkUserLookup';
import type { FrameRequest } from './types';
import { neynarFrameValidation } from '../utils/neynar/frame/neynarFrameValidation';
import { describe, expect, it, vi, type Mock } from 'vitest';

vi.mock('../utils/neynar/user/neynarBulkUserLookup', () => {
return {
Expand Down
8 changes: 4 additions & 4 deletions src/frame/getFrameMessage.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
NEYNAR_DEFAULT_API_KEY,
neynarFrameValidation,
} from '../utils/neynar/frame/neynarFrameValidation';
import type {
FrameRequest,
FrameValidationResponse,
MockFrameRequest,
} from './types';
import {
NEYNAR_DEFAULT_API_KEY,
neynarFrameValidation,
} from '../utils/neynar/frame/neynarFrameValidation';

type FrameMessageOptions =
| {
Expand Down
2 changes: 1 addition & 1 deletion src/frame/getFrameMetadata.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getFrameMetadata } from './getFrameMetadata';
import { describe, expect, it } from 'vitest';
import { getFrameMetadata } from './getFrameMetadata';

describe('getFrameMetadata', () => {
it('should return the correct metadata', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/Address.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { vi } from 'vitest';
import '@testing-library/jest-dom';
import { getSlicedAddress } from '../getSlicedAddress';
import { Address } from './Address';
import { useIdentityContext } from './IdentityProvider';
import { getSlicedAddress } from '../getSlicedAddress';

function mock<T>(func: T) {
return func as vi.Mock;
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/Address.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useIdentityContext } from './IdentityProvider';
import { getSlicedAddress } from '../getSlicedAddress';
import { cn, text } from '../../styles/theme';
import { getSlicedAddress } from '../getSlicedAddress';
import type { AddressReact } from '../types';
import { useIdentityContext } from './IdentityProvider';

export function Address({
address = null,
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Meta, StoryObj } from '@storybook/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { base } from 'viem/chains';
import { OnchainKitProvider } from '../../OnchainKitProvider';
import { Avatar } from './Avatar';
import { Badge } from './Badge';
import { OnchainKitProvider } from '../../OnchainKitProvider';
import { base } from 'viem/chains';

const meta = {
title: 'Identity/Avatar',
Expand Down
2 changes: 1 addition & 1 deletion src/identity/components/Avatar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { vi } from 'vitest';
import '@testing-library/jest-dom';
import { render, screen, waitFor } from '@testing-library/react';
import { useOnchainKit } from '../../useOnchainKit';
import { useName } from '../hooks/useName';
import { useAttestations } from '../hooks/useAttestations';
import { useAvatar } from '../hooks/useAvatar';
import { useName } from '../hooks/useName';
import { Avatar } from './Avatar';
import { Badge } from './Badge';
import { useIdentityContext } from './IdentityProvider';
Expand Down
8 changes: 4 additions & 4 deletions src/identity/components/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useMemo, Children } from 'react';
import { useIdentityContext } from './IdentityProvider';
import { Children, useMemo } from 'react';
import { cn } from '../../styles/theme';
import { useAvatar } from '../hooks/useAvatar';
import { useName } from '../hooks/useName';
import type { AvatarReact } from '../types';
import { cn } from '../../styles/theme';
import { DisplayBadge } from './DisplayBadge';
import { Badge } from './Badge';
import { DisplayBadge } from './DisplayBadge';
import { useIdentityContext } from './IdentityProvider';
import { defaultAvatarSVG } from './defaultAvatarSVG';
import { defaultLoadingSVG } from './defaultLoadingSVG';

Expand Down
2 changes: 1 addition & 1 deletion src/identity/components/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BadgeReact } from '../types';
import { background, cn, fill } from '../../styles/theme';
import type { BadgeReact } from '../types';

/**
* Badge component.
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/DisplayBadge.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/react';
import { DisplayBadge } from './DisplayBadge';
import { Badge } from './Badge';
import { useOnchainKit } from '../../useOnchainKit';
import { useAttestations } from '../hooks/useAttestations';
import { Badge } from './Badge';
import { DisplayBadge } from './DisplayBadge';
import { useIdentityContext } from './IdentityProvider';

function mock<T>(func: T) {
Expand Down
2 changes: 1 addition & 1 deletion src/identity/components/DisplayBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Address } from 'viem';
import type { ReactNode } from 'react';
import type { Address } from 'viem';
import { useOnchainKit } from '../../useOnchainKit';
import { useAttestations } from '../hooks/useAttestations';
import { useIdentityContext } from './IdentityProvider';
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/EthBalance.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Meta, StoryObj } from '@storybook/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { EthBalance } from './EthBalance';
import { WagmiProvider, createConfig, http } from 'wagmi';
import { baseSepolia } from 'viem/chains';
import { http, WagmiProvider, createConfig } from 'wagmi';
import { EthBalance } from './EthBalance';

const wagmiConfig = createConfig({
chains: [baseSepolia],
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/EthBalance.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { vi } from 'vitest';
import { getRoundedAmount } from '../../utils/getRoundedAmount';
import { useGetETHBalance } from '../../wallet/core/useGetETHBalance';
import { EthBalance } from './EthBalance';
import { useIdentityContext } from './IdentityProvider';
import { useGetETHBalance } from '../../wallet/core/useGetETHBalance';
import { getRoundedAmount } from '../../utils/getRoundedAmount';

function mock<T>(func: T) {
return func as vi.Mock;
Expand Down
6 changes: 3 additions & 3 deletions src/identity/components/EthBalance.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useIdentityContext } from './IdentityProvider';
import { cn, color, text } from '../../styles/theme';
import type { EthBalanceReact } from '../types';
import { useGetETHBalance } from '../../wallet/core/useGetETHBalance';
import { getRoundedAmount } from '../../utils/getRoundedAmount';
import { useGetETHBalance } from '../../wallet/core/useGetETHBalance';
import type { EthBalanceReact } from '../types';
import { useIdentityContext } from './IdentityProvider';
export function EthBalance({ address, className }: EthBalanceReact) {
const { address: contextAddress } = useIdentityContext();
if (!contextAddress && !address) {
Expand Down
10 changes: 5 additions & 5 deletions src/identity/components/Identity.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { vi } from 'vitest';
import '@testing-library/jest-dom';
import { render, screen, waitFor } from '@testing-library/react';
import { Avatar } from './Avatar';
import { Name } from './Name';
import { Identity } from './Identity';
import { useName } from '../hooks/useName';
import { useAvatar } from '../hooks/useAvatar';
import { useGetETHBalance } from '../../wallet/core/useGetETHBalance';
import { useAvatar } from '../hooks/useAvatar';
import { useName } from '../hooks/useName';
import { Address } from './Address';
import { Avatar } from './Avatar';
import { EthBalance } from './EthBalance';
import { Identity } from './Identity';
import { Name } from './Name';

function mock<T>(func: T) {
return func as vi.Mock;
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/Identity.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback } from 'react';
import { IdentityLayout } from './IdentityLayout';
import { IdentityProvider } from './IdentityProvider';
import { useOnchainKit } from '../../useOnchainKit';
import type { IdentityReact } from '../types';
import { IdentityLayout } from './IdentityLayout';
import { IdentityProvider } from './IdentityProvider';

export function Identity({
address,
Expand Down
8 changes: 4 additions & 4 deletions src/identity/components/IdentityLayout.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import '@testing-library/jest-dom';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { IdentityLayout } from './IdentityLayout';
import { Avatar } from './Avatar';
import { Name } from './Name';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { Address } from './Address';
import { Avatar } from './Avatar';
import { EthBalance } from './EthBalance';
import { IdentityLayout } from './IdentityLayout';
import { Name } from './Name';

const handleCopy = vi.fn().mockResolvedValue(true);

Expand Down
8 changes: 4 additions & 4 deletions src/identity/components/IdentityLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Children, useMemo, useCallback, useState, useEffect } from 'react';
import { Children, useCallback, useEffect, useMemo, useState } from 'react';
import type { ReactNode } from 'react';
import { findComponent } from '../../internal/utils/findComponent';
import { background, cn, color, pressable } from '../../styles/theme';
import { Address } from './Address';
import { Avatar } from './Avatar';
import { EthBalance } from './EthBalance';
import { Name } from './Name';
import { findComponent } from '../../internal/utils/findComponent';
import { background, cn, color, pressable } from '../../styles/theme';
import type { ReactNode } from 'react';

// istanbul ignore next
const noop = () => {};
Expand Down
2 changes: 1 addition & 1 deletion src/identity/components/IdentityProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import '@testing-library/jest-dom';
import { renderHook } from '@testing-library/react';
import type { Address, Chain } from 'viem';
import { IdentityProvider, useIdentityContext } from './IdentityProvider';
import { baseSepolia, optimism, sepolia } from 'viem/chains';
import { OnchainKitProvider } from '../../OnchainKitProvider';
import { IdentityProvider, useIdentityContext } from './IdentityProvider';

describe('IdentityProvider', () => {
it('provides context values from props', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/IdentityProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState, createContext, useContext } from 'react';
import { createContext, useContext, useState } from 'react';
import type { Address } from 'viem';
import { useValue } from '../../internal/hooks/useValue';
import type { IdentityContextType, IdentityProviderReact } from '../types';
import { useOnchainKit } from '../../useOnchainKit';
import type { IdentityContextType, IdentityProviderReact } from '../types';

const emptyContext = {} as IdentityContextType;

Expand Down
2 changes: 1 addition & 1 deletion src/identity/components/Name.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { Name } from './Name';
import { baseSepolia, optimism } from 'viem/chains';
import { Name } from './Name';

const meta = {
title: 'Identity/Name',
Expand Down
Loading
Loading