@gravity-ui/eslint-plugin-i18n
v2.6.1
Published
Eslint rules for i18n
Downloads
5,466
Readme
@gravity-ui/eslint-plugin-i18n
Rules for i18n linting.
How to connect to a project
Install the package:
npm i --save-dev @gravity-ui/eslint-plugin-i18nConnect the plugin and rules to the eslint config.
Add to the client config (
src/ui/.eslintrc):{ "plugins": ["@gravity-ui/eslint-plugin-i18n"], "rules": { "@gravity-ui/i18n/detect-incorrect-calls": "error", "@gravity-ui/i18n/auto-generate-translation-message-id": "error" } }
Rules
| Name | Description |
| :----------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- |
| restrict-i18n-imports | Prohibits importing text files (i18n.ts) from directories of other levels. |
| auto-generate-translation-message-id | Checks for the presence of an identifier in the translation object and adds it if missing |
| multiline-meta | In i18n.ts, requires meta in message definitions to be multiline objects (with line breaks), not single-line meta: { ... }. |
| sort-message-locales | Enforces locale order in message objects: ru, en, then other locales (source order), then meta. |
