From f3fa03ed3c28713693f906b74790cadaf56d1a67 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 13 Feb 2022 12:23:05 +0100 Subject: [PATCH] lib: restrict usage of fetch related globals in core internals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/41957 Reviewed-By: Michaël Zasso Reviewed-By: Mestery Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Tobias Nießen Reviewed-By: Anto Aravinth Reviewed-By: Filip Skokan --- lib/.eslintrc.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 2e8aa9956d91b9..7c2fe5461b2b96 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -37,6 +37,8 @@ rules: # disabled with --no-harmony-atomics CLI flag. - name: Atomics message: Use `const { Atomics } = globalThis;` instead of the global. + - name: BroadcastChannel + message: Use `const { BroadcastChannel } = require('internal/worker/io');` instead of the global. - name: Buffer message: Use `const { Buffer } = require('buffer');` instead of the global. - name: DOMException @@ -45,6 +47,8 @@ rules: message: Use `const { Event } = require('internal/event_target');` instead of the global. - name: EventTarget message: Use `const { EventTarget } = require('internal/event_target');` instead of the global. + - name: Headers + message: Use `const { Headers } = require('internal/deps/undici/undici');` instead of the global. # Intl is not available in primordials because it can be # disabled with --without-intl build flag. - name: Intl @@ -55,6 +59,10 @@ rules: message: Use `const { MessageEvent } = require('internal/worker/io');` instead of the global. - name: MessagePort message: Use `const { MessagePort } = require('internal/worker/io');` instead of the global. + - name: Request + message: Use `const { Request } = require('internal/deps/undici/undici');` instead of the global. + - name: Response + message: Use `const { Response } = require('internal/deps/undici/undici');` instead of the global. # SharedArrayBuffer is not available in primordials because it can be # disabled with --no-harmony-sharedarraybuffer CLI flag. - name: SharedArrayBuffer @@ -75,6 +83,8 @@ rules: message: Use `const { atob } = require('buffer');` instead of the global. - name: btoa message: Use `const { btoa } = require('buffer');` instead of the global. + - name: fetch + message: Use `const { fetch } = require('internal/deps/undici/undici');` instead of the global. - name: global message: Use `const { globalThis } = primordials;` instead of `global`. - name: globalThis