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:
+6
-6
@@ -1,4 +1,4 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import camelCase from 'lodash.camelcase';
|
||||
|
||||
import { type FlatMetadataValidator } from 'src/engine/metadata-modules/types/flat-metadata-validator.type';
|
||||
@@ -11,26 +11,26 @@ import { STARTS_WITH_LOWER_CASE_AND_CONTAINS_ONLY_CAPS_AND_LOWER_LETTERS_AND_NUM
|
||||
|
||||
export const METADATA_NAME_VALIDATORS: FlatMetadataValidator<string>[] = [
|
||||
{
|
||||
message: t`Name is too long`,
|
||||
message: msg`Name is too long`,
|
||||
validator: (name) => exceedsDatabaseIdentifierMaximumLength(name),
|
||||
},
|
||||
{
|
||||
message: t`Name is too short`,
|
||||
message: msg`Name is too short`,
|
||||
validator: (name) => beneathDatabaseIdentifierMinimumLength(name),
|
||||
},
|
||||
{
|
||||
message: t`Name should be in camelCase`,
|
||||
message: msg`Name should be in camelCase`,
|
||||
validator: (name) => name !== camelCase(name),
|
||||
},
|
||||
{
|
||||
message: t`Name is not valid: it must start with lowercase letter and contain only alphanumeric letters`,
|
||||
message: msg`Name is not valid: it must start with lowercase letter and contain only alphanumeric letters`,
|
||||
validator: (name) =>
|
||||
!name.match(
|
||||
STARTS_WITH_LOWER_CASE_AND_CONTAINS_ONLY_CAPS_AND_LOWER_LETTERS_AND_NUMBER_STRING_REGEX,
|
||||
),
|
||||
},
|
||||
{
|
||||
message: t`The name is not available`,
|
||||
message: msg`The name is not available`,
|
||||
validator: (name) => RESERVED_METADATA_NAME_KEYWORDS.includes(name),
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user