GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc,tools: enforce use of `node:` prefix · nodejs/node@44a08f7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc
    • api
      • async_hooks.md
      • timers.md
      • wasi.md
      • worker_threads.md
    • eslint.config_partial.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/async_hooks.md‎

Copy file name to clipboardExpand all lines: doc/api/async_hooks.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ import {
704704
executionAsyncId,
705705
executionAsyncResource,
706706
createHook,
707-
} from 'async_hooks';
707+
} from 'node:async_hooks';
708708
const sym = Symbol('state'); // Private symbol to avoid pollution
709709

710710
createHook({
Collapse file

‎doc/api/timers.md‎

Copy file name to clipboardExpand all lines: doc/api/timers.md
+4-4Lines changed: 4 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ import {
378378
setTimeout,
379379
setImmediate,
380380
setInterval,
381-
} from 'timers/promises';
381+
} from 'node:timers/promises';
382382
```
383383

384384
```cjs
@@ -408,7 +408,7 @@ added: v15.0.0
408408
```mjs
409409
import {
410410
setTimeout,
411-
} from 'timers/promises';
411+
} from 'node:timers/promises';
412412

413413
const res = await setTimeout(100, 'result');
414414

@@ -442,7 +442,7 @@ added: v15.0.0
442442
```mjs
443443
import {
444444
setImmediate,
445-
} from 'timers/promises';
445+
} from 'node:timers/promises';
446446

447447
const res = await setImmediate('result');
448448

@@ -483,7 +483,7 @@ or implicitly to keep the event loop alive.
483483
```mjs
484484
import {
485485
setInterval,
486-
} from 'timers/promises';
486+
} from 'node:timers/promises';
487487

488488
const interval = 100;
489489
for await (const startTime of setInterval(interval, Date.now())) {
Collapse file

‎doc/api/wasi.md‎

Copy file name to clipboardExpand all lines: doc/api/wasi.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ operating system via a collection of POSIX-like functions.
1717

1818
```mjs
1919
import { readFile } from 'node:fs/promises';
20-
import { WASI } from 'wasi';
20+
import { WASI } from 'node:wasi';
2121
import { argv, env } from 'node:process';
2222

2323
const wasi = new WASI({
@@ -40,7 +40,7 @@ wasi.start(instance);
4040
```cjs
4141
'use strict';
4242
const { readFile } = require('node:fs/promises');
43-
const { WASI } = require('wasi');
43+
const { WASI } = require('node:wasi');
4444
const { argv, env } = require('node:process');
4545
const { join } = require('node:path');
4646

Collapse file

‎doc/api/worker_threads.md‎

Copy file name to clipboardExpand all lines: doc/api/worker_threads.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ Node.js event loop.
14551455
import {
14561456
Worker,
14571457
isMainThread,
1458-
} from 'worker_threads';
1458+
} from 'node:worker_threads';
14591459
14601460
if (isMainThread) {
14611461
new Worker(new URL(import.meta.url));
Collapse file

‎doc/eslint.config_partial.mjs‎

Copy file name to clipboardExpand all lines: doc/eslint.config_partial.mjs
+15-1Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { requireEslintTool } from '../tools/eslint/eslint.config_utils.mjs';
1+
import {
2+
noRestrictedSyntaxCommonAll,
3+
noRestrictedSyntaxCommonLib,
4+
requireEslintTool,
5+
} from '../tools/eslint/eslint.config_utils.mjs';
6+
import { builtinModules as builtin } from 'node:module';
27

38
const globals = requireEslintTool('globals');
49

@@ -8,6 +13,15 @@ export default [
813
rules: {
914
// Ease some restrictions in doc examples.
1015
'no-restricted-properties': 'off',
16+
'no-restricted-syntax': [
17+
'error',
18+
...noRestrictedSyntaxCommonAll,
19+
...noRestrictedSyntaxCommonLib,
20+
{
21+
selector: `CallExpression[callee.name="require"][arguments.0.type="Literal"]:matches(${builtin.map((name) => `[arguments.0.value="${name}"]`).join(',')}),ImportDeclaration:matches(${builtin.map((name) => `[source.value="${name}"]`).join(',')})`,
22+
message: 'Use `node:` prefix.',
23+
},
24+
],
1125
'no-undef': 'off',
1226
'no-unused-expressions': 'off',
1327
'no-unused-vars': 'off',

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.