Registry /
testing / eslint-plugin-i18n-json
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 (eslint config)
✓ // In .eslintrc plugins array
"plugins": ["i18n-json"]
✗ const plugin = require('eslint-plugin-i18n-json'); // Direct require is not typical; use config file plugins field
Plugin is loaded via ESLint config, not directly imported in code.
recommended config
✓ // .eslintrc
extends: ["plugin:i18n-json/recommended"]
✗ extends: ["eslint-plugin-i18n-json"]
Use the plugin prefix 'plugin:' for accessing rulesets.
individual rule
✓ // .eslintrc rules
"i18n-json/valid-json": "error"
✗ "valid-json": "error"
All rules must be namespaced with 'i18n-json/' prefix.
flat config (ESLint >=9)
✓ import i18nJson from 'eslint-plugin-i18n-json';
export default [
{ plugins: { 'i18n-json': i18nJson }, rules: { 'i18n-json/valid-json': 'error' } }
];
✗ const i18nJson = require('eslint-plugin-i18n-json'); // CJS not supported in flat config; use import
Flat config requires ESM import of the plugin object.
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/
Debug
Known issues
gotchaThe identical-keys rule requires a reference locale file path specified via 'filePath' option; without it, the rule will not work and may produce confusing errors.fixAdd the 'filePath' option to the rule configuration pointing to your source locale file (e.g., './translations/en-US/index.json').
affects: >=1.0.0
gotchaThe default sort for sorted-keys is case-sensitive ascending. If your project uses case-insensitive or natural sort, you must provide a custom sort function.fixConfigure a custom sort function in rule options: `"i18n-json/sorted-keys": ["error", { "sortFunction": "natural" }]` or a custom comparator. affects: >=1.0.0
deprecatedLodash per-function packages (like lodash.get, lodash.set) were deprecated and removed; internal usage migrated to main lodash in v4.0.1.fixUpdate to v4.0.1 or above to avoid deprecated modules.
affects: >=4.0.0
gotchaThe plugin does not lint files outside of the ESLint file glob; you must include your translation files in ESLint's 'overrides' or include patterns (e.g., 'translations/**/*.json').fixAdd an overrides block in .eslintrc: `"overrides": [{ "files": ["translations/**/*.json"], "rules": { ... } }]`. affects: >=1.0.0
breakingFlat config (ESLint >=9) changes how plugins are loaded; CJS require() will not work; must use ESM import.fixUse `import i18nJson from 'eslint-plugin-i18n-json'` and attach as object property in flat config array.
affects: >=9.0.0 (ESLint)
Errors
Common errors & fixes
Error: ESLint configuration in .eslintrc is invalid: - Unexpected top-level property "i18n-json/ignore-keys"
Settings for i18n-json/ignore-keys must be placed under the 'settings' key, not at the top level of .eslintrc.
fixMove `"i18n-json/ignore-keys": [...]` inside the `"settings"` object: `{ "settings": { "i18n-json/ignore-keys": [...] } }`. Error: Cannot find module '@formatjs/icu-messageformat-parser'
The plugin requires @formatjs/icu-messageformat-parser for the default valid-message-syntax rule; it is not installed automatically.
fixRun `npm install --save-dev @formatjs/icu-messageformat-parser` or disable the rule if not needed.
Error: Failed to load plugin 'i18n-json': Cannot find module 'eslint-plugin-i18n-json'
The plugin is not installed or ESLint cannot resolve it; common in monorepos without hoisting.
fixEnsure `eslint-plugin-i18n-json` is listed in devDependencies and installed. If using workspaces, ensure the package is in the root node_modules.
Audit
Dependencies
eslintrequiredpeer dependency, required for plugin to function
@formatjs/icu-messageformat-parseroptionalused by default valid-message-syntax rule for ICU parsing
lodashrequiredutility library for internal operations (removed deprecated per-function packages in v4.0.1)