Use node: for Node.js builtin modules

Use the the `node:` protocol when importing Node.js builtin modules
and enable rule in eslint to enforce.

The `node:` protocol for Node.js builtin modules has been available
since Node.js v14.

See: https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/enforce-node-protocol-usage.md
This commit is contained in:
Alan Orth
2025-08-05 15:07:46 +03:00
parent 67a17e4ea1
commit af71c152c1
8 changed files with 25 additions and 17 deletions

View File

@@ -8,7 +8,7 @@ import ITEMS from './data/items.json';
import { fakeDataBase } from './db';
const { Router } = require('express');
const util = require('util');
const util = require('node:util');
// you would use cookies/token etc
const USER_ID = 'f9d98cf1-1b96-464e-8755-bcc2a5c09077'; // hardcoded as an example