GitXplorerGitXplorer
L

eslint-plugin-i18n-checker

public
1 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
a8714248dbdc16601587c43b9302ef6bea872e70

chore: bump to v1.4.0

committed 3 years ago
Unverified
8d3c58814c5a42550bb3a2d201056ad6a9f0c92f

chore: add ignore

committed 3 years ago
Unverified
db87bf3f89ea8eb5cfad6935fa92fa0da23fcb2e

feat: no literal in jsx

committed 3 years ago
Unverified
bc34c25e9977b346cf4091619b017cfded3afa3e

chore: bump to v1.3.0

committed 3 years ago
Unverified
6f79d602a877e69c8a5b4a92f485f55ae627a0c7

feat: key-must-be-literal

committed 3 years ago
Unverified
647bee8d780b18216e554c8c48067e2170e3fac6

chore: update README

committed 3 years ago

README

The README file for this repository.

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