Skip to content

Commit a9ecbb0

Browse files
committed
fix: eslint warnings & errors
1 parent 3f5f8c6 commit a9ecbb0

27 files changed

+94
-49
lines changed

eslint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,10 @@ export default tseslint.config(
6060
projectService: true
6161
}
6262
}
63+
},
64+
{
65+
rules: {
66+
'unicorn/no-null': 'off'
67+
}
6368
}
6469
);

src/app/layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import '../styles/globals.scss';
44
import React from 'react';
55

66
import type { Metadata, Viewport } from 'next';
7+
import type { PropsWithChildren } from 'react';
78

89
import config from '_config';
910
import { Analytics } from '@vercel/analytics/react';
@@ -27,7 +28,9 @@ export const viewport: Viewport = {
2728
themeColor: '#000'
2829
};
2930

30-
export default function RootLayout({ children }: { children: React.ReactNode }) {
31+
type TRootLayout = PropsWithChildren;
32+
33+
export default function RootLayout({ children }: Readonly<TRootLayout>) {
3134
return (
3235
<html lang='en' suppressHydrationWarning>
3336
<body>

src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22

33
import Counter from '@/components/counter';
44

5-
export default function Home() {
5+
export default function HomePage() {
66
return (
77
<main className='flex h-full w-full flex-col items-center justify-center'>
88
<Counter />

src/components/counter.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export default function Counter() {
1818
<Button
1919
className='w-10 rounded-full'
2020
data-testid='increase-count'
21-
onPress={() => setCount((previousCount) => previousCount + 1)}
21+
onPress={() => {
22+
setCount((previousCount) => previousCount + 1);
23+
}}
2224
>
2325
+ 1
2426
</Button>
@@ -30,7 +32,9 @@ export default function Counter() {
3032
<Button
3133
className='w-10 rounded-full'
3234
data-testid='decrease-count'
33-
onPress={() => setCount((previousCount) => previousCount - 1)}
35+
onPress={() => {
36+
setCount((previousCount) => previousCount - 1);
37+
}}
3438
>
3539
- 1
3640
</Button>

src/components/github-corner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface IGithubCorner {
77
url: string;
88
}
99

10-
export default function GithubCorner({ title, url }: IGithubCorner) {
10+
export default function GithubCorner({ title, url }: Readonly<IGithubCorner>) {
1111
return (
1212
<Link title={title} aria-label={title} href={url} className='github-corner'>
1313
<svg

src/components/hoc/with-supported-chains.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import SwitchChainDialogContent from '../switch-chain/dialog-content';
1111

1212
type TWithSupportedChains = PropsWithChildren;
1313

14-
export default function WithSupportedChains({ children }: TWithSupportedChains) {
14+
export default function WithSupportedChains({ children }: Readonly<TWithSupportedChains>) {
1515
const [isSwitchChainDialogOpen, setIsSwitchChainDialogOpen] = useState(false);
1616

1717
const {

src/components/providers/client/hero-ui.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ import { HeroUIProvider } from '@heroui/system';
88

99
type THeroUiProvider = PropsWithChildren;
1010

11-
export default function HeroUiProvider({ children }: THeroUiProvider) {
11+
export default function HeroUiProvider({ children }: Readonly<THeroUiProvider>) {
1212
return <HeroUIProvider>{children}</HeroUIProvider>;
1313
}

src/components/providers/client/theme.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { ThemeProvider as NextThemesProvider } from 'next-themes';
88

99
import EStorageKeys from '@/lib/constants/keys';
1010

11-
export default function ThemeProvider({ children, ...properties }: ThemeProviderProps) {
11+
export default function ThemeProvider({ children, ...properties }: Readonly<ThemeProviderProps>) {
1212
return (
1313
<NextThemesProvider
1414
attribute='class'

src/components/providers/client/web3.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const queryClient = new QueryClient();
4141

4242
type TWeb3Provider = PropsWithChildren;
4343

44-
export default function Web3Provider({ children }: TWeb3Provider) {
44+
export default function Web3Provider({ children }: Readonly<TWeb3Provider>) {
4545
const { resolvedTheme } = useTheme();
4646
const isDarkTheme = useMemo(() => resolvedTheme === 'dark', [resolvedTheme]);
4747

src/components/providers/root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Web3Provider from './client/web3';
88

99
type TRootProvider = PropsWithChildren;
1010

11-
export default function RootProvider({ children }: TRootProvider) {
11+
export default function RootProvider({ children }: Readonly<TRootProvider>) {
1212
return (
1313
<HeroUiProvider>
1414
<ThemeProvider>

src/components/switch-chain/chains-list.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable sonarjs/no-nested-conditional */
2+
13
'use client';
24

35
import React from 'react';
@@ -24,7 +26,7 @@ export default function ChainsList({
2426
isSwitchError,
2527
chainsList,
2628
onSwitchChain
27-
}: TChainsList) {
29+
}: Readonly<TChainsList>) {
2830
return (
2931
<div className='flex flex-col gap-y-1.5'>
3032
<h3>{title}</h3>

src/components/switch-chain/dialog-content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function SwitchChainDialogContent({
2828
testnetChains,
2929
description,
3030
onSwitchChain
31-
}: TSwitchChainDialogContent) {
31+
}: Readonly<TSwitchChainDialogContent>) {
3232
if (!activeChainId) {
3333
return null;
3434
}

src/components/ui/card.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable react/prop-types */
2-
31
import * as React from 'react';
42

53
import { cn } from '@/lib/utils';
@@ -28,7 +26,6 @@ CardHeader.displayName = 'CardHeader';
2826

2927
const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
3028
({ className, ...properties }, reference) => (
31-
// eslint-disable-next-line jsx-a11y/heading-has-content
3229
<h3
3330
ref={reference}
3431
className={cn('text-2xl font-semibold leading-none tracking-tight', className)}

src/components/ui/dialog.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable unicorn/prevent-abbreviations */
2-
/* eslint-disable react/prop-types */
32

43
'use client';
54

@@ -19,7 +18,7 @@ const DialogPortal = DialogPrimitive.Portal;
1918
const DialogClose = DialogPrimitive.Close;
2019

2120
const DialogOverlay = React.forwardRef<
22-
React.ElementRef<typeof DialogPrimitive.Overlay>,
21+
React.ComponentRef<typeof DialogPrimitive.Overlay>,
2322
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
2423
>(({ className, ...props }, ref) => (
2524
<DialogPrimitive.Overlay
@@ -34,7 +33,7 @@ const DialogOverlay = React.forwardRef<
3433
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
3534

3635
const DialogContent = React.forwardRef<
37-
React.ElementRef<typeof DialogPrimitive.Content>,
36+
React.ComponentRef<typeof DialogPrimitive.Content>,
3837
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
3938
hideCloseButton?: boolean;
4039
}
@@ -76,7 +75,7 @@ const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivEleme
7675
DialogFooter.displayName = 'DialogFooter';
7776

7877
const DialogTitle = React.forwardRef<
79-
React.ElementRef<typeof DialogPrimitive.Title>,
78+
React.ComponentRef<typeof DialogPrimitive.Title>,
8079
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
8180
>(({ className, ...props }, ref) => (
8281
<DialogPrimitive.Title
@@ -88,7 +87,7 @@ const DialogTitle = React.forwardRef<
8887
DialogTitle.displayName = DialogPrimitive.Title.displayName;
8988

9089
const DialogDescription = React.forwardRef<
91-
React.ElementRef<typeof DialogPrimitive.Description>,
90+
React.ComponentRef<typeof DialogPrimitive.Description>,
9291
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
9392
>(({ className, ...props }, ref) => (
9493
<DialogPrimitive.Description

src/components/ui/dropdown-menu.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable unicorn/prevent-abbreviations */
2-
/* eslint-disable react/prop-types */
32

43
'use client';
54

@@ -23,7 +22,7 @@ const DropdownMenuSub = DropdownMenuPrimitive.Sub;
2322
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
2423

2524
const DropdownMenuSubTrigger = React.forwardRef<
26-
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
25+
React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,
2726
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
2827
inset?: boolean;
2928
}
@@ -44,7 +43,7 @@ const DropdownMenuSubTrigger = React.forwardRef<
4443
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
4544

4645
const DropdownMenuSubContent = React.forwardRef<
47-
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
46+
React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,
4847
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
4948
>(({ className, ...props }, ref) => (
5049
<DropdownMenuPrimitive.SubContent
@@ -59,7 +58,7 @@ const DropdownMenuSubContent = React.forwardRef<
5958
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
6059

6160
const DropdownMenuContent = React.forwardRef<
62-
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
61+
React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
6362
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
6463
>(({ className, sideOffset = 4, ...props }, ref) => (
6564
<DropdownMenuPrimitive.Portal>
@@ -77,7 +76,7 @@ const DropdownMenuContent = React.forwardRef<
7776
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
7877

7978
const DropdownMenuItem = React.forwardRef<
80-
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
79+
React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
8180
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
8281
inset?: boolean;
8382
}
@@ -95,7 +94,7 @@ const DropdownMenuItem = React.forwardRef<
9594
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
9695

9796
const DropdownMenuCheckboxItem = React.forwardRef<
98-
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
97+
React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,
9998
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
10099
>(({ className, children, checked, ...props }, ref) => (
101100
<DropdownMenuPrimitive.CheckboxItem
@@ -118,7 +117,7 @@ const DropdownMenuCheckboxItem = React.forwardRef<
118117
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
119118

120119
const DropdownMenuRadioItem = React.forwardRef<
121-
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
120+
React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,
122121
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
123122
>(({ className, children, ...props }, ref) => (
124123
<DropdownMenuPrimitive.RadioItem
@@ -140,7 +139,7 @@ const DropdownMenuRadioItem = React.forwardRef<
140139
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
141140

142141
const DropdownMenuLabel = React.forwardRef<
143-
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
142+
React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
144143
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
145144
inset?: boolean;
146145
}
@@ -154,7 +153,7 @@ const DropdownMenuLabel = React.forwardRef<
154153
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
155154

156155
const DropdownMenuSeparator = React.forwardRef<
157-
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
156+
React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
158157
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
159158
>(({ className, ...props }, ref) => (
160159
<DropdownMenuPrimitive.Separator

src/components/ui/theme-toggle.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export default function ThemeToggle() {
2626
data-testid='theme-toggle'
2727
variant='bordered'
2828
isIconOnly
29-
onPress={() => setIsDropdownOpen((previousState) => !previousState)}
29+
onPress={() => {
30+
setIsDropdownOpen((previousState) => !previousState);
31+
}}
3032
>
3133
<Sun className='h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0' />
3234
<MoonStar className='absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100' />
@@ -36,15 +38,30 @@ export default function ThemeToggle() {
3638
<DropdownMenuContent data-testid='theme-dropdown-content'>
3739
<DropdownMenuLabel>Select theme</DropdownMenuLabel>
3840
<DropdownMenuSeparator />
39-
<DropdownMenuItem data-testid='theme-light' onClick={() => setTheme('light')}>
41+
<DropdownMenuItem
42+
data-testid='theme-light'
43+
onClick={() => {
44+
setTheme('light');
45+
}}
46+
>
4047
<Sun className='mr-2 h-[1.2rem] w-[1.2rem]' />
4148
Light
4249
</DropdownMenuItem>
43-
<DropdownMenuItem data-testid='theme-dark' onClick={() => setTheme('dark')}>
50+
<DropdownMenuItem
51+
data-testid='theme-dark'
52+
onClick={() => {
53+
setTheme('dark');
54+
}}
55+
>
4456
<MoonStar className='mr-2 h-[1.2rem] w-[1.2rem]' />
4557
Dark
4658
</DropdownMenuItem>
47-
<DropdownMenuItem data-testid='theme-system' onClick={() => setTheme('system')}>
59+
<DropdownMenuItem
60+
data-testid='theme-system'
61+
onClick={() => {
62+
setTheme('system');
63+
}}
64+
>
4865
<Laptop className='mr-2 h-[1.2rem] w-[1.2rem]' />
4966
System
5067
</DropdownMenuItem>

src/components/wallet/dropdown/actions/copy-address.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type TCopyAddress = {
1616
address: Address | undefined;
1717
};
1818

19-
export default function CopyAddress({ address }: TCopyAddress) {
19+
export default function CopyAddress({ address }: Readonly<TCopyAddress>) {
2020
const { isClipboardApiSupported, copyToClipboard } = useCopyToClipboard();
2121

2222
const onCopyAddressClick = useCallback(() => {

src/components/wallet/dropdown/actions/dialog/qrcode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function QRCodeDialog({
2525
address,
2626
onDropdownSelect,
2727
onDialogOpenChange
28-
}: TQRCodeDialog) {
28+
}: Readonly<TQRCodeDialog>) {
2929
const [base64QRCode, setBase64QRCode] = useState<string | null>(null);
3030

3131
useEffect(() => {

src/components/wallet/dropdown/actions/dialog/switch-chain.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function SwitchChainDialog({
2222
setIsDropdownOpen,
2323
onDropdownSelect,
2424
onDialogOpenChange
25-
}: TSwitchChainDialog) {
25+
}: Readonly<TSwitchChainDialog>) {
2626
const onSwitchSuccessCallback = useCallback(() => {
2727
onDialogOpenChange(false);
2828
setIsDropdownOpen(false);

src/components/wallet/dropdown/actions/disconnect.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export default function Disconnect() {
1515
return (
1616
<DropdownMenuItem
1717
className='text-destructive hover:!bg-destructive hover:text-destructive-foreground focus:!bg-destructive focus:text-destructive-foreground'
18-
onClick={() => disconnect()}
18+
onClick={() => {
19+
disconnect();
20+
}}
1921
>
2022
<IconItem icon={LogOut} text='Disconnect' />
2123
</DropdownMenuItem>

src/components/wallet/dropdown/commons/icon-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type TIconItem = {
1212
className?: string;
1313
};
1414

15-
export default function IconItem({ icon: Icon, text, className }: TIconItem) {
15+
export default function IconItem({ icon: Icon, text, className }: Readonly<TIconItem>) {
1616
return (
1717
<div className={cn('flex items-center gap-x-2.5', className)}>
1818
<Icon size={17} />

src/components/wallet/dropdown/details/balance.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type TBalance = {
1515
address: Address | undefined;
1616
};
1717

18-
export default function Balance({ address }: TBalance) {
18+
export default function Balance({ address }: Readonly<TBalance>) {
1919
const { isFetching, data: balance } = useBalance({ address });
2020

2121
const walletBalance = useMemo(

src/components/wallet/dropdown/details/ens-name.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type TENSName = {
1515
address: Address | undefined;
1616
};
1717

18-
export default function ENSName({ address }: TENSName) {
18+
export default function ENSName({ address }: Readonly<TENSName>) {
1919
const {
2020
isFetching,
2121
isFetched,

0 commit comments

Comments
 (0)