Registry / testing / ilib-lint-apple

ilib-lint-apple

JSON →
library1.0.1jsnpmunverified

A plugin for ilib-lint that validates Apple platform string parameters, specifically ensuring Swift string interpolation placeholders like \(name) are correctly preserved in translated targets. Version 1.0.1 is current, with node.js 14+ and ESM support required. Unlike generic string linters, it targets Apple ecosystem files and provides a dedicated 'resource-swift-params' rule along with an 'apple' ruleset for easy integration into XLIFF file type checking.

npm install ilib-lint-apple
INSTALL
IMPORT
SIG · ILIB-LINT-APPLE
I
ilib-lint-apple
testingjavascriptv1.0.1
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.

plugin
import plugin from 'ilib-lint-apple'
The plugin is exported as default; no named exports are provided.
ResourceSwiftParamsRule
import { ResourceSwiftParamsRule } from 'ilib-lint-apple'
import ResourceSwiftParamsRule from 'ilib-lint-apple'
Rule classes are named exports; do not use default import.
AppleRuleSet
import { AppleRuleSet } from 'ilib-lint-apple'
Rule sets are also named exports.

Shows how to install and configure the plugin to validate Swift string parameters in XLIFF files.

// Install: npm install --save-dev ilib-lint-apple // In ilib-lint-config.json: { "plugins": ["ilib-lint-apple"], "filetypes": { "xliff": { "ruleset": ["apple"] } } } // Run: npx ilib-lint check -f xliff translations.xliff
Debug
Known issues
gotchaPlugin requires node.js 14+ and ESM module system. CJS require() will not work.
fix
Use import syntax or set type: 'module' in package.json. Alternatively, upgrade to Node 14+.
affects: >=1.0.0
gotchaThe rule 'resource-swift-params' only checks for Swift-style interpolation \(param). Other placeholders (e.g., %@) are not validated.
fix
For Objective-C format specifiers, use additional rules from other plugins or configure ilib-lint's built-in format checking.
affects: >=1.0.0
gotchaPlugin may produce false positives for strings containing literal \(... ) that are not Swift interpolation (e.g., in code comments).
fix
Ignore false positives via ilib-lint's inline suppression comments like // eslint-disable-next-line or resource-level ignore flags.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/ilib-lint-apple/index.js from /path/to/project/ilib-lint-config.json not supported.
Using require() on an ESM-only module; ilib-lint-apple is ESM, but project may use CommonJS.
fix
Change project to ESM (type: 'module' in package.json) or use dynamic import(). Ensure node version >=14.
Parsing error: The 'resource-swift-params' rule is not configured.
Plugin loaded but rule set not enabled for the file type.
fix
Add 'ruleset': ['apple'] under the appropriate filetype in ilib-lint-config.json.
TypeError: Cannot read properties of undefined (reading 'swiftParams')
Corrupted or mismatched plugin version. Possibly the plugin not properly loaded or incompatible with ilib-lint version.
fix
Reinstall ilib-lint-apple and ensure ilib-lint is up-to-date. Run npm install --save-dev ilib-lint-apple@latest.
Error: Plugin 'ilib-lint-apple' not found. Did you install it?
Plugin missing from node_modules or not listed in plugins array.
fix
Run npm install --save-dev ilib-lint-apple and verify the package is in package.json devDependencies.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
ilib-lintrequiredCore linting framework; plugin is designed to extend ilib-lint functionality
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
ilib-lint-apple — npm install ilib-lint-apple · libregistry