lib: replace WeakMap global by the primordials

PR-URL: https://github.com/nodejs/node/pull/31158
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Sebastien Ahkrin
2020-01-02 15:05:55 +01:00
committed by Rich Trott
parent e56840368b
commit f509aaa7fa
6 changed files with 7 additions and 0 deletions

View File

@@ -29,6 +29,8 @@ rules:
message: "Use `const { Reflect } = primordials;` instead of the global."
- name: Symbol
message: "Use `const { Symbol } = primordials;` instead of the global."
- name: WeakMap
message: "Use `const { WeakMap } = primordials;` instead of the global."
no-restricted-syntax:
# Config copied from .eslintrc.js
- error

View File

@@ -17,6 +17,7 @@ const {
ReflectOwnKeys,
Symbol,
SymbolHasInstance,
WeakMap,
} = primordials;
const { trace } = internalBinding('trace_events');

View File

@@ -18,6 +18,7 @@ const {
ObjectKeys,
Symbol,
SymbolFor,
WeakMap,
} = primordials;
const messages = new Map();

View File

@@ -2,6 +2,7 @@
const {
ObjectDefineProperty,
WeakMap,
} = primordials;
const {

View File

@@ -7,6 +7,7 @@ const {
ObjectGetOwnPropertyDescriptor,
ObjectPrototypeHasOwnProperty,
MapPrototypeEntries,
WeakMap,
WeakMapPrototypeGet,
uncurryThis,
} = primordials;

View File

@@ -7,6 +7,7 @@ const {
ObjectDefineProperty,
SafePromise,
Symbol,
WeakMap,
} = primordials;
const { isContext } = internalBinding('contextify');