eslint-plugin-translations

1.0.0 • Public • Published

eslint-plugin-translations

Eslint plugin to deal with boring translations/locales.

Installation

Install ESLint either locally or globally.

$ npm install eslint-plugin-translations

Configuration

Add plugins and rules section in your eslint configuration:

{
  "plugins": [
    "translations"
  ],
  "rules": {
    "translations/PLUGIN_NAME": [2, {
      "languagePaths": [
        "locales/en.json",
        "locales/de.js"
      ],
      "functionName": "translate",
      "ignoreExtensions": [ ".test.js", ".css" ]
    }]
  }
}

Plugins

exists will search for all "translate" calls and see if the first argument (normally your locale) has been defined in your locale files.

en.json

{
  "HELLO": "Hello"
}

de.js

module.exports = {
  HELLO: 'Hallo'
}

file1.js

const myAwesomei18n = require('myAwesomei18n')
 
myAwesomei18n.translate('GOOD_BYE {{name}}', {name: 'lobezno'})

This will show that GOOD_BYE {{name}} is not defined in your locales files.

Readme

Keywords

none

Package Sidebar

Install

npm i eslint-plugin-translations

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • estebanuscanga