Skip to content

Commit 34133dc

Browse files
committed
chore: migrate linter, fix linter issues
1 parent d893895 commit 34133dc

File tree

7 files changed

+53
-26
lines changed

7 files changed

+53
-26
lines changed

.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright (c) 2025, Circle Internet Group, Inc. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import { defineConfig, globalIgnores } from "eslint/config";
20+
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
21+
import path from "node:path";
22+
import { fileURLToPath } from "node:url";
23+
24+
const __filename = fileURLToPath(import.meta.url);
25+
const __dirname = path.dirname(__filename);
26+
27+
export default defineConfig([
28+
globalIgnores(["**/node_modules", "**/.next", "**/dist", "**/build", "**/out"]),
29+
{
30+
extends: [...nextCoreWebVitals],
31+
},
32+
]);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "eslint ."
1010
},
1111
"dependencies": {
1212
"@coral-xyz/anchor": "^0.32.1",

postcss.config.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
* limitations under the License.
1717
*/
1818

19-
export default {
19+
const config = {
2020
plugins: {
2121
'@tailwindcss/postcss': {},
2222
},
23-
}
23+
};
24+
25+
export default config;

src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default function Home() {
9595
}
9696
};
9797
wrapper();
98-
}, [sourceChain]);
98+
}, [sourceChain, getBalance]);
9999

100100
return (
101101
<div className="min-h-screen bg-gray-100 p-8">

src/components/timer.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
"use client";
2020

21-
import { useState, useEffect, useRef } from 'react';
21+
import { useState, useEffect, useRef } from "react";
2222

2323
interface TimerProps {
2424
isRunning: boolean;
@@ -27,25 +27,27 @@ interface TimerProps {
2727
}
2828

2929
export function Timer({ isRunning, onTick }: TimerProps) {
30-
const [startTime, setStartTime] = useState<number | null>(null);
30+
const startTimeRef = useRef<number | null>(null);
3131
const [elapsed, setElapsed] = useState(0);
3232
const animationRef = useRef<number | undefined>(undefined);
3333
const onTickRef = useRef(onTick);
34-
onTickRef.current = onTick;
34+
useEffect(() => {
35+
onTickRef.current = onTick;
36+
}, [onTick]);
3537

3638
useEffect(() => {
37-
if (isRunning && startTime === null) {
38-
setStartTime(Date.now());
39-
} else if (!isRunning && startTime !== null) {
40-
setStartTime(null);
39+
if (isRunning && startTimeRef.current === null) {
40+
startTimeRef.current = Date.now();
41+
} else if (!isRunning && startTimeRef.current !== null) {
42+
startTimeRef.current = null;
4143
}
42-
}, [isRunning, startTime]);
44+
}, [isRunning]);
4345

4446
useEffect(() => {
4547
const animate = () => {
46-
if (startTime) {
48+
if (startTimeRef.current !== null) {
4749
const now = Date.now();
48-
const newElapsed = Math.floor((now - startTime) / 1000);
50+
const newElapsed = Math.floor((now - startTimeRef.current) / 1000);
4951
setElapsed(newElapsed);
5052
onTickRef.current?.(newElapsed);
5153
}
@@ -61,15 +63,14 @@ export function Timer({ isRunning, onTick }: TimerProps) {
6163
cancelAnimationFrame(animationRef.current);
6264
}
6365
};
64-
}, [isRunning, startTime]);
66+
}, [isRunning]);
6567

6668
const minutes = Math.floor(elapsed / 60);
6769
const seconds = elapsed % 60;
6870

6971
return (
7072
<div className="text-2xl font-mono">
71-
<span>{minutes.toString().padStart(2, '0')}</span>:
72-
<span>{seconds.toString().padStart(2, '0')}</span>
73+
<span>{minutes.toString().padStart(2, "0")}</span>:<span>{seconds.toString().padStart(2, "0")}</span>
7374
</div>
7475
);
75-
}
76+
}

0 commit comments

Comments
 (0)