Registry / devops / li18nt

li18nt

JSON →
library5.0.0jsnpmunverified

An ESM-only (since v5.0.0) CLI and API tool for linting, formatting, sorting, and deduplicating i18n locale JSON files. It detects cross-file type conflicts, duplicate translations, and enforces consistent property naming and alphabetical ordering. Zero runtime dependencies, ships TypeScript types, and can auto-fix issues. Released under MIT, maintained actively by Simonwep. Unlike general JSON linters, li18nt is purpose-built for translation workflows.

npm install li18nt
INSTALL
IMPORT
SIG · LI18NT
L
li18nt
devopsjavascriptv5.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

li18nt
import { li18nt } from 'li18nt'
const li18nt = require('li18nt')
ESM-only since v5.0.0.
LintResult
import type { LintResult } from 'li18nt'
const { LintResult } = require('li18nt')
Type import for TypeScript users. Not a runtime export.
default (CLI)
npx li18nt locales/*.json
CLI usage via npx or global install.

Installs li18nt, creates a configuration file with common rules, and runs the linter with auto-fix on locale JSON files.

// Install: npm install li18nt // Create config .li18ntrc.json in project root or locales/ { "rules": { "prettified": "warn", "conflicts": "error", "duplicates": "error", "sorting": "error", "naming": ["warn", { "patterns": ["^[a-z]"] }] } } // Run: npx li18nt locales/*.json --fix
Debug
Known issues
breakingESM-only since v5.0.0: li18nt is ESM-only and cannot be required() with CommonJS.
fix
Switch to ES modules ("type": "module" in package.json) or use dynamic import().
affects: >=5.0.0
deprecatedConfig file lookup changed: li18nt.config.js is deprecated in favor of .li18ntrc, .li18nt.json, or .li18ntrc.json.
fix
Rename li18nt.config.js to .li18ntrc.json.
affects: >=4.0.0
gotchaCase-sensitive property naming: The default naming pattern matches lowercase start, but patterns are case-sensitive regexes.
fix
Ensure your naming patterns use regex syntax correctly, e.g., "^[a-z]" matches lowercase start.
affects: all
gotchaConfig file location: li18nt looks for config in current working directory, not the directory of the linted files.
fix
Run li18nt from the project root, or use --config to specify an explicit path.
affects: all
gotchaSorting order: Sorting is alphabetical but case-sensitive; uppercase comes before lowercase.
fix
Consider using lowercase keys or adjust sorting expectations.
affects: all
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/li18nt/lib/li18nt.mjs not supported.
Using require() to load li18nt v5+ which is ESM-only.
fix
Switch to import statement: import { li18nt } from 'li18nt'.
SyntaxError: Unexpected token '?' (or other parse error in config file)
Config file is not valid JSON (e.g., uses JavaScript syntax in .json or comments).
fix
Use strict JSON for .json configs, or switch to .js file with module.exports.
Error: No configuration found
No .li18ntrc, .li18nt.json, .li18ntrc.json, or li18nt.config.js exists in current directory.
fix
Create a configuration file, for example .li18ntrc.json in the project root.
Error: Cannot find module 'li18nt'
li18nt is not installed globally, or you forgot to install locally.
fix
Run npm install li18nt or npx li18nt.
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
packageli18nt
li18nt — npm install li18nt · libregistry