JSPM

eslint-plugin-i18n-checker

1.4.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1468
  • Score
    100M100P100Q114327F
  • License MIT

Check i18n keys existence

Package Exports

  • eslint-plugin-i18n-checker
  • eslint-plugin-i18n-checker/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-i18n-checker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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