Packaging Rust rules
Wrap a crate's rules with nativePlugin (from @lintrs/cli/native):
lintrs loads the prebuilt package for the platform key, else builds crate,
else fails. Platform key: `${process.platform}-${process.arch}`, plus
-gnu on Linux. The plugin's rules are stubs (meta.lintrs.native: true)
that throw under plain ESLint.
Prebuilt packages
Output: the rule library and a package.json with
"lintrs": { "library", "abi" }. Publish one package per platform key and list
them in nativePlugin({ prebuilt }). Users need no Rust toolchain or SDK.
Local packages
With crate:, lintrs builds on first use. Needs:
- the SDK:
lintrs-sdk-<version>-<target>.tar.gzextracted next tolib/, orLINTRS_SDK_DIR(the SDK ships as a release tarball only, not on npm); cargoand the fingerprint'srustc. Withrustup, lintrs selects it (RUSTUP_TOOLCHAIN); install withrustup toolchain install <version>. Withoutrustup, therustconPATHmust match.
Builds are cached in LINTRS_CACHE_DIR (default ~/.cache/lintrs), keyed by
fingerprint and source hash. Hits never run Cargo.
Version lock
The ABI fingerprint (lintrs version, tsrs revision, rustc version, build id)
must match exactly; on mismatch lintrs prints both. Rule libraries link against
lib/liblintrs.*: never copy or rename it. Only the .node wrapper and rule
libraries may move.
