File tree Expand file tree Collapse file tree 3 files changed +6
-19
lines changed Expand file tree Collapse file tree 3 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,12 @@ import eslintConfigPrettier from 'eslint-config-prettier/flat';
66import oxlint from 'eslint-plugin-oxlint' ;
77// import pluginQuery from '@tanstack/eslint-plugin-query';
88import { defineConfig , globalIgnores } from 'eslint/config' ;
9+ // @ts -expect-error I have no idea what the problem here is
910import nextVitals from 'eslint-config-next/core-web-vitals' ;
1011
1112const 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:
Original file line number Diff line number Diff line change 11'use client' ;
22
33import { 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' ;
105import Link from 'next/link' ;
116
127type CustomLinkProps = ComponentProps < typeof Link > & PropsWithChildren ;
138
149export 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 }
Original file line number Diff line number Diff line change 11'use client' ;
2- import { useState , useEffect } from 'react' ;
32export 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 } </ > ;
You can’t perform that action at this time.
0 commit comments