From e1338fb4e857bdacc0e9364f449cda38959da261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 29 Jun 2026 10:53:00 +0200 Subject: [PATCH] docs: add node-builtin-specifier lint rule --- lint/rules/node-builtin-specifier.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lint/rules/node-builtin-specifier.md diff --git a/lint/rules/node-builtin-specifier.md b/lint/rules/node-builtin-specifier.md new file mode 100644 index 000000000..188bcb15d --- /dev/null +++ b/lint/rules/node-builtin-specifier.md @@ -0,0 +1,28 @@ +--- +tags: [recommended] +--- + +Enforces the use of the `node:` specifier for Node built-in modules. + +Deno requires Node built-in modules to be imported with the `node:` specifier. +Importing them with a bare specifier (e.g. `"fs"`) is not supported and only +works by accident in some setups, so this rule reports a warning and offers a +quick fix that adds the `node:` prefix. + +### Invalid: + +```typescript +import * as path from "path"; +import * as fs from "fs"; +import * as fsPromises from "fs/promises"; +await import("os"); +``` + +### Valid: + +```typescript +import * as path from "node:path"; +import * as fs from "node:fs"; +import * as fsPromises from "node:fs/promises"; +await import("node:os"); +```