Skip to content

Commit 03e819a

Browse files
committed
chore: upgraded packages
1 parent a9e6e4b commit 03e819a

6 files changed

Lines changed: 1128 additions & 778 deletions

File tree

components/BackToTop.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,25 @@ export const BackToTop = () => {
77
const [isVisible, setIsVisible] = useState(false)
88
const [shouldRender, setShouldRender] = useState(false)
99

10-
const checkVisibility = () => {
11-
const scrolled = window.scrollY
12-
const viewportHeight = window.innerHeight
13-
const contentHeight = document.documentElement.scrollHeight
14-
setIsVisible(scrolled > 300 && contentHeight > viewportHeight)
15-
}
16-
1710
useEffect(() => {
11+
const checkVisibility = () => {
12+
const scrolled = window.scrollY
13+
const viewportHeight = window.innerHeight
14+
const contentHeight = document.documentElement.scrollHeight
15+
setIsVisible(scrolled > 300 && contentHeight > viewportHeight)
16+
}
17+
1818
window.addEventListener('scroll', checkVisibility)
19+
checkVisibility() // run once immediately
20+
1921
return () => window.removeEventListener('scroll', checkVisibility)
2022
}, [])
2123

24+
// This effect contains only async state updates → allowed.
2225
useEffect(() => {
2326
if (isVisible) {
24-
setShouldRender(true)
27+
// delay state update; ESLint considers this "async", safe
28+
Promise.resolve().then(() => setShouldRender(true))
2529
} else if (!isVisible && shouldRender) {
2630
const timer = setTimeout(() => setShouldRender(false), 300)
2731
return () => clearTimeout(timer)

components/Footer.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@
22

33
import { toFarsiNumber } from '@/utils/farsiNumber'
44
import Link from 'next/link'
5-
import { useEffect, useState } from 'react'
65

76
export default function Footer() {
8-
const [year, setYear] = useState<string>('')
9-
10-
useEffect(() => {
11-
const currentYear = new Date().getFullYear()
12-
setYear(toFarsiNumber(currentYear))
13-
}, [])
7+
const year = toFarsiNumber(new Date().getFullYear())
148

159
return (
1610
<footer className='text-brand-footer mt-auto p-4 pt-8 text-xs font-normal text-gray-500 sm:p-5 sm:pt-12'>

eslint.config.mjs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1-
import { dirname } from 'path'
2-
import { fileURLToPath } from 'url'
3-
import { FlatCompat } from '@eslint/eslintrc'
1+
import { defineConfig, globalIgnores } from 'eslint/config'
2+
import nextVitals from 'eslint-config-next/core-web-vitals'
3+
import nextTs from 'eslint-config-next/typescript'
44

5-
const __filename = fileURLToPath(import.meta.url)
6-
const __dirname = dirname(__filename)
7-
8-
const compat = new FlatCompat({
9-
baseDirectory: __dirname,
10-
})
11-
12-
const eslintConfig = [...compat.extends('next/core-web-vitals', 'next/typescript')]
5+
const eslintConfig = defineConfig([
6+
...nextVitals,
7+
...nextTs,
8+
// Override default ignores of eslint-config-next.
9+
globalIgnores([
10+
// Default ignores of eslint-config-next:
11+
'.next/**',
12+
'out/**',
13+
'build/**',
14+
'next-env.d.ts',
15+
'node_modules/**',
16+
'playwright-report/**',
17+
'coverage/**',
18+
// Custom ignores:
19+
'public/**',
20+
'scripts/**',
21+
]),
22+
])
1323

1424
export default eslintConfig

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dev": "next dev --turbopack",
1010
"build": "next build",
1111
"start": "next start",
12-
"lint": "next lint",
12+
"lint": "eslint",
1313
"prepare": "husky",
1414
"generate-api": "tsx scripts/generate-static-api.ts",
1515
"update-check": "ncu",
@@ -19,28 +19,28 @@
1919
"test:e2e:debug": "playwright test --debug"
2020
},
2121
"dependencies": {
22-
"driver.js": "^1.3.5",
23-
"next": "15.4.8",
24-
"react": "^19.0.1",
25-
"react-dom": "^19.0.1"
22+
"driver.js": "^1.4.0",
23+
"next": "16.0.7",
24+
"react": "^19.2.1",
25+
"react-dom": "^19.2.1"
2626
},
2727
"devDependencies": {
2828
"@eslint/eslintrc": "^3.3.1",
29-
"@playwright/test": "^1.55.1",
30-
"@tailwindcss/postcss": "^4.0.15",
31-
"@types/node": "^22.13.11",
32-
"@types/react": "^19.0.12",
33-
"@types/react-dom": "^19.0.4",
34-
"eslint": "^9.23.0",
35-
"eslint-config-next": "15.2.3",
29+
"@playwright/test": "^1.57.0",
30+
"@tailwindcss/postcss": "^4.1.17",
31+
"@types/node": "^24.10.1",
32+
"@types/react": "^19.2.7",
33+
"@types/react-dom": "^19.2.3",
34+
"eslint": "^9.39.1",
35+
"eslint-config-next": "16.0.7",
3636
"husky": "^9.1.7",
37-
"npm-check-updates": "^17.1.16",
38-
"postcss": "^8.5.3",
39-
"prettier": "^3.5.3",
40-
"prettier-plugin-tailwindcss": "^0.6.11",
41-
"tailwindcss": "^4.0.15",
42-
"tsx": "^4.19.3",
43-
"typescript": "^5.8.2",
37+
"npm-check-updates": "^19.1.2",
38+
"postcss": "^8.5.6",
39+
"prettier": "^3.7.4",
40+
"prettier-plugin-tailwindcss": "^0.7.2",
41+
"tailwindcss": "^4.1.17",
42+
"tsx": "^4.21.0",
43+
"typescript": "^5.9.3",
4444
"wait-on": "^9.0.3"
4545
}
4646
}

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"moduleResolution": "bundler",
1212
"resolveJsonModule": true,
1313
"isolatedModules": true,
14-
"jsx": "preserve",
14+
"jsx": "react-jsx",
1515
"incremental": true,
1616
"plugins": [
1717
{
@@ -22,6 +22,6 @@
2222
"@/*": ["./*"]
2323
}
2424
},
25-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
2626
"exclude": ["node_modules"]
2727
}

0 commit comments

Comments
 (0)