Rules

no-node-imports

Prefer Effect Platform services over direct Node built-ins.

Purpose and behavior

Prefer Effect Platform services over direct Node built-ins.

Checks static imports and re-exports beginning with node:. Whitelists compare exact names after node:, so fs does not implicitly permit fs/promises. Bare fs, dynamic imports and require calls are outside the current listener coverage.

Options

No options means no node: imports are allowed. Accepts a string array, { allow: string[] }, or { allowed: string[] }; allow and allowed are combined. Example: ["error", { "allow": ["path", "fs/promises"] }].

Invalid example

import { readFile } from 'node:fs/promises'

Valid example

import { Effect } from 'effect'

Fixes and exceptions

This rule reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.

For a genuine boundary exception, use an oxlint-disable-next-line rules/no-node-imports -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.

Source and tests

Enabled by the Effect preset.

no-node-imports.ts · Tests