You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add enableFix option to @intlify/vue-i18n/no-unused-keys rule (#83)
* Add quick fix to remove unused keys to the `@intlify/vue-i18n/no-unused-keys` rule.
- Other Updates
- Change to use eslint-plugin-jsonc.
- Remove json processor as it is no longer needed.
- Add `/base` config for testcases.
* Add `enableFix` option to `@intlify/vue-i18n/no-unused-keys` rule
Copy file name to clipboardExpand all lines: docs/rules/no-unused-keys.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
> disallow unused localization keys
4
4
5
+
-:black_nib:️ The `--fix` option on the [command line](http://eslint.org/docs/user-guide/command-line-interface#fix) can automatically fix some of the problems reported by this rule.
6
+
5
7
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.
6
8
7
9
## :book: Rule Details
@@ -101,10 +103,12 @@ i18n.t('hi')
101
103
{
102
104
"@intlify/vue-i18n/no-unused-keys": ["error", {
103
105
"src": "./src",
104
-
"extensions": [".js", ".vue"]
106
+
"extensions": [".js", ".vue"],
107
+
"enableFix": false
105
108
}]
106
109
}
107
110
```
108
111
109
112
-`src`: specify the source codes directory to be able to lint. If you don't set any options, it set to `process.cwd()` as default.
110
113
-`extensions`: an array to allow specified lintable target file extension. If you don't set any options, it set to `.js` and` .vue` as default.
114
+
-`enableFix`: if `true`, enable automatically remove unused keys on `eslint --fix`. If you don't set any options, it set to `false` as default. (This is an experimental feature.)
If you already use other parser (e.g. `"parser": "babel-eslint"`), please move it into `parserOptions`, so it doesn't collide with the `vue-eslint-parser` used by this plugin's configuration:
0 commit comments