Skip to content

@intlify/vue-i18n/key-format-style

enforce specific casing for localization keys

This rule aims to enforces specific casing for localization key names.

yaml
camelCaseKey: The key for this value is camel case.
kebab-case-key: The key for this value is kebab case.
lowercase: The key for this value is lower case.
snake_case_key: The key for this value is snake case.
mixed_Case-key: Perhaps you don't want to use this casing.

📖 Rule Details

This rule reports localization keys other than the specific casing. Also, the following localization key definitions are reported as errors, because the casing cannot determine.

👎 Examples of incorrect code for this rule:

⚙️ Options

json
{
  "@intlify/vue-i18n/key-format-style": [
    "error",
    "camelCase" | "kebab-case" | "lowercase" | "snake_case",
    {
      "allowArray": false,
      "splitByDots": false
    }
  ]
}
  • Primary Option: Select the casing you want to apply. It set to "camelCase" as default
  • allowArray: If true, allow the use of arrays. If false, disallow the use of arrays. It set to false as default.
  • splitByDots: If true, check the values of the key name split by dots.

👍 Examples of correct code for this rule with "camelCase":

👎 Examples of incorrect code for this rule with "camelCase":

👍 Examples of correct code for this rule with "kebab-case":

👎 Examples of incorrect code for this rule with "kebab-case":

👍 Examples of correct code for this rule with "lowercase":

👎 Examples of incorrect code for this rule with "lowercase":

👍 Examples of correct code for this rule with "snake_case":

👎 Examples of incorrect code for this rule with "snake_case":

👍 Examples of correct code for this rule with {"allowArray": true}:

🚀 Version

This rule was introduced in @intlify/eslint-plugin-vue-i18n v0.9.0

🔍 Implementation