chore: add i18n string literal ESLint rule to frontend#5178
Closed
angelplusultra wants to merge 3 commits intomasterfrom
Closed
chore: add i18n string literal ESLint rule to frontend#5178angelplusultra wants to merge 3 commits intomasterfrom
angelplusultra wants to merge 3 commits intomasterfrom
Conversation
Member
|
How is this intended to function? <h2 className="text-xl font-semibold text-white">
{t("keyboard-shortcuts.title")}
{t("keyboard-shortcuts.this-key-does-not-work")}
</h2>Frontend eslint shows no errors? Edit: Nvm I see this only checks that the input in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Relevant Issues
resolves #
Description
Adds
eslint-plugin-i18next-no-undefined-translation-keysto the frontend ESLint config with thetranslation-key-string-literalrule set toerror. This enforces that allt()calls use plain string literals — no template literals or dynamic expressions — making translation keys statically analyzable and easier to search for across the codebase.Fixed existing violations:
SystemPrompts/index.jsx— changed a template literalt(`community_hub...`)to a regular string literalt("community_hub...").keyboardShortcuts.js— refactored the staticSHORTCUTSobject into agetShortcuts(t)function so translation keys are resolved via string literalt()calls rather than dynamic lookups liket(`keyboard-shortcuts.shortcuts.${shortcut.translationKey}`).KeyboardShortcutsHelp/index.jsxto use the newgetShortcuts(t)API.Visuals (if applicable)
N/A
Additional Information
This rule only enforces that
t()arguments are string literals. It does not validate that translation keys actually exist in locale files.Developer Validations
yarn lintfrom the root of the repo & committed changes