{"id":25747,"library":"ilib-lint-javascript","title":"iLib Lint JavaScript Plugin","description":"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.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/iLib-js/ilib-mono","tags":["javascript"],"install":[{"cmd":"npm install ilib-lint-javascript","lang":"bash","label":"npm"},{"cmd":"yarn add ilib-lint-javascript","lang":"bash","label":"yarn"},{"cmd":"pnpm add ilib-lint-javascript","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; CommonJS require will fail.","wrong":"const plugin = require('ilib-lint-javascript')","symbol":"default","correct":"import plugin from 'ilib-lint-javascript'"},{"note":"If the package exports a Rules object; check actual exports.","wrong":"","symbol":"Rules","correct":"import { Rules } from 'ilib-lint-javascript'"},{"note":"If exported as a named function, default import is incorrect.","wrong":"import createPlugin from 'ilib-lint-javascript'","symbol":"plugin as a function","correct":"import { createPlugin } from 'ilib-lint-javascript'"}],"quickstart":{"code":"// Install: npm install --save-dev ilib-lint-javascript\n// ilib-lint-config.json\n{\n  \"plugins\": [\"ilib-lint-javascript\"],\n  \"rulesets\": {\n    \"recommended\": [\n      \"resource-ilib-plural-syntax-checker\",\n      \"resource-ilib-plural-categories-checker\"\n    ]\n  }\n}","lang":"javascript","description":"Configures ilib-lint to use the JavaScript plugin with plural rules."},"warnings":[{"fix":"Use Node.js >=12 and import with ESM syntax.","message":"ESM-only: Node.js <12 or usage with require() will fail.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade to Node.js >=18.","message":"Node.js 12 and 14 are end-of-life; future versions may drop support.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure \"plugins\" array contains exactly \"ilib-lint-javascript\".","message":"Plugin must be added to ilib-lint-config.json under plugins array; missing or misnamed will not load.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use ilib-lint with appropriate file type plugins to extract resources.","message":"Rules only apply to resource files (e.g., XLIFF, JSON), not raw JS source code.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Convert plural strings to ilib syntax before linting.","message":"Plural syntax checker expects ilib-style plural strings; ICU or other formats will be flagged as errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to import statement or set { \"type\": \"module\" } in package.json.","cause":"Using require() to load an ESM-only module.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Run 'npm install --save-dev ilib-lint-javascript'.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'ilib-lint-javascript'"},{"fix":"Verify plugin is in ilib-lint-config.json plugins array and rule name is correct.","cause":"Plugin not loaded or rule name misspelled in configuration.","error":"Unknown rule: resource-ilib-plural-syntax-checker"},{"fix":"Check export structure; use correct import syntax.","cause":"Plugin imported incorrectly (default import when expecting named export).","error":"TypeError: plugin is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}