Skip to content

Commit 5daf356

Browse files
committed
Fix eslint
1 parent 059d476 commit 5daf356

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import eslintConfigPrettier from 'eslint-config-prettier/flat';
66
import oxlint from 'eslint-plugin-oxlint';
77
// import pluginQuery from '@tanstack/eslint-plugin-query';
88
import { defineConfig, globalIgnores } from 'eslint/config';
9+
// @ts-expect-error I have no idea what the problem here is
910
import nextVitals from 'eslint-config-next/core-web-vitals';
1011

1112
const eslintConfig = defineConfig([
1213
js.configs.recommended,
14+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1315
...nextVitals,
1416
globalIgnores([
1517
// Default ignores of eslint-config-next:

src/app/components/NavLink.tsx

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

33
import { usePathname } from 'next/navigation';
4-
import React, {
5-
type ComponentProps,
6-
type PropsWithChildren,
7-
useEffect,
8-
useState,
9-
} from 'react';
4+
import React, { type ComponentProps, type PropsWithChildren } from 'react';
105
import Link from 'next/link';
116

127
type CustomLinkProps = ComponentProps<typeof Link> & PropsWithChildren;
138

149
export default function NavLink({ href, children, ...props }: CustomLinkProps) {
1510
const path = usePathname();
16-
const [ariaCurrent, setAriaCurrent] =
17-
useState<React.AriaAttributes['aria-current']>(undefined);
18-
19-
useEffect(() => {
20-
setAriaCurrent(href === path ? 'page' : undefined);
21-
}, [href, path]);
11+
const ariaCurrent: React.AriaAttributes['aria-current'] =
12+
href === path ? 'page' : undefined;
2213
return (
2314
<Link href={href} aria-current={ariaCurrent} {...props}>
2415
{children}

src/app/components/client-date.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
'use client';
2-
import { useState, useEffect } from 'react';
32
export default function ClientDate({ date }: { date: string }) {
4-
const [isClient, setIsClient] = useState(false);
5-
6-
useEffect(() => {
7-
setIsClient(true);
8-
}, []);
9-
if (isClient) {
3+
if (typeof window !== 'undefined') {
104
return <>{new Date(date).toLocaleDateString()}</>;
115
}
126
return <>{date}</>;

0 commit comments

Comments
 (0)