Skip to content

Commit 7fc68f9

Browse files
aduh95bengl
authored andcommitted
lib: restrict usage of fetch related globals in core internals
PR-URL: #41957 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
1 parent 916cda4 commit 7fc68f9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/.eslintrc.yaml

+10
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: DOMException
@@ -45,6 +47,8 @@ rules:
4547
message: Use `const { Event } = require('internal/event_target');` instead of the global.
4648
- name: EventTarget
4749
message: Use `const { EventTarget } = require('internal/event_target');` instead of the global.
50+
- name: Headers
51+
message: Use `const { Headers } = require('internal/deps/undici/undici');` instead of the global.
4852
# Intl is not available in primordials because it can be
4953
# disabled with --without-intl build flag.
5054
- name: Intl
@@ -55,6 +59,10 @@ rules:
5559
message: Use `const { MessageEvent } = require('internal/worker/io');` instead of the global.
5660
- name: MessagePort
5761
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.
5866
# SharedArrayBuffer is not available in primordials because it can be
5967
# disabled with --no-harmony-sharedarraybuffer CLI flag.
6068
- name: SharedArrayBuffer
@@ -81,6 +89,8 @@ rules:
8189
message: Use `const { Crypto } = require('internal/crypto/webcrypto');` instead of the global.
8290
- name: CryptoKey
8391
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.
8494
- name: global
8595
message: Use `const { globalThis } = primordials;` instead of `global`.
8696
- name: globalThis

0 commit comments

Comments
 (0)