@intlify/vue-i18n/no-unused-keys
disallow unused localization keys
- ✒️️ The
--fixoption on the command line can automatically fix some of the problems reported by this rule.
Localization keys that not used anywhere in the code are most likely an error due to incomplete refactoring. Such localization keys take up code size and can lead to confusion by readers.
📖 Rule Details
This rule is aimed at eliminating unused localization keys.
👎 Examples of incorrect code for this rule:
locale messages:
For SFC.
👍 Examples of correct code for this rule:
locale messages:
⚙️ Options
json
{
"@intlify/vue-i18n/no-unused-keys": [
"error",
{
"src": "./src",
"extensions": [".js", ".vue"],
"ignores": [],
"enableFix": false
}
]
}src: specify the source codes directory to be able to lint. If you don't set any options, it set toprocess.cwd()as default.extensions: an array to allow specified lintable target file extension. If you don't set any options, it set to.jsand.vueas default.ignores: An array of key names and patterns to exclude from the check. If you want to specify a pattern, specify a string such as/pattern/.enableFix: iftrue, enable automatically remove unused keys oneslint --fix. If you don't set any options, it set tofalseas default. (This is an experimental feature.)
👫 Related Rules
🚀 Version
This rule was introduced in @intlify/eslint-plugin-vue-i18n v0.1.0