Skip to content

Commit f4e3917

Browse files
aduh95danielleadams
authored andcommitted
lib: restrict usage of fetch related globals in core internals
PR-URL: #41957 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent 82b64f4 commit f4e3917

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎lib/.eslintrc.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ rules:
3737
# disabled with --no-harmony-atomics CLI flag.
3838
- name: Atomics
3939
message: Use `const { Atomics } = globalThis;` instead of the global.
40+
- name: BroadcastChannel
41+
message: Use `const { BroadcastChannel } = require('internal/worker/io');` instead of the global.
4042
- name: Buffer
4143
message: Use `const { Buffer } = require('buffer');` instead of the global.
4244
- name: Event
@@ -57,6 +59,10 @@ rules:
5759
message: Use `const { MessageEvent } = require('internal/worker/io');` instead of the global.
5860
- name: MessagePort
5961
message: Use `const { MessagePort } = require('internal/worker/io');` instead of the global.
62+
- name: Request
63+
message: Use `const { Request } = require('internal/deps/undici/undici');` instead of the global.
64+
- name: Response
65+
message: Use `const { Response } = require('internal/deps/undici/undici');` instead of the global.
6066
# SharedArrayBuffer is not available in primordials because it can be
6167
# disabled with --no-harmony-sharedarraybuffer CLI flag.
6268
- name: SharedArrayBuffer
@@ -83,6 +89,8 @@ rules:
8389
message: Use `const { Crypto } = require('internal/crypto/webcrypto');` instead of the global.
8490
- name: CryptoKey
8591
message: Use `const { CryptoKey } = require('internal/crypto/webcrypto');` instead of the global.
92+
- name: fetch
93+
message: Use `const { fetch } = require('internal/deps/undici/undici');` instead of the global.
8694
- name: global
8795
message: Use `const { globalThis } = primordials;` instead of `global`.
8896
- name: globalThis

0 commit comments

Comments
 (0)