Skip to content

Commit 7656cc5

Browse files
committed
refactor: clean up imports and unused variables across components
- Removed unused imports such as `appName` and `Clock` from various files. - Disabled ESLint rules for specific files to allow for explicit any types and unused variables. - Updated the `generate-sitemap` and related scripts to streamline the sitemap generation process. - Refactored the `generate-feeds` and `generate-images-sitemap` scripts to improve readability and maintainability. - Removed the deprecated `seo-google-indexing-fix` script. - Enhanced the `tsconfig.json` for better type checking and module resolution.
1 parent f6e666c commit 7656cc5

35 files changed

Lines changed: 291 additions & 450 deletions

eslint.config.mjs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
import { FlatCompat } from '@eslint/eslintrc'
2-
const compat = new FlatCompat({
3-
// import.meta.dirname is available after Node.js v20.11.0
4-
baseDirectory: import.meta.dirname,
5-
})
6-
const eslintConfig = [
7-
...compat.config({
8-
extends: ['next'],
9-
rules: {
10-
'react/no-unescaped-entities': 'off',
11-
'@next/next/no-page-custom-font': 'off',
12-
},
13-
}),
14-
]
15-
export default eslintConfig
1+
import { FlatCompat } from "@eslint/eslintrc";
2+
3+
const compat = new FlatCompat({
4+
baseDirectory: import.meta.dirname,
5+
});
6+
7+
const eslintConfig = [
8+
...compat.extends("next/core-web-vitals", "next/typescript"),
9+
...compat.config({
10+
rules: {
11+
"react/no-unescaped-entities": "off",
12+
"@next/next/no-page-custom-font": "off",
13+
},
14+
}),
15+
{
16+
ignores: ["node_modules/**", ".next/**", "out/**", "build/**", "next-env.d.ts"],
17+
},
18+
];
19+
20+
export default eslintConfig;

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev --turbopack",
7-
"generate": "tsc src/scripts/build.ts --outDir build && node build/scripts/build.js && npm run generate:manifest && npm run generate:sitemap && npm run generate:images && npm run generate:feeds",
7+
"generate": "tsc --noEmit false src/scripts/build.ts --outDir build && node build/scripts/build.js",
88
"generate:manifest": "tsc src/scripts/generate-manifest.ts --outDir build && node build/scripts/generate-manifest.js",
99
"generate:sitemap": "tsc --noEmit false src/scripts/generate-sitemap.ts --outDir build/scripts && node build/scripts/scripts/generate-sitemap.js",
1010
"generate:images": "tsc src/scripts/generate-images-sitemap.ts --outDir build/scripts && node build/scripts/scripts/generate-images-sitemap.js",
@@ -13,13 +13,12 @@
1313
"optimize:webp": "tsc --noEmit false --esModuleInterop src/scripts/optimize-webp-by-dir.ts --outDir build/scripts && node build/scripts/optimize-webp-by-dir.js",
1414
"create:blog-images": "tsc --noEmit false --esModuleInterop src/scripts/download-blog-images.ts --outDir build/scripts && node build/scripts/download-blog-images.js",
1515
"validate:sitemap": "tsc src/scripts/validate-sitemap.ts --outDir build/scripts && node build/scripts/validate-sitemap.js",
16-
"seo:indexing": "tsc --noEmit false src/scripts/seo-google-indexing-fix.ts --outDir build/scripts && node build/scripts/seo-google-indexing-fix.js",
1716
"test:seo": "tsc src/scripts/test-seo-config.ts --outDir build/test && node build/test/test-seo-config.js",
1817
"test:structured-data": "tsc src/scripts/test-structured-data.ts --outDir build/test && node build/test/test-structured-data.js",
1918
"pretest": "tsc src/scripts/pretest.ts --outDir build/test && node build/test/pretest.js",
20-
"build": "npm run generate && next build",
19+
"lint": "eslint .",
20+
"build": "npm run lint &&npm run generate && next build",
2121
"start": "next start",
22-
"lint": "next lint",
2322
"clean": "rm -rf build && rm -rf .next && rm -rf node_modules && rm -rf package-lock.json",
2423
"reprod": "npm run clean && npm install && npm run build"
2524
},

