eslint-plugin-i18n-lingui
ESLint Plugin to enforce i18n best practices.
You should use this plugin if:
- You use lingui to localize your application.
- You want to avoid common pitfalls in wrapping source strings that could result poor quality translations.
Installation
npm install eslint-plugin-i18n-lingui --save-dev
yarn add eslint-plugin-i18n-lingui --dev
Usage
Add i18n-lingui
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix.
plugins: [
"i18n-lingui"
]
Then configure the rules you want to use under the rules
section.
rules: {
"i18n-lingui/rule-name": 1, // warning
"i18n-lingui/another-rule-name": 2, // error
}
List of supported rules
Has Fixer | Rule | Description |
---|---|---|
no-eval-in-placeholder | No evaluation of placeholder values in wrapped strings. | |
✔️ | prefer-unicode-ellipsis | Detects three periods (... ) and replaces it with unicode ellipses (… ) |
no-useless-string-wrapping | No wrapping a string that only contains an expression. | |
✔️ | prefer-smartquote | Detects apostrophe ' and double quotes " and replaces them with smartquotes. |