diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 8299e79a00eba0..f3a0d9f1d3e5c9 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -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 diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index aff24f93455c8b..5e29c72918a163 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -17,6 +17,7 @@ const { ReflectOwnKeys, Symbol, SymbolHasInstance, + WeakMap, } = primordials; const { trace } = internalBinding('trace_events'); diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 8b0a7a0d7aab66..19d6d93e6683a5 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -18,6 +18,7 @@ const { ObjectKeys, Symbol, SymbolFor, + WeakMap, } = primordials; const messages = new Map(); diff --git a/lib/internal/process/promises.js b/lib/internal/process/promises.js index e2a589a802682d..01450d75dfeae9 100644 --- a/lib/internal/process/promises.js +++ b/lib/internal/process/promises.js @@ -2,6 +2,7 @@ const { ObjectDefineProperty, + WeakMap, } = primordials; const { diff --git a/lib/internal/source_map/source_map_cache.js b/lib/internal/source_map/source_map_cache.js index 8211e51e3ec413..2d30d53db84c9e 100644 --- a/lib/internal/source_map/source_map_cache.js +++ b/lib/internal/source_map/source_map_cache.js @@ -7,6 +7,7 @@ const { ObjectGetOwnPropertyDescriptor, ObjectPrototypeHasOwnProperty, MapPrototypeEntries, + WeakMap, WeakMapPrototypeGet, uncurryThis, } = primordials; diff --git a/lib/internal/vm/module.js b/lib/internal/vm/module.js index 2a89165409dec6..d12362184a5051 100644 --- a/lib/internal/vm/module.js +++ b/lib/internal/vm/module.js @@ -7,6 +7,7 @@ const { ObjectDefineProperty, SafePromise, Symbol, + WeakMap, } = primordials; const { isContext } = internalBinding('contextify');