src/app/(home)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const HomeAboutMe = dynamic(() => import("./sections/home-aboutme").then(mod =>
2626
const HomeFAQSection = dynamic(() => import("./sections/home-faq").then(mod => ({ default: mod.HomeFAQSection })), {
2727
loading: () => <div className="min-h-25" />,
2828
});
29-
const GetInTouchSections = dynamic(() => import("./sections/home-getintouch"));
29+
// const GetInTouchSections = dynamic(() => import("./sections/home-getintouch"));
3030
const homeSearchImage = `${NEXT_PUBLIC_APP_URL}/assets/screenshots/home-dark.png`;
3131
const homeTitle = `${appName} | Senior Front-end Developer & UI/UX Designer`;
3232
const homeDescription = "Sophat LEAT (PPhat, Sophat L.) is a Senior Front-end Developer at TURBOTECH CO., LTD and Freelance UI/UX Designer in Phnom Penh, Cambodia. Explore projects, case studies, technical articles, blogs, and contact details.";

src/app/(home)/sections/home-feature.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { Title } from "@components/ui/title";
33
import { cn } from "@lib/utils";
44
import {
55
IconCloud,
6-
IconEaseInOut,
7-
IconRouteAltLeft,
6+
// IconEaseInOut,
7+
// IconRouteAltLeft,
88
IconTerminal2,
99
} from "@tabler/icons-react";
1010

src/app/(home)/sections/home-getintouch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const GetInTouchSections = () => {
3535
/>
3636

3737
{/* Vertical lines */}
38-
{['left', 'right'].map((position, index) => (
38+
{['left', 'right'].map((position) => (
3939
<div
4040
key={position}
4141
style={{

src/app/(home)/sections/home-project.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { GradientLines } from "@components/background/gradient-line";
33
import { BentoGrid } from "@components/ui/bento-grid";
44
import { Title } from "@components/ui/title";
5-
import { BookAIcon, CheckCircle, Globe, TrendingUp, Video } from "lucide-react";
5+
import { BookAIcon, CheckCircle } from "lucide-react";
66

77

88
export const HomeProjects = () => {

src/app/contact/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Footer from '../../components/layouts/footer';
1515

1616
const BorderBeam = dynamic(() => import("@components/ui/border-beam").then(mod => ({ default: mod.BorderBeam })));
1717
const GridPattern = dynamic(() => import("@components/ui/grid-pattern").then(mod => ({ default: mod.GridPattern })));
18-
const Ripple = dynamic(() => import("@components/ui/ripple").then(mod => ({ default: mod.Ripple })));
18+
// const Ripple = dynamic(() => import("@components/ui/ripple").then(mod => ({ default: mod.Ripple })));
1919
const ContactHero = dynamic(() => import("@components/heros/contact-hero").then(mod => ({ default: mod.ContactHero })));
2020

2121
export default function ContactPage() {
@@ -122,8 +122,8 @@ export default function ContactPage() {
122122
subject: "",
123123
message: ""
124124
});
125-
} catch (err: any) {
126-
setError(err.message || "Failed to send message. Please try again later.");
125+
} catch (err: unknown) {
126+
setError(err instanceof Error ? err.message : "Failed to send message. Please try again later.");
127127
// Scroll to the error message
128128
window.scrollTo({ top: 0, behavior: 'smooth' });
129129
} finally {

src/app/not-found.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Metadata } from 'next';
2-
import { appName, NEXT_PUBLIC_APP_URL } from '@lib/constants';
2+
import { NEXT_PUBLIC_APP_URL } from '@lib/constants';
33
import Link from 'next/link';
44

55
export const metadata: Metadata = {

src/app/posts/[slug]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { getPostBySlug, getPublishedPosts, type PostEntry } from '@lib/content';
2+
import { getPostBySlug, getPublishedPosts } from '@lib/content';
33
import Link from 'next/link';
44
import { Metadata } from 'next';
55
import { appName, NEXT_PUBLIC_APP_URL } from '@lib/constants';
@@ -8,7 +8,7 @@ import { Badge } from '@components/ui/badge';
88
import { Button } from '@components/ui/button';
99
import { Separator } from '@components/ui/separator';
1010
import { Avatar, AvatarFallback, AvatarImage } from '@components/ui/avatar';
11-
import { ArrowLeftIcon, Calendar, Clock, ExternalLink, Pencil, User } from 'lucide-react';
11+
import { ArrowLeftIcon, Calendar, Clock, ExternalLink, User } from 'lucide-react';
1212
import { formatDistanceToNow } from 'date-fns';
1313
import "../../../styles/code-block-node.css"
1414
import { GridPattern } from '@components/ui/grid-pattern';

src/components/data-structured/article.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
import React from 'react';
23
import { NEXT_PUBLIC_APP_URL, appName } from '@lib/constants';
34

0 commit comments

Comments
 (0)