diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index ff9a0f595d2..0a5197e882b 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -23,6 +23,8 @@ rules: message: "Use `const { Object } = primordials;` instead of the global." - name: Reflect message: "Use `const { Reflect } = primordials;` instead of the global." + - name: Symbol + message: "Use `const { Symbol } = primordials;` instead of the global." no-restricted-syntax: # Config copied from .eslintrc.js - error diff --git a/lib/_http_agent.js b/lib/_http_agent.js index af25b2bba75..69fdb819a3a 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -25,6 +25,7 @@ const { ObjectKeys, ObjectSetPrototypeOf, ObjectValues, + Symbol, } = primordials; const net = require('net'); diff --git a/lib/_http_common.js b/lib/_http_common.js index d0f07d3b69e..dc6eba6333c 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -23,6 +23,7 @@ const { MathMin, + Symbol, } = primordials; const { setImmediate } = require('timers'); diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index c3bfbd09bfc..f40cf923f9b 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -28,6 +28,7 @@ const { ObjectKeys, ObjectPrototypeHasOwnProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; const { getDefaultHighWaterMark } = require('internal/streams/state'); diff --git a/lib/_http_server.js b/lib/_http_server.js index b967cac3ae4..192d0ddfb7a 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -24,6 +24,7 @@ const { ObjectKeys, ObjectSetPrototypeOf, + Symbol, } = primordials; const net = require('net'); diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 8f5f66b3912..6226bbf5eb4 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -27,6 +27,7 @@ const { NumberIsNaN, ObjectDefineProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; module.exports = Readable; diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 3452ac810be..5a88c817bd9 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -29,6 +29,7 @@ const { Array, ObjectDefineProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; module.exports = Writable; diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 4379287cc47..2a534694566 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -25,6 +25,7 @@ const { ObjectAssign, ObjectDefineProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; const { diff --git a/lib/async_hooks.js b/lib/async_hooks.js index a7ca5af7ef8..be32f6d1102 100644 --- a/lib/async_hooks.js +++ b/lib/async_hooks.js @@ -3,6 +3,7 @@ const { NumberIsSafeInteger, ReflectApply, + Symbol, } = primordials; const { diff --git a/lib/buffer.js b/lib/buffer.js index 8cbc0af538d..e318efc6540 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -34,6 +34,7 @@ const { ObjectDefineProperties, ObjectDefineProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; const { diff --git a/lib/domain.js b/lib/domain.js index 322e7eb9586..4f340f20ec3 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -30,6 +30,7 @@ const { Array, ObjectDefineProperty, ReflectApply, + Symbol, } = primordials; const EventEmitter = require('events'); diff --git a/lib/events.js b/lib/events.js index ce93cd9f9bf..203a20ed805 100644 --- a/lib/events.js +++ b/lib/events.js @@ -32,6 +32,7 @@ const { ObjectKeys, ReflectApply, ReflectOwnKeys, + Symbol, } = primordials; const kRejection = Symbol.for('nodejs.rejection'); diff --git a/lib/inspector.js b/lib/inspector.js index b2bad040cea..203cd739a7a 100644 --- a/lib/inspector.js +++ b/lib/inspector.js @@ -3,6 +3,7 @@ const { JSONParse, JSONStringify, + Symbol, } = primordials; const { diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js index b17406c7824..bf5456a8588 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -4,6 +4,7 @@ const { FunctionPrototypeBind, NumberIsSafeInteger, ObjectDefineProperty, + Symbol, } = primordials; const { diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 3836ee8e3d5..b07a38d6f6f 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -4,6 +4,7 @@ const { ArrayIsArray, ObjectDefineProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; const { diff --git a/lib/internal/child_process/serialization.js b/lib/internal/child_process/serialization.js index 48b6d7ffe00..9f03a8e8446 100644 --- a/lib/internal/child_process/serialization.js +++ b/lib/internal/child_process/serialization.js @@ -3,6 +3,7 @@ const { JSONParse, JSONStringify, + Symbol, } = primordials; const { Buffer } = require('buffer'); const { StringDecoder } = require('string_decoder'); diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 76b2066e9b7..85b88a72ea9 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -15,6 +15,7 @@ const { ObjectPrototypeHasOwnProperty, ObjectValues, ReflectOwnKeys, + Symbol, } = primordials; const { trace } = internalBinding('trace_events'); diff --git a/lib/internal/crypto/hash.js b/lib/internal/crypto/hash.js index 56784275f9c..dca0ba767f6 100644 --- a/lib/internal/crypto/hash.js +++ b/lib/internal/crypto/hash.js @@ -2,6 +2,7 @@ const { ObjectSetPrototypeOf, + Symbol, } = primordials; const { diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js index 25ef8884953..087cef014f0 100644 --- a/lib/internal/crypto/keys.js +++ b/lib/internal/crypto/keys.js @@ -2,6 +2,7 @@ const { ObjectDefineProperty, + Symbol, } = primordials; const { diff --git a/lib/internal/crypto/util.js b/lib/internal/crypto/util.js index 8bf66e9cdf3..286efc39a61 100644 --- a/lib/internal/crypto/util.js +++ b/lib/internal/crypto/util.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Symbol, +} = primordials; + const { getCiphers: _getCiphers, getCurves: _getCurves, diff --git a/lib/internal/dgram.js b/lib/internal/dgram.js index 0c0fefa27c1..8a8d9ba8c0d 100644 --- a/lib/internal/dgram.js +++ b/lib/internal/dgram.js @@ -1,4 +1,9 @@ 'use strict'; + +const { + Symbol, +} = primordials; + const { codes } = require('internal/errors'); const { UDP } = internalBinding('udp_wrap'); const { guessHandleType } = internalBinding('util'); diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index fe940f6e860..c053a3cfa31 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -7,6 +7,7 @@ const { ObjectCreate, ObjectDefineProperties, ObjectGetOwnPropertyDescriptors, + Symbol, } = primordials; const { diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 8e6962e2564..f76fe328c21 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -16,6 +16,7 @@ const { NumberIsInteger, ObjectDefineProperty, ObjectKeys, + Symbol, } = primordials; const messages = new Map(); diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js index 6135c3090da..60fff67f2e1 100644 --- a/lib/internal/freeze_intrinsics.js +++ b/lib/internal/freeze_intrinsics.js @@ -31,7 +31,7 @@ module.exports = function() { getOwnPropertyDescriptors, getOwnPropertyNames, getOwnPropertySymbols, - getPrototypeOf + getPrototypeOf, } = Object; const objectHasOwnProperty = Object.prototype.hasOwnProperty; const { ownKeys } = Reflect; diff --git a/lib/internal/fs/dir.js b/lib/internal/fs/dir.js index c4e0a3746c1..749e22ee696 100644 --- a/lib/internal/fs/dir.js +++ b/lib/internal/fs/dir.js @@ -2,6 +2,7 @@ const { ObjectDefineProperty, + Symbol, } = primordials; const pathModule = require('path'); diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index daf18e19d1c..cc3f98268c7 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -4,6 +4,7 @@ const { MathMax, MathMin, NumberIsSafeInteger, + Symbol, } = primordials; const { diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index 951030c5a50..ac258bdb112 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -7,6 +7,7 @@ const { NumberIsFinite, ObjectSetPrototypeOf, ReflectOwnKeys, + Symbol, } = primordials; const { Buffer } = require('buffer'); diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js index 7454ada7671..bb039fb67f0 100644 --- a/lib/internal/fs/watchers.js +++ b/lib/internal/fs/watchers.js @@ -3,6 +3,7 @@ const { ObjectDefineProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; const errors = require('internal/errors'); diff --git a/lib/internal/http.js b/lib/internal/http.js index 09294888be5..aab4170a2f0 100644 --- a/lib/internal/http.js +++ b/lib/internal/http.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Symbol, +} = primordials; + const { setUnrefTimeout } = require('internal/timers'); const { PerformanceEntry, notify } = internalBinding('performance'); diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 6a55b4edd19..94282cc4bb5 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -8,6 +8,7 @@ const { ObjectKeys, ObjectPrototypeHasOwnProperty, ReflectGetPrototypeOf, + Symbol, } = primordials; const assert = require('internal/assert'); diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 167044f8408..b48e405b8de 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -11,6 +11,7 @@ const { ObjectDefineProperty, ObjectPrototypeHasOwnProperty, ReflectGetPrototypeOf, + Symbol, } = primordials; const { diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js index d97ce2f13f0..3bf3a8fdd56 100644 --- a/lib/internal/http2/util.js +++ b/lib/internal/http2/util.js @@ -6,6 +6,7 @@ const { Number, ObjectCreate, ObjectKeys, + Symbol, } = primordials; const binding = internalBinding('http2'); diff --git a/lib/internal/js_stream_socket.js b/lib/internal/js_stream_socket.js index 7c35a55b1c9..1a805ae830b 100644 --- a/lib/internal/js_stream_socket.js +++ b/lib/internal/js_stream_socket.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Symbol, +} = primordials; + const { setImmediate } = require('timers'); const assert = require('internal/assert'); const { Socket } = require('net'); diff --git a/lib/internal/net.js b/lib/internal/net.js index bbdc9bf8437..5f6e476b582 100644 --- a/lib/internal/net.js +++ b/lib/internal/net.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Symbol, +} = primordials; + const Buffer = require('buffer').Buffer; const { writeBuffer } = internalBinding('fs'); const errors = require('internal/errors'); diff --git a/lib/internal/priority_queue.js b/lib/internal/priority_queue.js index afd2cef643b..c31c1eea385 100644 --- a/lib/internal/priority_queue.js +++ b/lib/internal/priority_queue.js @@ -2,6 +2,7 @@ const { Array, + Symbol, } = primordials; const kCompare = Symbol('compare'); diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js index d60b3320888..6c011e8533f 100644 --- a/lib/internal/repl/utils.js +++ b/lib/internal/repl/utils.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Symbol, +} = primordials; + const acorn = require('internal/deps/acorn/acorn/dist/acorn'); const privateMethods = require('internal/deps/acorn-plugins/acorn-private-methods/index'); diff --git a/lib/internal/stream_base_commons.js b/lib/internal/stream_base_commons.js index 504de5fc57f..800ba4cefd6 100644 --- a/lib/internal/stream_base_commons.js +++ b/lib/internal/stream_base_commons.js @@ -2,6 +2,7 @@ const { Array, + Symbol, } = primordials; const { Buffer } = require('buffer'); diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js index e05813e5dfd..a6b8bd9d181 100644 --- a/lib/internal/streams/async_iterator.js +++ b/lib/internal/streams/async_iterator.js @@ -4,6 +4,7 @@ const { ObjectCreate, ObjectGetPrototypeOf, ObjectSetPrototypeOf, + Symbol, } = primordials; const finished = require('internal/streams/end-of-stream'); diff --git a/lib/internal/streams/buffer_list.js b/lib/internal/streams/buffer_list.js index 5e23f2cf464..c7adc5b0731 100644 --- a/lib/internal/streams/buffer_list.js +++ b/lib/internal/streams/buffer_list.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Symbol, +} = primordials; + const { Buffer } = require('buffer'); const { inspect } = require('internal/util/inspect'); diff --git a/lib/internal/streams/duplexpair.js b/lib/internal/streams/duplexpair.js index 6735bcb2b92..ec92cbe8716 100644 --- a/lib/internal/streams/duplexpair.js +++ b/lib/internal/streams/duplexpair.js @@ -1,4 +1,9 @@ 'use strict'; + +const { + Symbol, +} = primordials; + const { Duplex } = require('stream'); const kCallback = Symbol('Callback'); diff --git a/lib/internal/streams/from.js b/lib/internal/streams/from.js index e809f2658d5..7e1c2fbb19d 100644 --- a/lib/internal/streams/from.js +++ b/lib/internal/streams/from.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Symbol, +} = primordials; + const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes; diff --git a/lib/internal/timers.js b/lib/internal/timers.js index 84b3c34d87c..1b6422f41ea 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -77,6 +77,7 @@ const { MathTrunc, NumberMIN_SAFE_INTEGER, ObjectCreate, + Symbol, } = primordials; const { diff --git a/lib/internal/trace_events_async_hooks.js b/lib/internal/trace_events_async_hooks.js index 87ee63d8ba7..84c7745e473 100644 --- a/lib/internal/trace_events_async_hooks.js +++ b/lib/internal/trace_events_async_hooks.js @@ -4,6 +4,7 @@ const { ObjectKeys, SafeMap, SafeSet, + Symbol, } = primordials; const { trace } = internalBinding('trace_events'); diff --git a/lib/internal/url.js b/lib/internal/url.js index 3c75baf27b0..54b9a18cafb 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -11,6 +11,7 @@ const { ObjectKeys, ReflectGetOwnPropertyDescriptor, ReflectOwnKeys, + Symbol, } = primordials; const { inspect } = require('internal/util/inspect'); diff --git a/lib/internal/util.js b/lib/internal/util.js index 0a319739187..526d2504eaf 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -11,7 +11,9 @@ const { ObjectGetPrototypeOf, ObjectSetPrototypeOf, ReflectConstruct, + Symbol, } = primordials; + const { codes: { ERR_INVALID_ARG_TYPE, diff --git a/lib/internal/util/comparisons.js b/lib/internal/util/comparisons.js index 734ecf6224a..0c3e1297222 100644 --- a/lib/internal/util/comparisons.js +++ b/lib/internal/util/comparisons.js @@ -15,6 +15,7 @@ const { ObjectPrototypePropertyIsEnumerable, ObjectPrototypeToString, StringPrototypeValueOf, + Symbol, SymbolPrototypeValueOf, } = primordials; diff --git a/lib/internal/vm/module.js b/lib/internal/vm/module.js index ee2fec2e431..9e6aa6b6b87 100644 --- a/lib/internal/vm/module.js +++ b/lib/internal/vm/module.js @@ -5,8 +5,8 @@ const { ArrayIsArray, ObjectCreate, ObjectDefineProperty, - Symbol, SafePromise, + Symbol, } = primordials; const { isContext } = internalBinding('contextify'); diff --git a/lib/internal/worker.js b/lib/internal/worker.js index fb033b24729..6051a021785 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -7,6 +7,7 @@ const { MathMax, ObjectCreate, ObjectEntries, + Symbol, } = primordials; const EventEmitter = require('events'); diff --git a/lib/internal/worker/io.js b/lib/internal/worker/io.js index a672dac94ce..1167198676b 100644 --- a/lib/internal/worker/io.js +++ b/lib/internal/worker/io.js @@ -7,6 +7,7 @@ const { ObjectGetOwnPropertyDescriptors, ObjectGetPrototypeOf, ObjectSetPrototypeOf, + Symbol, } = primordials; const { diff --git a/lib/net.js b/lib/net.js index 7e5d0ea621d..5f12c733dd4 100644 --- a/lib/net.js +++ b/lib/net.js @@ -28,6 +28,7 @@ const { NumberIsNaN, ObjectDefineProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; const EventEmitter = require('events'); diff --git a/lib/os.js b/lib/os.js index 51520802d8e..29b2946b80f 100644 --- a/lib/os.js +++ b/lib/os.js @@ -23,6 +23,7 @@ const { ObjectDefineProperties, + Symbol, } = primordials; const { safeGetenv } = internalBinding('credentials'); diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 0b8bab03e48..3e86f10e222 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -7,6 +7,7 @@ const { ObjectDefineProperties, ObjectDefineProperty, ObjectKeys, + Symbol, } = primordials; const { diff --git a/lib/readline.js b/lib/readline.js index 630359aeb64..ea53cd1bbf8 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -36,6 +36,7 @@ const { NumberIsNaN, ObjectDefineProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; const { diff --git a/lib/repl.js b/lib/repl.js index 55daf2f47f6..b6876bb8c60 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -55,6 +55,7 @@ const { ObjectKeys, ObjectPrototypeHasOwnProperty, ObjectSetPrototypeOf, + Symbol, } = primordials; const { diff --git a/lib/string_decoder.js b/lib/string_decoder.js index 0ab74b77255..3d2cc2fcb6a 100644 --- a/lib/string_decoder.js +++ b/lib/string_decoder.js @@ -24,6 +24,7 @@ const { ArrayBufferIsView, ObjectDefineProperties, + Symbol, } = primordials; const { Buffer } = require('buffer'); diff --git a/lib/trace_events.js b/lib/trace_events.js index 5ec50d32c63..1ff2b5a4fb1 100644 --- a/lib/trace_events.js +++ b/lib/trace_events.js @@ -2,6 +2,7 @@ const { ArrayIsArray, + Symbol, } = primordials; const { hasTracing } = internalBinding('config'); diff --git a/lib/v8.js b/lib/v8.js index 1e0ee43f224..cabe96f3452 100644 --- a/lib/v8.js +++ b/lib/v8.js @@ -17,6 +17,7 @@ const { Array, ObjectPrototypeToString, + Symbol, } = primordials; const { Buffer } = require('buffer'); diff --git a/lib/vm.js b/lib/vm.js index d12a460df69..a4b5b37e83c 100644 --- a/lib/vm.js +++ b/lib/vm.js @@ -24,6 +24,7 @@ const { ArrayIsArray, ArrayPrototypeForEach, + Symbol, } = primordials; const { diff --git a/lib/wasi.js b/lib/wasi.js index 65b84736241..ff8685cbb06 100644 --- a/lib/wasi.js +++ b/lib/wasi.js @@ -5,8 +5,10 @@ const { ArrayPrototypeForEach, ArrayPrototypeMap, FunctionPrototypeBind, - ObjectKeys + ObjectKeys, + Symbol, } = primordials; + const { ERR_INVALID_ARG_TYPE, ERR_WASI_ALREADY_STARTED diff --git a/lib/zlib.js b/lib/zlib.js index 375af0fea5a..3b9e522a06c 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -31,6 +31,7 @@ const { ObjectGetPrototypeOf, ObjectKeys, ObjectSetPrototypeOf, + Symbol, } = primordials; const {