From d079cfde7948cb703d83bfa854e5e7277541e627 Mon Sep 17 00:00:00 2001 From: smueller Date: Wed, 22 Jul 2026 14:56:03 +0200 Subject: [PATCH] Enhance ESLint configuration and update component destructuring for improved code quality - Added a rule to allow unused variables prefixed with an underscore in ESLint configuration. - Updated destructuring in leveling-form, logging-form, moderation-form, and welcome-form components to prefix unused variables with an underscore, improving clarity and adherence to ESLint rules. - Expanded German and English localization files with new moderation, auto-moderation, logging, welcome, verification, leveling, economy, and fun module settings for better user experience. --- apps/webui/eslint.config.mjs | 10 ++ .../src/components/modules/leveling-form.tsx | 2 +- .../src/components/modules/logging-form.tsx | 2 +- .../components/modules/moderation-form.tsx | 2 +- .../src/components/modules/welcome-form.tsx | 2 +- apps/webui/src/messages/de.json | 152 +++++++++++++++++- apps/webui/src/messages/en.json | 152 +++++++++++++++++- 7 files changed, 316 insertions(+), 6 deletions(-) diff --git a/apps/webui/eslint.config.mjs b/apps/webui/eslint.config.mjs index 719cea2..5cecc7b 100644 --- a/apps/webui/eslint.config.mjs +++ b/apps/webui/eslint.config.mjs @@ -20,6 +20,16 @@ const eslintConfig = [ "next-env.d.ts", ], }, + { + rules: { + // Allow intentionally unused variables (e.g. destructuring to strip fields) + // when prefixed with an underscore. + "@typescript-eslint/no-unused-vars": [ + "warn", + { varsIgnorePattern: "^_", argsIgnorePattern: "^_" }, + ], + }, + }, ]; export default eslintConfig; diff --git a/apps/webui/src/components/modules/leveling-form.tsx b/apps/webui/src/components/modules/leveling-form.tsx index 0bd8102..d811554 100644 --- a/apps/webui/src/components/modules/leveling-form.tsx +++ b/apps/webui/src/components/modules/leveling-form.tsx @@ -77,7 +77,7 @@ async function saveLeveling(guildId: string, value: LocalLevelingValue): Promise return { ok: false, error: channelMultipliers.error }; } - const { noXpChannelIdsText, noXpRoleIdsText, roleMultipliersText, channelMultipliersText, ...rest } = value; + const { noXpChannelIdsText, noXpRoleIdsText, roleMultipliersText: _roleMultipliersText, channelMultipliersText: _channelMultipliersText, ...rest } = value; const payload: LevelingConfigDashboard = { ...rest, diff --git a/apps/webui/src/components/modules/logging-form.tsx b/apps/webui/src/components/modules/logging-form.tsx index b6f642c..4d1e10d 100644 --- a/apps/webui/src/components/modules/logging-form.tsx +++ b/apps/webui/src/components/modules/logging-form.tsx @@ -82,7 +82,7 @@ function toRemote(value: LocalLoggingValue): LoggingConfigDashboard { ignoreBots: value.ignoreBots, ignoredChannelIds: fromCsv(value.ignoredChannelIdsText), ignoredRoleIds: fromCsv(value.ignoredRoleIdsText), - logChannels: value.logChannels.map(({ clientKey, ...rest }) => rest) + logChannels: value.logChannels.map(({ clientKey: _clientKey, ...rest }) => rest) }; } diff --git a/apps/webui/src/components/modules/moderation-form.tsx b/apps/webui/src/components/modules/moderation-form.tsx index 3b30c10..30cce9c 100644 --- a/apps/webui/src/components/modules/moderation-form.tsx +++ b/apps/webui/src/components/modules/moderation-form.tsx @@ -24,7 +24,7 @@ function toLocal(rules: EscalationRuleDashboard[]): LocalEscalation[] { } function toRemote(rules: LocalEscalation[]): EscalationRuleDashboard[] { - return rules.map(({ clientKey, ...rest }) => rest); + return rules.map(({ clientKey: _clientKey, ...rest }) => rest); } async function saveModeration(guildId: string, value: ModerationDashboard): Promise { diff --git a/apps/webui/src/components/modules/welcome-form.tsx b/apps/webui/src/components/modules/welcome-form.tsx index 72d54e4..a0df288 100644 --- a/apps/webui/src/components/modules/welcome-form.tsx +++ b/apps/webui/src/components/modules/welcome-form.tsx @@ -70,7 +70,7 @@ async function saveWelcome(guildId: string, value: LocalWelcomeValue): Promise