Skip to content

Commit a2a4f40

Browse files
committed
lib: restrict usage of fetch related globals in core internals
1 parent a137eca commit a2a4f40

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

lib/.eslintrc.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ rules:
3939
message: "Use `const { Atomics } = globalThis;` instead of the global."
4040
- name: Blob
4141
message: "Use `const { Blob } = require('buffer');` instead of the global."
42+
- name: BroadcastChannel
43+
message: "Use `const { BroadcastChannel } = require('internal/worker/io');` instead of the global."
4244
- name: Buffer
4345
message: "Use `const { Buffer } = require('buffer');` instead of the global."
4446
- name: DOMException
@@ -47,18 +49,22 @@ rules:
4749
message: "Use `const { Event } = require('internal/event_target');` instead of the global."
4850
- name: EventTarget
4951
message: "Use `const { EventTarget } = require('internal/event_target');` instead of the global."
52+
- name: Headers
53+
message: "Use `const { Headers } = require('internal/deps/undici/undici');` instead of the global."
5054
# Intl is not available in primordials because it can be
5155
# disabled with --without-intl build flag.
5256
- name: Intl
5357
message: "Use `const { Intl } = globalThis;` instead of the global."
54-
- name: BroadcastChannel
55-
message: "Use `const { BroadcastChannel } = require('internal/worker/io');` instead of the global."
5658
- name: MessageChannel
5759
message: "Use `const { MessageChannel } = require('internal/worker/io');` instead of the global."
5860
- name: MessageEvent
5961
message: "Use `const { MessageEvent } = require('internal/worker/io');` instead of the global."
6062
- name: MessagePort
6163
message: "Use `const { MessagePort } = require('internal/worker/io');` instead of the global."
64+
- name: Request
65+
message: "Use `const { Request } = require('internal/deps/undici/undici');` instead of the global."
66+
- name: Response
67+
message: "Use `const { Response } = require('internal/deps/undici/undici');` instead of the global."
6268
# SharedArrayBuffer is not available in primordials because it can be
6369
# disabled with --no-harmony-sharedarraybuffer CLI flag.
6470
- name: SharedArrayBuffer
@@ -79,6 +85,8 @@ rules:
7985
message: "Use `const { atob } = require('buffer');` instead of the global."
8086
- name: btoa
8187
message: "Use `const { btoa } = require('buffer');` instead of the global."
88+
- name: fetch
89+
message: "Use `const { fetch } = require('internal/deps/undici/undici');` instead of the global."
8290
- name: global
8391
message: "Use `const { globalThis } = primordials;` instead of `global`."
8492
- name: globalThis

0 commit comments

Comments
 (0)