iLib Lint JavaScript Plugin

raw JSON →
1.1.1 verified Fri May 01 auth: no javascript

An ilib-lint plugin providing rules and rulesets for linting localized string resources extracted from JavaScript files. Current stable version is 1.1.1, released as part of the ilib-mono repository. It checks ilib-style plural syntax and plural categories for target locales, enforcing correct resource formatting in JavaScript/i18n projects. Requires Node.js >=12 and is ESM-only. The plugin integrates via ilib-lint configuration and is designed for use within iLib localization toolchains.

error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
cause Using require() to load an ESM-only module.
fix
Change to import statement or set { "type": "module" } in package.json.
error Cannot find module 'ilib-lint-javascript'
cause Package not installed or not in node_modules.
fix
Run 'npm install --save-dev ilib-lint-javascript'.
error Unknown rule: resource-ilib-plural-syntax-checker
cause Plugin not loaded or rule name misspelled in configuration.
fix
Verify plugin is in ilib-lint-config.json plugins array and rule name is correct.
error TypeError: plugin is not a function
cause Plugin imported incorrectly (default import when expecting named export).
fix
Check export structure; use correct import syntax.
breaking ESM-only: Node.js <12 or usage with require() will fail.
fix Use Node.js >=12 and import with ESM syntax.
deprecated Node.js 12 and 14 are end-of-life; future versions may drop support.
fix Upgrade to Node.js >=18.
gotcha Plugin must be added to ilib-lint-config.json under plugins array; missing or misnamed will not load.
fix Ensure "plugins" array contains exactly "ilib-lint-javascript".
gotcha Rules only apply to resource files (e.g., XLIFF, JSON), not raw JS source code.
fix Use ilib-lint with appropriate file type plugins to extract resources.
gotcha Plural syntax checker expects ilib-style plural strings; ICU or other formats will be flagged as errors.
fix Convert plural strings to ilib syntax before linting.
npm install ilib-lint-javascript
yarn add ilib-lint-javascript
pnpm add ilib-lint-javascript

Configures ilib-lint to use the JavaScript plugin with plural rules.

// Install: npm install --save-dev ilib-lint-javascript
// ilib-lint-config.json
{
  "plugins": ["ilib-lint-javascript"],
  "rulesets": {
    "recommended": [
      "resource-ilib-plural-syntax-checker",
      "resource-ilib-plural-categories-checker"
    ]
  }
}