@naturacosmeticos/eslint-plugin-i18n-checker

1.0.1 • Public • Published

eslint-plugin-i18n-checker

Known Vulnerabilities Build Status Codacy Badge

This eslint plugin helps you identify what locales keys are not included in your locales files.

Considering the follow scenario:

--locales/
----en-us.json
----es-pe.json
----pt-br.json
--src/
-----components/
-------header.js

In your header.js you have a call to your i18n function to get the localized value of the string logout: translate('logout')

The i18n-checker will verify if the logout is defined in each locale file you have.

How to use

Installation

npm i --save-dev '@naturacosmeticos/eslint-plugin-i18n-checker'

yarn add -D '@naturacosmeticos/eslint-plugin-i18n-checker'

Configuration

In your eslintrc file you need to add @naturacosmeticos/i18n-checker in the plugins section.

Options

You can configure the following options:

  • localesPath - string - your locales relative path (default is /locales/)
  • messagesBasePath - string - if your locales files has a base path you can pass it (default is undefined)
  • translationFunctionName - string - the name of your translation function (default is translate)

Example:

"@naturacosmeticos/i18n-checker/path-in-locales": ['error',
  {
    localesPath: 'public/locales/',
    messagesBasePath: 'translations',
    translationFunctionName: 't'
  }
]

Contributing

You can contribute submitting pull requests.

Setup

Install the dependencies running yarn in the project folder.

Lint

Just run yarn lint

Tests

You can run the following commands:

  • yarn test
  • yarn test:watch

Package Sidebar

Install

npm i @naturacosmeticos/eslint-plugin-i18n-checker

Weekly Downloads

27

Version

1.0.1

License

MIT

Unpacked Size

66.6 kB

Total Files

17

Last publish

Collaborators

  • marcelofabricanti
  • designsystemnatura
  • mukaportes
  • vicentelyrio
  • robert-lichtnow
  • douglasofreitas
  • jimmyandrade
  • lauralucca
  • marcelsaitonatura
  • eliisrael