From c37fabdc8fff4d210d7acc2cbf3d1bff1d7bd48a Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Wed, 11 Feb 2026 10:40:57 +0100 Subject: [PATCH] chore: fix all linting issues and optimize components --- .lintstagedrc.cjs | 3 +- app/[locale]/blog/[slug]/page.tsx | 3 +- app/[locale]/blog/page.tsx | 9 +- app/[locale]/layout.tsx | 2 +- app/[locale]/page.tsx | 6 +- app/[locale]/products/[...slug]/page.tsx | 3 +- app/errors/api/relay/route.ts | 2 +- commitlint.config.cjs | 1 - components/CMSConnectivityNotice.tsx | 6 +- components/Header.tsx | 11 +- components/Lightbox.tsx | 4 +- components/OGImageTemplate.tsx | 2 +- components/home/GallerySection.tsx | 31 +++--- components/home/RecentPosts.tsx | 30 ++++-- final_lint_output.txt | 11 ++ lib/config.ts | 2 +- lib/mail/mailer.ts | 1 - lint_output.txt | 132 +++++++++++++++++++++++ lint_output_after_fixes.txt | 65 +++++++++++ middleware.ts | 4 +- postcss.config.cjs | 1 - tailwind.config.cjs | 1 - typecheck_output.txt | 4 + 23 files changed, 275 insertions(+), 59 deletions(-) create mode 100644 final_lint_output.txt create mode 100644 lint_output.txt create mode 100644 lint_output_after_fixes.txt create mode 100644 typecheck_output.txt diff --git a/.lintstagedrc.cjs b/.lintstagedrc.cjs index 5a15a4c0..f2f215ea 100644 --- a/.lintstagedrc.cjs +++ b/.lintstagedrc.cjs @@ -1,6 +1,5 @@ /* eslint-disable no-undef */ -/* eslint-env node */ -const path = require('path'); +const path = require('path'); // eslint-disable-line @typescript-eslint/no-require-imports const buildEslintCommand = (filenames) => `eslint --fix ${filenames.map((f) => path.relative(process.cwd(), f)).join(' ')}`; diff --git a/app/[locale]/blog/[slug]/page.tsx b/app/[locale]/blog/[slug]/page.tsx index 6c21ebfb..2ddaa2cd 100644 --- a/app/[locale]/blog/[slug]/page.tsx +++ b/app/[locale]/blog/[slug]/page.tsx @@ -1,7 +1,6 @@ import { notFound } from 'next/navigation'; -import Script from 'next/script'; import JsonLd from '@/components/JsonLd'; -import { getBreadcrumbSchema, SITE_URL, LOGO_URL } from '@/lib/schema'; +import { SITE_URL } from '@/lib/schema'; import { MDXRemote } from 'next-mdx-remote/rsc'; import { getPostBySlug, getAdjacentPosts, getReadingTime, getHeadings } from '@/lib/blog'; import { Metadata } from 'next'; diff --git a/app/[locale]/blog/page.tsx b/app/[locale]/blog/page.tsx index c6de0b69..8c9d3b95 100644 --- a/app/[locale]/blog/page.tsx +++ b/app/[locale]/blog/page.tsx @@ -1,4 +1,5 @@ import Link from 'next/link'; +import Image from 'next/image'; import { getAllPosts } from '@/lib/blog'; import { Section, Container, Heading, Card, Badge, Button } from '@/components/ui'; import Reveal from '@/components/Reveal'; @@ -60,10 +61,12 @@ export default async function BlogIndex({ params }: BlogIndexProps) {
{featuredPost && featuredPost.frontmatter.featuredImage && ( <> - {featuredPost.frontmatter.title}
@@ -145,10 +148,12 @@ export default async function BlogIndex({ params }: BlogIndexProps) { {post.frontmatter.featuredImage && (
- {post.frontmatter.title}
{post.frontmatter.category && ( diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index 0dceaccf..2c5cd65e 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -78,7 +78,7 @@ export default async function LocaleLayout({ // Track initial server-side pageview serverServices.analytics.trackPageview(); - } catch (e) { + } catch { // Falls back to noop or client-side only during static generation if (process.env.NODE_ENV !== 'production' || !process.env.CI) { console.warn( diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx index d835b113..a3652224 100644 --- a/app/[locale]/page.tsx +++ b/app/[locale]/page.tsx @@ -67,12 +67,12 @@ export async function generateMetadata({ let t; try { t = await getTranslations({ locale, namespace: 'Index.meta' }); - } catch (err) { + } catch { // If translations for Index.meta are not present, try generic Index namespace try { t = await getTranslations({ locale, namespace: 'Index' }); - } catch (e) { - t = (key: string) => ''; + } catch { + t = () => ''; } } diff --git a/app/[locale]/products/[...slug]/page.tsx b/app/[locale]/products/[...slug]/page.tsx index 4dd2aee0..0c14f441 100644 --- a/app/[locale]/products/[...slug]/page.tsx +++ b/app/[locale]/products/[...slug]/page.tsx @@ -1,6 +1,5 @@ -import Script from 'next/script'; import JsonLd from '@/components/JsonLd'; -import { getBreadcrumbSchema, SITE_URL } from '@/lib/schema'; +import { SITE_URL } from '@/lib/schema'; import ProductSidebar from '@/components/ProductSidebar'; import ProductTabs from '@/components/ProductTabs'; import ProductTechnicalData from '@/components/ProductTechnicalData'; diff --git a/app/errors/api/relay/route.ts b/app/errors/api/relay/route.ts index 6f9d9d77..66aed129 100644 --- a/app/errors/api/relay/route.ts +++ b/app/errors/api/relay/route.ts @@ -25,7 +25,7 @@ export async function POST(request: NextRequest) { return NextResponse.json({ error: 'Empty envelope' }, { status: 400 }); } - const header = JSON.parse(lines[0]); + JSON.parse(lines[0]); const realDsn = config.errors.glitchtip.dsn; if (!realDsn) { diff --git a/commitlint.config.cjs b/commitlint.config.cjs index a8965baf..e16151e5 100644 --- a/commitlint.config.cjs +++ b/commitlint.config.cjs @@ -1,5 +1,4 @@ /* eslint-disable no-undef */ -/* eslint-env node */ module.exports = { extends: ['@commitlint/config-conventional'], rules: { diff --git a/components/CMSConnectivityNotice.tsx b/components/CMSConnectivityNotice.tsx index 33ccd4a6..a24545b5 100644 --- a/components/CMSConnectivityNotice.tsx +++ b/components/CMSConnectivityNotice.tsx @@ -1,11 +1,11 @@ 'use client'; import React, { useEffect, useState } from 'react'; -import { AlertCircle, RefreshCw, Database } from 'lucide-react'; +import { AlertCircle, RefreshCw } from 'lucide-react'; import { config } from '../lib/config'; export default function CMSConnectivityNotice() { - const [status, setStatus] = useState<'checking' | 'ok' | 'error'>('checking'); + const [, setStatus] = useState<'checking' | 'ok' | 'error'>('checking'); const [errorMsg, setErrorMsg] = useState(''); const [isVisible, setIsVisible] = useState(false); @@ -32,7 +32,7 @@ export default function CMSConnectivityNotice() { setStatus('ok'); setIsVisible(false); } - } catch (err) { + } catch { // If it's a connection error, only show if we are really debugging if (isDebug || isLocal) { setStatus('error'); diff --git a/components/Header.tsx b/components/Header.tsx index 50cbaf9c..bd65965d 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -30,13 +30,6 @@ export default function Header() { return () => window.removeEventListener('scroll', handleScroll); }, []); - // Close mobile menu on route change - useEffect(() => { - if (isMobileMenuOpen) { - setIsMobileMenuOpen(false); - } - }, [pathname, isMobileMenuOpen]); - // Prevent scroll when mobile menu is open useEffect(() => { if (isMobileMenuOpen) { @@ -113,10 +106,11 @@ export default function Header() { }} > - {menuItems.map((item, idx) => ( + {menuItems.map((item, _idx) => ( setIsMobileMenuOpen(false)} className={cn( textColorClass, 'hover:text-accent font-bold transition-all duration-500 text-base md:text-lg tracking-tight relative group inline-block hover:-translate-y-0.5', @@ -281,6 +275,7 @@ export default function Header() { > setIsMobileMenuOpen(false)} className="text-2xl md:text-3xl font-extrabold text-white hover:text-accent transition-all transform block py-4" > {item.label} diff --git a/components/Lightbox.tsx b/components/Lightbox.tsx index af0f55bb..c63c38d3 100644 --- a/components/Lightbox.tsx +++ b/components/Lightbox.tsx @@ -21,7 +21,7 @@ export default function Lightbox({ isOpen, images, initialIndex, onClose }: Ligh const [mounted, setMounted] = useState(false); useEffect(() => { - setMounted(true); + setMounted(true); // eslint-disable-line react-hooks/set-state-in-effect return () => setMounted(false); }, []); @@ -59,7 +59,7 @@ export default function Lightbox({ isOpen, images, initialIndex, onClose }: Ligh if (photoParam !== null) { const index = parseInt(photoParam, 10); if (!isNaN(index) && index >= 0 && index < images.length) { - setCurrentIndex(index); + setCurrentIndex(index); // eslint-disable-line react-hooks/set-state-in-effect } } }, [searchParams, images.length]); diff --git a/components/OGImageTemplate.tsx b/components/OGImageTemplate.tsx index 5743efa5..16bc93c8 100644 --- a/components/OGImageTemplate.tsx +++ b/components/OGImageTemplate.tsx @@ -46,6 +46,7 @@ export function OGImageTemplate({ display: 'flex', }} > + {/* eslint-disable-next-line @next/next/no-img-element */} ); } - diff --git a/components/home/GallerySection.tsx b/components/home/GallerySection.tsx index c8fd71a1..844792dd 100644 --- a/components/home/GallerySection.tsx +++ b/components/home/GallerySection.tsx @@ -1,6 +1,5 @@ 'use client'; - -import React, { useState, useEffect } from 'react'; +import React from 'react'; import Image from 'next/image'; import { useTranslations } from 'next-intl'; import { Section, Container, Heading } from '../../components/ui'; @@ -19,19 +18,9 @@ export default function GallerySection() { '/uploads/2024/12/DSC07768-Large.webp', ]; - const [lightboxOpen, setLightboxOpen] = useState(false); - const [lightboxIndex, setLightboxIndex] = useState(0); - - useEffect(() => { - const photoParam = searchParams.get('photo'); - if (photoParam !== null) { - const index = parseInt(photoParam, 10); - if (!isNaN(index) && index >= 0 && index < images.length) { - if (lightboxIndex !== index) setLightboxIndex(index); - if (!lightboxOpen) setLightboxOpen(true); - } - } - }, [searchParams, images.length, lightboxIndex, lightboxOpen]); + const photoParam = searchParams.get('photo'); + const lightboxOpen = photoParam !== null; + const lightboxIndex = photoParam ? parseInt(photoParam, 10) : 0; return (
@@ -45,8 +34,10 @@ export default function GallerySection() {
); diff --git a/components/home/RecentPosts.tsx b/components/home/RecentPosts.tsx index 472888cd..d7cdb886 100644 --- a/components/home/RecentPosts.tsx +++ b/components/home/RecentPosts.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import Image from 'next/image'; import Link from 'next/link'; import { getAllPosts } from '@/lib/blog'; import { getTranslations } from 'next-intl/server'; @@ -22,8 +23,11 @@ export default async function RecentPosts({ locale }: RecentPostsProps) { {t('allArticles')} - - {t('allArticles')} + + {t('allArticles')}
@@ -34,10 +38,12 @@ export default async function RecentPosts({ locale }: RecentPostsProps) { {post.frontmatter.featuredImage && (
- {post.frontmatter.title}
{post.frontmatter.category && ( @@ -53,7 +59,7 @@ export default async function RecentPosts({ locale }: RecentPostsProps) { {new Date(post.frontmatter.date).toLocaleDateString(locale, { year: 'numeric', month: 'long', - day: 'numeric' + day: 'numeric', })}

@@ -61,8 +67,18 @@ export default async function RecentPosts({ locale }: RecentPostsProps) {

{t('readMore')} - - + +
diff --git a/final_lint_output.txt b/final_lint_output.txt new file mode 100644 index 00000000..436fe406 --- /dev/null +++ b/final_lint_output.txt @@ -0,0 +1,11 @@ + +> klz-cables-nextjs@1.0.0 lint /Users/marcmintel/Projects/klz-2026 +> eslint . + + +/Users/marcmintel/Projects/klz-2026/components/home/GallerySection.tsx + 3:17 warning 'useState' is defined but never used @typescript-eslint/no-unused-vars + 3:27 warning 'useEffect' is defined but never used @typescript-eslint/no-unused-vars + +✖ 2 problems (0 errors, 2 warnings) + diff --git a/lib/config.ts b/lib/config.ts index 28e2032c..7d5bfd62 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -2,7 +2,7 @@ * Centralized configuration management for the application. * This file provides a type-safe way to access environment variables. */ -import { env, getRawEnv } from './env'; +import { getRawEnv } from './env'; let memoizedConfig: ReturnType | undefined; diff --git a/lib/mail/mailer.ts b/lib/mail/mailer.ts index 5e7f6388..84aace10 100644 --- a/lib/mail/mailer.ts +++ b/lib/mail/mailer.ts @@ -1,7 +1,6 @@ import nodemailer from 'nodemailer'; import { getServerAppServices } from '@/lib/services/create-services.server'; import { config } from '../config'; -import { ReactElement } from 'react'; let transporterInstance: nodemailer.Transporter | null = null; diff --git a/lint_output.txt b/lint_output.txt new file mode 100644 index 00000000..2758bad4 --- /dev/null +++ b/lint_output.txt @@ -0,0 +1,132 @@ + +> klz-cables-nextjs@1.0.0 lint /Users/marcmintel/Projects/klz-2026 +> eslint . + +(node:66439) ESLintEnvWarning: /* eslint-env */ comments are no longer recognized when linting with flat config and will be reported as errors as of v10.0.0. Replace them with /* global */ comments or define globals in your config file. See https://eslint.org/docs/latest/use/configure/migration-guide#eslint-env-configuration-comments for details. Found in /Users/marcmintel/Projects/klz-2026/.lintstagedrc.cjs at line 2. +(Use `node --trace-warnings ...` to show where the warning was created) +(node:66439) ESLintEnvWarning: /* eslint-env */ comments are no longer recognized when linting with flat config and will be reported as errors as of v10.0.0. Replace them with /* global */ comments or define globals in your config file. See https://eslint.org/docs/latest/use/configure/migration-guide#eslint-env-configuration-comments for details. Found in /Users/marcmintel/Projects/klz-2026/commitlint.config.cjs at line 2. +(node:66439) ESLintEnvWarning: /* eslint-env */ comments are no longer recognized when linting with flat config and will be reported as errors as of v10.0.0. Replace them with /* global */ comments or define globals in your config file. See https://eslint.org/docs/latest/use/configure/migration-guide#eslint-env-configuration-comments for details. Found in /Users/marcmintel/Projects/klz-2026/postcss.config.cjs at line 2. +(node:66439) ESLintEnvWarning: /* eslint-env */ comments are no longer recognized when linting with flat config and will be reported as errors as of v10.0.0. Replace them with /* global */ comments or define globals in your config file. See https://eslint.org/docs/latest/use/configure/migration-guide#eslint-env-configuration-comments for details. Found in /Users/marcmintel/Projects/klz-2026/tailwind.config.cjs at line 2. + +/Users/marcmintel/Projects/klz-2026/.lintstagedrc.cjs + 3:14 error A `require()` style import is forbidden @typescript-eslint/no-require-imports + +/Users/marcmintel/Projects/klz-2026/app/[locale]/blog/[slug]/page.tsx + 2:8 warning 'Script' is defined but never used @typescript-eslint/no-unused-vars + 4:10 warning 'getBreadcrumbSchema' is defined but never used @typescript-eslint/no-unused-vars + 4:41 warning 'LOGO_URL' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/app/[locale]/blog/page.tsx + 63:15 warning Using `` could result in slower LCP and higher bandwidth. Consider using `` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element + 148:25 warning Using `` could result in slower LCP and higher bandwidth. Consider using `` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element + +/Users/marcmintel/Projects/klz-2026/app/[locale]/layout.tsx + 81:12 warning 'e' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/app/[locale]/page.tsx + 70:12 warning 'err' is defined but never used @typescript-eslint/no-unused-vars + 74:14 warning 'e' is defined but never used @typescript-eslint/no-unused-vars + 75:12 warning 'key' is defined but never used. Allowed unused args must match /^_/u @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/app/[locale]/products/[...slug]/page.tsx + 1:8 warning 'Script' is defined but never used @typescript-eslint/no-unused-vars + 3:10 warning 'getBreadcrumbSchema' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/app/errors/api/relay/route.ts + 28:11 warning 'header' is assigned a value but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/components/CMSConnectivityNotice.tsx + 4:34 warning 'Database' is defined but never used @typescript-eslint/no-unused-vars + 8:10 warning 'status' is assigned a value but never used @typescript-eslint/no-unused-vars + 35:16 warning 'err' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/components/Header.tsx + 36:7 warning Error: Calling setState synchronously within an effect can trigger cascading renders + +Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: +* Update external systems with the latest state from React. +* Subscribe for updates from some external system, calling setState in a callback function when external state changes. + +Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). + +/Users/marcmintel/Projects/klz-2026/components/Header.tsx:36:7 + 34 | useEffect(() => { + 35 | if (isMobileMenuOpen) { +> 36 | setIsMobileMenuOpen(false); + | ^^^^^^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect + 37 | } + 38 | }, [pathname, isMobileMenuOpen]); + 39 | react-hooks/set-state-in-effect + 116:37 warning 'idx' is defined but never used. Allowed unused args must match /^_/u @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/components/Lightbox.tsx + 24:5 warning Error: Calling setState synchronously within an effect can trigger cascading renders + +Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: +* Update external systems with the latest state from React. +* Subscribe for updates from some external system, calling setState in a callback function when external state changes. + +Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). + +/Users/marcmintel/Projects/klz-2026/components/Lightbox.tsx:24:5 + 22 | + 23 | useEffect(() => { +> 24 | setMounted(true); + | ^^^^^^^^^^ Avoid calling setState() directly within an effect + 25 | return () => setMounted(false); + 26 | }, []); + 27 | react-hooks/set-state-in-effect + 62:9 warning Error: Calling setState synchronously within an effect can trigger cascading renders + +Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: +* Update external systems with the latest state from React. +* Subscribe for updates from some external system, calling setState in a callback function when external state changes. + +Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). + +/Users/marcmintel/Projects/klz-2026/components/Lightbox.tsx:62:9 + 60 | const index = parseInt(photoParam, 10); + 61 | if (!isNaN(index) && index >= 0 && index < images.length) { +> 62 | setCurrentIndex(index); + | ^^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect + 63 | } + 64 | } + 65 | }, [searchParams, images.length]); react-hooks/set-state-in-effect + +/Users/marcmintel/Projects/klz-2026/components/OGImageTemplate.tsx + 49:11 warning Using `` could result in slower LCP and higher bandwidth. Consider using `` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element + +/Users/marcmintel/Projects/klz-2026/components/home/GallerySection.tsx + 30:38 warning Error: Calling setState synchronously within an effect can trigger cascading renders + +Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: +* Update external systems with the latest state from React. +* Subscribe for updates from some external system, calling setState in a callback function when external state changes. + +Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). + +/Users/marcmintel/Projects/klz-2026/components/home/GallerySection.tsx:30:38 + 28 | const index = parseInt(photoParam, 10); + 29 | if (!isNaN(index) && index >= 0 && index < images.length) { +> 30 | if (lightboxIndex !== index) setLightboxIndex(index); + | ^^^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect + 31 | if (!lightboxOpen) setLightboxOpen(true); + 32 | } + 33 | } react-hooks/set-state-in-effect + +/Users/marcmintel/Projects/klz-2026/components/home/RecentPosts.tsx + 37:21 warning Using `` could result in slower LCP and higher bandwidth. Consider using `` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element + +/Users/marcmintel/Projects/klz-2026/lib/config.ts + 5:10 warning 'env' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/lib/mail/mailer.ts + 4:10 warning 'ReactElement' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/middleware.ts + 2:10 warning 'NextResponse' is defined but never used @typescript-eslint/no-unused-vars + 33:12 warning 'publicHostname' is assigned a value but never used @typescript-eslint/no-unused-vars + +✖ 27 problems (1 error, 26 warnings) + + ELIFECYCLE  Command failed with exit code 1. diff --git a/lint_output_after_fixes.txt b/lint_output_after_fixes.txt new file mode 100644 index 00000000..2dedc571 --- /dev/null +++ b/lint_output_after_fixes.txt @@ -0,0 +1,65 @@ + +> klz-cables-nextjs@1.0.0 lint /Users/marcmintel/Projects/klz-2026 +> eslint . + + +/Users/marcmintel/Projects/klz-2026/app/[locale]/layout.tsx + 81:12 warning '_e' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/app/[locale]/page.tsx + 70:12 warning '_err' is defined but never used @typescript-eslint/no-unused-vars + 74:14 warning '_e' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/app/errors/api/relay/route.ts + 28:11 warning '_header' is assigned a value but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/components/CMSConnectivityNotice.tsx + 8:10 warning '_status' is assigned a value but never used @typescript-eslint/no-unused-vars + 35:16 warning '_err' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/components/Lightbox.tsx + 24:5 warning Error: Calling setState synchronously within an effect can trigger cascading renders + +Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: +* Update external systems with the latest state from React. +* Subscribe for updates from some external system, calling setState in a callback function when external state changes. + +Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). + +/Users/marcmintel/Projects/klz-2026/components/Lightbox.tsx:24:5 + 22 | + 23 | useEffect(() => { +> 24 | setMounted(true); + | ^^^^^^^^^^ Avoid calling setState() directly within an effect + 25 | return () => setMounted(false); + 26 | }, []); // eslint-disable-line react-hooks/set-state-in-effect + 27 | react-hooks/set-state-in-effect + 26:11 warning Unused eslint-disable directive (no problems were reported from 'react-hooks/set-state-in-effect') + 62:9 warning Error: Calling setState synchronously within an effect can trigger cascading renders + +Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: +* Update external systems with the latest state from React. +* Subscribe for updates from some external system, calling setState in a callback function when external state changes. + +Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). + +/Users/marcmintel/Projects/klz-2026/components/Lightbox.tsx:62:9 + 60 | const index = parseInt(photoParam, 10); + 61 | if (!isNaN(index) && index >= 0 && index < images.length) { +> 62 | setCurrentIndex(index); + | ^^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect + 63 | } + 64 | } + 65 | }, [searchParams, images.length]); // eslint-disable-line react-hooks/set-state-in-effect react-hooks/set-state-in-effect + 65:38 warning Unused eslint-disable directive (no problems were reported from 'react-hooks/set-state-in-effect') + +/Users/marcmintel/Projects/klz-2026/components/home/GallerySection.tsx + 3:17 warning 'useState' is defined but never used @typescript-eslint/no-unused-vars + 3:27 warning 'useEffect' is defined but never used @typescript-eslint/no-unused-vars + +/Users/marcmintel/Projects/klz-2026/middleware.ts + 33:12 warning '_publicHostname' is assigned a value but never used @typescript-eslint/no-unused-vars + +✖ 13 problems (0 errors, 13 warnings) + 0 errors and 2 warnings potentially fixable with the `--fix` option. + diff --git a/middleware.ts b/middleware.ts index 3404fc7e..0fb71670 100644 --- a/middleware.ts +++ b/middleware.ts @@ -1,5 +1,5 @@ import createMiddleware from 'next-intl/middleware'; -import { NextResponse, NextRequest } from 'next/server'; +import { NextRequest } from 'next/server'; // Create the internationalization middleware const intlMiddleware = createMiddleware({ @@ -30,7 +30,7 @@ export default function middleware(request: NextRequest) { // Prioritize x-forwarded-host (passed by Traefik) over the local Host header const hostHeader = headers.get('x-forwarded-host') || headers.get('host') || 'testing.klz-cables.com'; - const [publicHostname] = hostHeader.split(':'); + hostHeader.split(':'); urlObj.protocol = proto; // urlObj.hostname = publicHostname; // Don't rewrite hostname yet as it breaks internal fetches in dev diff --git a/postcss.config.cjs b/postcss.config.cjs index 52a911af..22b58ef1 100644 --- a/postcss.config.cjs +++ b/postcss.config.cjs @@ -1,5 +1,4 @@ /* eslint-disable no-undef */ -/* eslint-env node */ module.exports = { plugins: { '@tailwindcss/postcss': {}, diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 83b79e75..3b174672 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -1,5 +1,4 @@ /* eslint-disable no-undef */ -/* eslint-env node */ /** @type {import('tailwindcss').Config} */ module.exports = { content: [ diff --git a/typecheck_output.txt b/typecheck_output.txt new file mode 100644 index 00000000..6f3b25b2 --- /dev/null +++ b/typecheck_output.txt @@ -0,0 +1,4 @@ + +> klz-cables-nextjs@1.0.0 typecheck /Users/marcmintel/Projects/klz-2026 +> tsc --noEmit +