@boring-stack-pkg/eslint-plugin-i18n-keys
v0.1.2
Published
ESLint rule: static i18n t() keys must exist in a canonical JSON dictionary.
Readme
eslint-plugin-i18n-keys
ESLint rule: static t("…") / i18n.t("…") translation keys must exist in a canonical JSON dictionary (nested keys use dot paths).
Install
pnpm add -D @boring-stack-pkg/eslint-plugin-i18n-keysPeer deps: eslint 8.57 / 9+, @typescript-eslint/parser 8+, typescript 5+.
Use (flat config)
import tsParser from "@typescript-eslint/parser";
import i18nKeys from "eslint-plugin-i18n-keys";
export default [
{
files: ["**/*.{ts,tsx}"],
languageOptions: { parser: tsParser },
plugins: { "i18n-keys": i18nKeys },
rules: {
"i18n-keys/static-translation-key-exists": [
"error",
{ dictionary: "src/lib/i18n/locales/en/common.json" },
],
},
},
];The bundled recommended config enables the same rule; override dictionary to match your repo’s locale file path.
Rules
| Rule | Description |
| ------------------------------- | ------------------------------------------------------------------------------------------------- |
| static-translation-key-exists | String-literal keys must appear in the JSON dictionary (leaf strings define valid terminal keys). |
Development
pnpm install
pnpm test
pnpm buildLicense
MIT.
