eslint-plugin-signavio-i18n
check rules for signavio-i18n
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-signavio-i18n
:
$ npm install eslint-plugin-signavio-i18n --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-signavio-i18n
globally.
Usage
Add signavio-i18n
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"signavio-i18n"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"signavio-i18n/rule-name": 2
}
}
Rule details
translator-comment-matches-pattern
Checks if translator comment matches provided pattern.
This considered to be warning:
//'signavio-i18n/translator-comment-matches-pattern': [1, '.*, PEX-'],
// translators: toast message when user is already added
KEY: i18n('text')
// translators: toast message when user is already added PEX-5594
KEY: i18n('text')
This considered to be valid, note the comma before PEX-5594
:
//'signavio-i18n/translator-comment-matches-pattern': [1, '.*, PEX-'],
// translators: toast message when user is already added, PEX-5594
KEY: i18n('text')
no-missing-translators-comment
All translator comments must start with translators:
This considered to be warning:
// toast message when user is already added
KEY: i18n('text')
This considered to be valid:
// translators: toast message when user is already added
KEY: i18n('text')
missing-parameter
Keys used in the template, must be present in the passed configuration object.
This considered to be warning:
i18n(
'Here come __firstParam__, __secondParam__ and __missingParam__.',
{
firstParam,
secondParam,
}
)
This considered to be valid:
i18n(
'Here come __firstParam__, __secondParam__ and __thirdParam__.',
{
firstParam,
secondParam,
thirdParam,
}
)
Supported Rules
- Fill in provided rules here