@intlify/vue-i18n/no-duplicate-keys-in-locale
disallow duplicate localization keys within the same locale
If you manage localization messages in multiple files, duplicate localization keys across multiple files can cause unexpected problems.
📖 Rule Details
This rule reports duplicate localization keys within the same locale.
👎 Examples of incorrect code for this rule:
locale messages:
en.1.json
json
/* eslint @intlify/vue-i18n/no-duplicate-keys-in-locale: 'error' */
// ✗ BAD
{
"hello": "Hello! DIO!", // duplicate.
"hello": "Hello! DIO!", // duplicate.
"good-bye": "Good bye! DIO!"
}
en.2.json
json
/* eslint @intlify/vue-i18n/no-duplicate-keys-in-locale: 'error' */
// ✗ BAD
{
"good-bye": "Good bye! DIO!" // This same key exists in `en.1.json`.
}
👍 Examples of correct code for this rule:
locale messages:
en.1.json
json
/* eslint @intlify/vue-i18n/no-duplicate-keys-in-locale: 'error' */
// ✓ GOOD
{
"hello": "Hello! DIO!",
"hi": "Hi! DIO!"
}
en.2.json
json
/* eslint @intlify/vue-i18n/no-duplicate-keys-in-locale: 'error' */
// ✓ GOOD
{
"good-bye": "Good bye! DIO!"
}
⚙️ Options
json
{
"@intlify/vue-i18n/no-duplicate-keys-in-locale": [
"error",
{
"ignoreI18nBlock": false
}
]
}
ignoreI18nBlock
: Iftrue
, do not report key duplication between<i18n>
blocks and other files, it set tofalse
as default.
👫 Related Rules
🚀 Version
This rule was introduced in @intlify/eslint-plugin-vue-i18n
v0.9.0