Skip to content

Commit

Permalink
lib: restrict usage of fetch related globals in core internals
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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]>
  • Loading branch information
aduh95 authored and bengl committed Feb 21, 2022
1 parent 9b7af71 commit f3fa03e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f3fa03e

Please sign in to comment.