Registry /
testing / eslint-plugin-i18n-json
An ESLint plugin for linting JSON i18n translation files, version 4.0.1. It validates JSON syntax, ICU message syntax, checks identical keys across locales, sorts keys, and ensures placeholder consistency. Requires ESLint >=4.0.0. Maintained by GoDaddy with a focus on fully extendable rules and settings (e.g., custom message syntax, custom sort, key ignoring). Supports flat config (ESLint >=9) and nested keys. Release cadence is intermittent; last update April 2024 fixing Lodash deprecation.
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Plugin is loaded via ESLint config, not directly imported in code.
// In .eslintrc plugins array
"plugins": ["i18n-json"]
Use the plugin prefix 'plugin:' for accessing rulesets.
// .eslintrc
extends: ["plugin:i18n-json/recommended"]
All rules must be namespaced with 'i18n-json/' prefix.
// .eslintrc rules
"i18n-json/valid-json": "error"
Flat config requires ESM import of the plugin object.
import i18nJson from 'eslint-plugin-i18n-json';
export default [
{ plugins: { 'i18n-json': i18nJson }, rules: { 'i18n-json/valid-json': 'error' } }
];
Install the plugin and ESLint, configure .eslintrc.json with recommended rules and identical-keys, create sample translation files, and run ESLint.
npm install --save-dev eslint-plugin-i18n-json eslint
# Create .eslintrc.json in project root
cat > .eslintrc.json << 'EOF'
{
"plugins": ["i18n-json"],
"extends": ["plugin:i18n-json/recommended"],
"rules": {
"i18n-json/identical-keys": ["error", { "filePath": "./translations/en-US/index.json" }],
"i18n-json/identical-placeholders": "error"
},
"settings": {
"i18n-json/ignore-keys": ["_metadata"]
}
}
EOF
# Create sample translation files
mkdir -p translations/en-US translations/es-MX
echo '{"greeting": "Hello", "farewell": "Goodbye"}' > translations/en-US/index.json
echo '{"greeting": "Hola", "farewell": "Adiós"}' > translations/es-MX/index.json
# Run ESLint on the translation directory
npx eslint translations/
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.