fix: Enable Lingui recommended rules and fix all translation violations (#14133)

- Enable lingui/no-single-variables-to-translate and all other
recommended Lingui rules
- Fix single variable translation patterns (t`${variable}` → variable)
- Fix expression-in-message violations by extracting variables
- Fix t-call-in-function violations by moving translations inside
functions
- Update ESLint configs to use linguiPlugin.configs['flat/recommended']
- Clean up unused imports and improve translation patterns
This commit is contained in:
Félix Malfait
2025-08-28 15:12:38 +02:00
committed by GitHub
parent 6eb9a4e024
commit e264d7f32b
24 changed files with 99 additions and 84 deletions
@@ -1,4 +1,4 @@
import { t } from '@lingui/core/macro';
import { msg, t } from '@lingui/core/macro';
import { type FlatObjectMetadataValidationError } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata-validation-error.type';
import { type FlatObjectMetadata } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type';
@@ -20,11 +20,11 @@ export const validateFlatObjectMetadataLabel = ({
const validators: FlatMetadataValidator<string>[] = [
{
validator: (label) => beneathDatabaseIdentifierMinimumLength(label),
message: t`Object label is too short`,
message: msg`Object label is too short`,
},
{
validator: (label) => exceedsDatabaseIdentifierMaximumLength(label),
message: t`Object label is too long`,
message: msg`Object label is too long`,
},
];
@@ -43,8 +43,8 @@ export const validateFlatObjectMetadataLabel = ({
if (labelsAreIdentical) {
errors.push({
code: ObjectMetadataExceptionCode.INVALID_OBJECT_INPUT,
userFriendlyMessage: `The singular and plural labels cannot be the same for an object`,
message: t`The singular and plural labels cannot be the same for an object`,
message: `The singular and plural labels cannot be the same for an object`,
userFriendlyMessage: t`The singular and plural labels cannot be the same for an object`,
value: labelSingular,
});
}