ilib-lint-webos

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

Ilib-lint-webos is a plugin for ilib-lint that adds support for parsing webOS XLIFF files and provides linting rules specific to webOS internationalization. Version 1.3.0, released January 2025, targets Node.js >=14 and uses ESM modules. It is part of the iLib mono-webos repository and focuses on ensuring correct i18n practices for webOS apps. Key differentiators include built-in support for webOS XLIFF format and custom rules for webOS localization constraints.

error const plugin = require('ilib-lint-webos'); Error [ERR_REQUIRE_ESM]: require() of ES Module ...
cause The package is ESM-only; using require() is not supported.
fix
Use import plugin from 'ilib-lint-webos' and ensure your project uses ESM.
error Failed to load plugin: TypeError: plugin is not a constructor
cause Trying to instantiate the plugin class directly instead of passing it to ilib-lint.
fix
Pass the imported plugin object to ilib-lint's constructor or config, do not call new plugin().
error Rule 'webos-no-unused-strings' is not registered
cause Plugin not loaded or rule name misspelled.
fix
Verify plugin is in 'plugins' config and use correct rule name: 'no-unused-strings' (without webos- prefix).
breaking ESM-only: this module is ESM-only and cannot be required with require().
fix Use import syntax or set type: 'module' in package.json.
deprecated The method 'lintWebOS()' was deprecated in v1.2.0 and removed in v1.3.0.
fix Replace with 'lint(type: 'xlf')' from ilib-lint directly.
gotcha Plugin configuration requires 'plugins' array in ilib-lint-config.json, not 'extends'.
fix Add "plugins": ["ilib-lint-webos"] to your config file.
gotcha XLIFF files must use webOS namespace URI 'https://webostv.developer.lge.com/xliff'.
fix Ensure your XLIFF files have the correct namespace or the plugin will skip them.
npm install ilib-lint-webos
yarn add ilib-lint-webos
pnpm add ilib-lint-webos

Import the ilib-lint-webos plugin and use it with ilib-lint to lint a webOS XLIFF file.

import plugin from 'ilib-lint-webos';
import { Linter } from 'ilib-lint';

const linter = new Linter({
  plugins: [plugin],
  files: ['path/to/webos-strings.xliff'],
  rules: {
    'webos-no-unused-strings': 'error'
  }
});

const results = await linter.lint();
console.log(JSON.stringify(results, null, 2));