eslint-plugin-i18n-checker

1.4.0 • Public • Published

eslint-plugin-i18n-checker

Check i18n keys existence

Installation

You"ll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-i18n-checker:

npm install eslint-plugin-i18n-checker --save-dev

Usage

Add i18n-checker to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "i18n-checker"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
      "i18n-checker/json-key-exists": [
        2,
        {
          "functionNames": [
            "i18n.t",
            "t"
          ],
          "localesPath": "public/locales",
          "specifics": [
            {
              "matcher": "^global:(.*)$",
              "to": "global.json"
            },
            {
              "matcher": "^(.*)$",
              "to": "app.json"
            }
          ]
        }
      ],
      "i18n-checker/key-must-be-literal": [
        1,
        {
          "functionNames": ["i18n.t", "t"]
        }
      ],
      "i18n-checker/no-literal-in-jsx": [
        1,
        {
          "allowList": ["-"]
        }
      ]
    }
}

Supported Rules

  • json-key-exists
  • key-must-be-literal
  • no-literal-in-jsx

Package Sidebar

Install

npm i eslint-plugin-i18n-checker

Weekly Downloads

1,173

Version

1.4.0

License

MIT

Unpacked Size

20 kB

Total Files

18

Last publish

Collaborators

  • lucinyan