Skip to main content

Runtime - Node

Lint Node.js code with the recommended eslint-plugin-n ruleset, guard against raw console and process.exit, and relax hashbang enforcement on source-level CLI entry points.

Why Use This Preset?

  1. Applies eslint-plugin-n's recommended rules for Node.js correctness and unsupported APIs.
  2. Bans raw console output so logging flows through the Logger toolkit battery instead.
  3. Disallows process.exit() so error handling stays structured rather than terminating abruptly.
  4. Warns on synchronous APIs so you avoid blocking the event loop.
  5. Turns off hashbang enforcement for source-level CLI entry points, since the bin field points to the build output rather than the source file.

Usage

Import runtimeNode from the ESLint presets entry and spread it into your flat config after the language layer, in the documented layer order.

eslint.config.mts
ts
import {
  dxCodeStyle,
  dxIgnore,
  langTypescript,
  runtimeNode,
} from '@cbnventures/nova/presets/eslint';

export default [
  ...dxIgnore,
  ...dxCodeStyle,
  ...langTypescript,
  ...runtimeNode,
];

What This Preset Configures

The preset registers eslint-plugin-n and applies its recommended Node.js ruleset, then adds project-specific rules and one scoped exception. Each group targets every script extension, except the CLI hashbang exception, which applies only to CLI entry points.

Registers eslint-plugin-n and spreads its recommended ruleset for Node.js. Nova disables n/no-missing-import because that rule can reject valid conditional package exports; TypeScript or checkJs remains the source of truth for module resolution.

Bad habits

RuleWhat it enforces
no-consoleBans raw console output so logging flows through the Logger battery.
no-process-exitDisallows process.exit() so error handling stays structured.
no-syncWarns on synchronous APIs like fs.readFileSync so the event loop is not blocked.

CLI hashbang

RuleWhat it enforces
n/hashbangDisabled on src/bin/index.* and src/cli/index.*, since the bin field points to the build output rather than the source file.