eslint-plugin-i18n
Detect and autofix strings which require externalization in Vanilla JS files.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install @gitlab/eslint-plugin-i18n:
$ npm install @gitlab/eslint-plugin-i18n --save-dev
Note: If you installed ESLint globally (using the -g flag) then you must also install @gitlab/eslint-plugin-i18n globally.
Usage
Add @gitlab/eslint-plugin-i18n to the plugins section of your .eslintrc configuration file. You can omit the @gitlab/eslint-plugin- prefix:
JSON:
{
"plugins": ["@gitlab/i18n"]
}YAML:
plugins:
- @gitlab/i18nThen configure the rules you want to use under the rules section.
JSON:
{
"rules": {
"@gitlab/i18n/no-non-i18n-strings": "error"
}
}YAML:
rules:
"@gitlab/i18n/no-non-i18n-strings": errorVueJS (.vue files)
@gitlab/eslint-plugin-i18n can also detect strings requiring externalization for code within the <script></script> tags of a .vue file.
Editor support
-
Visual studio Code + Vetur: add
.vueto your linting configuration -
Atom + linter-eslint: add
text.html.vueto your list of scopes
Supported Rules
Contribution guidelines
Please refer to gitlab-ce's CONTRIBUTING.md for details on our guidelines.