Registry /
devops / eslint-barrel-file-utils
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
syncFunction
✓ import { syncFunction } from 'eslint-barrel-file-utils';
✗ const { syncFunction } = require('eslint-barrel-file-utils');
ES Modules syntax is preferred; CommonJS `require` can be problematic with native addons and TypeScript types.
sleepFunction
✓ import { sleepFunction } from 'eslint-barrel-file-utils';
✗ const sleepFunction = require('eslint-barrel-file-utils').sleepFunction;
Named exports are used for functions exposed from the native addon.
NativeAddonModule
✓ import * as NativeAddonModule from 'eslint-barrel-file-utils';
✗ import NativeAddonModule from 'eslint-barrel-file-utils';
There is no default export; the native module exports multiple named functions. Use `* as` for grouping.
Demonstrates how to import and call both synchronous and asynchronous functions exposed by the N-API native addon.
import { syncFunction, sleepFunction } from 'eslint-barrel-file-utils';
console.log('Calling synchronous native function...');
const result = syncFunction();
console.log(`Sync function returned: ${result}`);
console.log('Calling asynchronous native function (sleep for 200ms)...');
// In a real application, you might `await` this, but for demonstration, we just call it.
sleepFunction(200);
console.log('Sleep function called. Execution continues in JS thread.');
// Await a promise if the sleepFunction were to return one
// async function runAsync() {
// console.log('Calling truly async native function...');
// const asyncResult = await sleepFunctionAsync(200);
// console.log(`Async function completed after: ${asyncResult}ms`);
// }
// runAsync();
Debug
Known issues
gotchaThe package name `eslint-barrel-file-utils` is misleading. This package is primarily a template project for `napi-rs` native addons and does not contain any actual ESLint utility functions. Users seeking ESLint barrel file utilities should look for `eslint-plugin-barrel-files` (from the same author) or similar plugins.fixIf intending to develop a `napi-rs` project, follow the template instructions (fork, rename). If seeking an ESLint plugin, install `eslint-plugin-barrel-files` instead.
affects: >=0.0.1
breaking`napi-rs` v3 (released after `napi-rs` v2) introduced significant breaking changes in its CLI, configuration, and Rust API. Projects forked from this template that attempt to upgrade their `napi-rs` dependency to v3 will require code and configuration updates. Key changes include `napi.name` to `napi.binaryName`, `napi.triples` to `napi.targets`, and changes to `ThreadsafeFunction` usage.fixConsult the `napi-rs` v2 to v3 migration guide for detailed instructions on updating `Cargo.toml`, `package.json` configuration, and Rust code.
affects: >=3.0.0 (for `napi-rs` itself)
gotchaWhile `napi-rs` simplifies native addon development, local development and custom builds still require a Rust toolchain (`rustup`) to be installed. Prebuilt binaries distributed via `optionalDependencies` on npm typically mitigate this for end-users, but developers modifying the Rust source will need a functional Rust environment.fixInstall the latest stable Rust toolchain via `rustup` as per the official Rust documentation. Ensure Node.js 10+ is also installed.
affects: >=0.0.1
gotchaWhen passing `Buffer` or `TypedArray` instances between JavaScript and Rust, `napi-rs` v2 (which this template likely uses as `eslint-barrel-file-utils` is version 0.0.15) might introduce unnecessary overhead by automatically creating references. `napi-rs` v3 addresses this by enforcing explicit `Reference<Buffer>` or `BufferRef` for async scenarios, but v2 projects might incur performance costs or encounter unsoundness if `&mut _` is used with async functions.fixFor optimal performance and correctness in `napi-rs` v2 projects, carefully manage `Buffer` and `TypedArray` ownership. Consider upgrading to `napi-rs` v3 and adopting its explicit `Reference<Buffer>` patterns for async operations to ensure zero-overhead data transfer and memory safety.
affects: <3.0.0 (of `napi-rs` runtime)
Errors
Common errors & fixes
Error: Cannot find module 'eslint-barrel-file-utils/darwin-x64' or similar platform-specific module.
The native binary for the current platform/architecture could not be found or loaded by Node.js.
fixEnsure `npm install` (or `yarn install`) completed successfully. This error often indicates a problem during installation where the correct platform-specific optional dependency failed to download, or the native binary was not built for the target environment. Check npm logs for details or try cleaning `node_modules` and reinstalling. If developing, ensure `yarn build` was run to generate the local native addon.
N-API Error: This function must be called on the main thread.
A native function that interacts with the V8 JavaScript engine (e.g., creating objects or manipulating the JS event loop) was called from a Rust thread that is not the main Node.js event loop thread.
fixFor Rust functions intended to be called asynchronously and not block the main thread, ensure they use `ThreadsafeFunction` or `Async` patterns provided by `napi-rs` to safely communicate results back to the main JavaScript thread. Avoid direct V8 API calls from background threads.
TypeError: 'argument' must be a number
A JavaScript argument passed to a Rust function did not match the expected type (e.g., passing a string where a number was expected).
fixVerify the JavaScript types of arguments passed to native functions match the Rust function signatures (e.g., `i32` expects a number, `String` expects a string). Refer to the generated TypeScript type definitions for the correct function signatures.
Audit
Dependencies
No dependency data recorded yet.