Skip to content

Commit d2b546e

Browse files
committed
Fix lint
1 parent c3cc7e2 commit d2b546e

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

src/app/import/page.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
"use client";
22

33
import { useState } from "react";
4-
import Image from "next/image";
5-
import Link from "next/link";
6-
import { FaArrowLeft, FaUpload } from "react-icons/fa";
4+
import { FaUpload } from "react-icons/fa";
75
import { ethers } from "ethers";
86

97
// Example data
@@ -218,8 +216,12 @@ export default function ImportPage() {
218216
setAlertMessage(
219217
`Imported ${impFunctions} functions and ${impEvents} events! Skipped ${dupFunctions} functions and ${dupEvents} events.`
220218
);
221-
} catch (err: any) {
222-
setError(`An error occurred: ${err.message}`);
219+
} catch (err: unknown) {
220+
if (err instanceof Error) {
221+
setError(`An error occurred: ${err.message}`);
222+
} else {
223+
setError(`An unknown error occurred`);
224+
}
223225
} finally {
224226
setIsImporting(false);
225227
}

src/components/CopyButton.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"use client";
22

3-
import { useState } from 'react';
4-
import { MdContentCopy, MdCheck } from 'react-icons/md';
5-
import { Tooltip } from 'react-tooltip';
3+
import { useState } from "react";
4+
import { MdContentCopy, MdCheck } from "react-icons/md";
5+
import { Tooltip } from "react-tooltip";
66

77
interface CopyButtonProps {
88
text: string;
@@ -20,7 +20,12 @@ export default function CopyButton({ text, title = "Copy to clipboard", classNam
2020
await navigator.clipboard.writeText(text);
2121
setCopied(true);
2222
setTimeout(() => setCopied(false), 2000);
23-
} catch (err) {
23+
} catch (err: unknown) {
24+
if (err instanceof Error) {
25+
console.error(err.message);
26+
} else {
27+
console.error("An unknown error occurred");
28+
}
2429
// Fallback for older browsers
2530
const textArea = document.createElement("textarea");
2631
textArea.value = text;
@@ -42,17 +47,9 @@ export default function CopyButton({ text, title = "Copy to clipboard", classNam
4247
data-tooltip-id={buttonId}
4348
data-tooltip-content={copied ? "Copied!" : title}
4449
>
45-
{copied ? (
46-
<MdCheck className="w-4 h-4 text-green-600" />
47-
) : (
48-
<MdContentCopy className="w-4 h-4 text-gray-500" />
49-
)}
50+
{copied ? <MdCheck className="w-4 h-4 text-green-600" /> : <MdContentCopy className="w-4 h-4 text-gray-500" />}
5051
</button>
51-
<Tooltip
52-
id={buttonId}
53-
place="top"
54-
className={copied ? "!bg-green-600" : ""}
55-
/>
52+
<Tooltip id={buttonId} place="top" className={copied ? "!bg-green-600" : ""} />
5653
</>
5754
);
58-
}
55+
}

0 commit comments

Comments
 (0)