Skip to content
On this page

@intlify/vue-i18n/prefer-sfc-lang-attr

require lang attribute on <i18n> block

  • ✒️️ The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule enforce lang attribute to be specified to <i18n> custom block.

👎 Examples of incorrect code for this rule:

locale messages:

vue
<i18n>
{
  "en": {
    "message": "hello!"
  }
}
</i18n>
<script>
/* eslint @intlify/vue-i18n/prefer-sfc-lang-attr: 'error' */
</script>

👍 Examples of correct code for this rule:

locale messages:

vue
<i18n lang="json">
{
  "en": {
    "message": "hello!"
  }
}
</i18n>
<script>
/* eslint @intlify/vue-i18n/prefer-sfc-lang-attr: 'error' */
</script>

🚀 Version

This rule was introduced in @intlify/eslint-plugin-vue-i18n v1.2.0

🔍 Implementation