Skip to content

doc: fix inconsistencies in CJS code snippets#63199

Open
aduh95 wants to merge 1 commit intonodejs:mainfrom
aduh95:cjs-consistent-snippets
Open

doc: fix inconsistencies in CJS code snippets#63199
aduh95 wants to merge 1 commit intonodejs:mainfrom
aduh95:cjs-consistent-snippets

Conversation

@aduh95
Copy link
Copy Markdown
Contributor

@aduh95 aduh95 commented May 8, 2026

Some of our snippets have 'use strict' statement and import process from node:process, and the vast majority does not (not explicit 'use strict', and use the global process).

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite
  • @nodejs/test_runner
  • @nodejs/wasi

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label May 8, 2026
@aduh95 aduh95 force-pushed the cjs-consistent-snippets branch from 86425e7 to ca2a4b6 Compare May 8, 2026 15:23
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@aduh95 aduh95 force-pushed the cjs-consistent-snippets branch from ca2a4b6 to f230a6d Compare May 8, 2026 15:28
@JakobJingleheimer
Copy link
Copy Markdown
Member

Isn't importing process from node:process recommended? (If someone, shouldn't the fix go the other direction?)

@aduh95
Copy link
Copy Markdown
Contributor Author

aduh95 commented May 8, 2026

Isn't importing process from node:process recommended? (If someone, shouldn't the fix go the other direction?)

It's enforced on ESM files/code snippets (IIRC the rationale is that folks writing CJS are likely writing Node.js-only code, and therefore will be more likely to use Node.js-only globals – and conversely, folks writing ESM would be more likely to not want to use Node.js-only globals)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants