Skip to content

Use node: schema to import Node.js builtins (#1782)#1782

Closed
robhogan wants to merge 1 commit into
mainfrom
robhogan/prefer-node-protocol
Closed

Use node: schema to import Node.js builtins (#1782)#1782
robhogan wants to merge 1 commit into
mainfrom
robhogan/prefer-node-protocol

Conversation

@robhogan

@robhogan robhogan commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary:
A stylistic choice to unify on node:-prefixed imports, eg fs -> node:fs.

Reasoning:

  • New Node builtins are only available under the prefix (eg node:sqlite), as this allows Node to introduce them without ecosystem breaking changes, so this is the direction of travel and the only choice that’ll allow consistency.
  • Encouraging them and grouping them separately makes it easier to reason about a module’s 3rd party dependencies.

Change:

  • ESLint warn when Node.js builtin modules are imported without the node: scheme
  • Migrate existing imports, exports, and requires to node: specifiers
  • Update Jest mocks to match the new module specifiers

Changelog: Internal

Test Plan:

  • yarn lint
  • 29 affected Jest suites (950 tests, 94 snapshots)

Reviewed By: huntie

Differential Revision: D112733139

Pulled By: robhogan

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 19, 2026
@robhogan
robhogan force-pushed the robhogan/prefer-node-protocol branch from 0cea1d2 to 4fc92a7 Compare July 19, 2026 13:59
@robhogan
robhogan changed the base branch from main to robhogan/flow-node-protocol-aliases July 19, 2026 13:59
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jul 19, 2026
@robhogan
robhogan force-pushed the robhogan/prefer-node-protocol branch from 4fc92a7 to 6f637c3 Compare July 19, 2026 14:13
@robhogan
robhogan changed the base branch from robhogan/flow-node-protocol-aliases to main July 19, 2026 14:15
@meta-codesync

meta-codesync Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

@robhogan has imported this pull request. If you are a Meta employee, you can view this in D112733139.

Summary:
A stylistic choice to unify on `node:`-prefixed imports, eg `fs` -> `node:fs`.

Reasoning:

- New Node builtins are *only* available under the prefix (eg `node:sqlite`), as this allows Node to introduce them without ecosystem breaking changes, so this is the direction of travel and the only choice that’ll allow consistency.
- Encouraging them and grouping them separately makes it easier to reason about a module’s 3rd party dependencies.

Change:

- ESLint warn when Node.js builtin modules are imported without the `node:` scheme
- Migrate existing imports, exports, and requires to `node:` specifiers
- Update Jest mocks to match the new module specifiers

Changelog: Internal

Pull Request resolved: #1782

Test Plan:
- `yarn lint`
- 29 affected Jest suites (950 tests, 94 snapshots)

Reviewed By: huntie

Differential Revision: D112733139

Pulled By: robhogan
@robhogan
robhogan force-pushed the robhogan/prefer-node-protocol branch from 6f637c3 to 7a625a3 Compare July 20, 2026 10:41
@meta-codesync meta-codesync Bot changed the title Use node: protocol for Node.js builtins Use node: schema to import Node.js builtins (#1782) Jul 20, 2026
@meta-codesync

meta-codesync Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@robhogan has exported this pull request. If you are a Meta employee, you can view the originating Diff in D112733139.

@meta-codesync

meta-codesync Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@robhogan merged this pull request in 148f491.

@meta-codesync meta-codesync Bot added the Merged label Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged meta-exported Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant