eslint-plugin-t
This plugin contains lint rules related to internationalization, particularly for strings wrapped in t()
.
Installation
-
Add eslint-plugin-t
to your devDependencies.
-
Add t
to the plugins
section of your ESLint configuration.
{
"plugins": ["t"]
}
- Enable the rule(s) that you want ESLint to enforce.
{
"rules": {
"t/string-literal": "warn"
}
}
Rules
Currently there's only one rule.
string-literal
Ensures that only a string literal can be passed as the first argument to t()
.
Example:
alert(t('Hello World!'));
alert(t('Hello' + name + '!'));