From ddad30bcf852e8c4ae9665f6ed6bc7f4339747da Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Mon, 21 Apr 2025 09:05:59 +0200 Subject: [PATCH] Update ESLint config and optimize error handling --- .../Contact/Section/ContactFormSection.tsx | 2 +- eslint.config.mjs | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/components/Contact/Section/ContactFormSection.tsx b/components/Contact/Section/ContactFormSection.tsx index 9863dc8..0e383f1 100644 --- a/components/Contact/Section/ContactFormSection.tsx +++ b/components/Contact/Section/ContactFormSection.tsx @@ -56,7 +56,7 @@ const ContactFormSection = () => { const resJson = await res.json(); setError(resJson?.error || "Ein Fehler ist aufgetreten. Bitte versuche es später erneut."); } - } catch (err) { + } catch (_err) { setError("Serverfehler. Bitte versuche es später erneut."); } diff --git a/eslint.config.mjs b/eslint.config.mjs index c85fb67..032b486 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,16 +1,27 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import {dirname} from "path"; +import {fileURLToPath} from "url"; +import {FlatCompat} from "@eslint/eslintrc"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const compat = new FlatCompat({ - baseDirectory: __dirname, + baseDirectory: __dirname, }); const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), + ...compat.extends("next/core-web-vitals", "next/typescript"), + ...compat.config({ + rules: { + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_' + } + ] + } + }) ]; export default eslintConfig;