lib: replace Symbol global by the primordials Symbol

PR-URL: https://github.com/nodejs/node/pull/30737
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Sebastien Ahkrin authored and Michaël Zasso committed 2019-12-08 13:38:58 +01:00
1 parent d1f4936fab
commit eac3f0adc4
60 files changed
+93 -3

No files matched your search

+2
View File
@@ -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
+1
View File
@@ -25,6 +25,7 @@ const {
ObjectKeys,
ObjectSetPrototypeOf,
ObjectValues,
Symbol,
} = primordials;
const net = require('net');
+1
View File
@@ -23,6 +23,7 @@
const {
MathMin,
Symbol,
} = primordials;
const { setImmediate } = require('timers');
+1
View File
@@ -28,6 +28,7 @@ const {
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const { getDefaultHighWaterMark } = require('internal/streams/state');
+1
View File
@@ -24,6 +24,7 @@
const {
ObjectKeys,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const net = require('net');
+1
View File
@@ -27,6 +27,7 @@ const {
NumberIsNaN,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
module.exports = Readable;
+1
View File
@@ -29,6 +29,7 @@ const {
Array,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
module.exports = Writable;
+1
View File
@@ -25,6 +25,7 @@ const {
ObjectAssign,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const {
+1
View File
@@ -3,6 +3,7 @@
const {
NumberIsSafeInteger,
ReflectApply,
Symbol,
} = primordials;
const {
+1
View File
@@ -34,6 +34,7 @@ const {
ObjectDefineProperties,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const {
+1
View File
@@ -30,6 +30,7 @@ const {
Array,
ObjectDefineProperty,
ReflectApply,
Symbol,
} = primordials;
const EventEmitter = require('events');
+1
View File
@@ -32,6 +32,7 @@ const {
ObjectKeys,
ReflectApply,
ReflectOwnKeys,
Symbol,
} = primordials;
const kRejection = Symbol.for('nodejs.rejection');
+1
View File
@@ -3,6 +3,7 @@
const {
JSONParse,
JSONStringify,
Symbol,
} = primordials;
const {
+1
View File
@@ -4,6 +4,7 @@ const {
FunctionPrototypeBind,
NumberIsSafeInteger,
ObjectDefineProperty,
Symbol,
} = primordials;
const {
+1
View File
@@ -4,6 +4,7 @@ const {
ArrayIsArray,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const {
@@ -3,6 +3,7 @@
const {
JSONParse,
JSONStringify,
Symbol,
} = primordials;
const { Buffer } = require('buffer');
const { StringDecoder } = require('string_decoder');
+1
View File
@@ -15,6 +15,7 @@ const {
ObjectPrototypeHasOwnProperty,
ObjectValues,
ReflectOwnKeys,
Symbol,
} = primordials;
const { trace } = internalBinding('trace_events');
+1
View File
@@ -2,6 +2,7 @@
const {
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const {
+1
View File
@@ -2,6 +2,7 @@
const {
ObjectDefineProperty,
Symbol,
} = primordials;
const {
+4
View File
@@ -1,5 +1,9 @@
'use strict';
const {
Symbol,
} = primordials;
const {
getCiphers: _getCiphers,
getCurves: _getCurves,
+5
View File
@@ -1,4 +1,9 @@
'use strict';
const {
Symbol,
} = primordials;
const { codes } = require('internal/errors');
const { UDP } = internalBinding('udp_wrap');
const { guessHandleType } = internalBinding('util');
+1
View File
@@ -7,6 +7,7 @@ const {
ObjectCreate,
ObjectDefineProperties,
ObjectGetOwnPropertyDescriptors,
Symbol,
} = primordials;
const {
+1
View File
@@ -16,6 +16,7 @@ const {
NumberIsInteger,
ObjectDefineProperty,
ObjectKeys,
Symbol,
} = primordials;
const messages = new Map();
+1 -1
View File
@@ -31,7 +31,7 @@ module.exports = function() {
getOwnPropertyDescriptors,
getOwnPropertyNames,
getOwnPropertySymbols,
getPrototypeOf
getPrototypeOf,
} = Object;
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
const { ownKeys } = Reflect;
+1
View File
@@ -2,6 +2,7 @@
const {
ObjectDefineProperty,
Symbol,
} = primordials;
const pathModule = require('path');
+1
View File
@@ -4,6 +4,7 @@ const {
MathMax,
MathMin,
NumberIsSafeInteger,
Symbol,
} = primordials;
const {
+1
View File
@@ -7,6 +7,7 @@ const {
NumberIsFinite,
ObjectSetPrototypeOf,
ReflectOwnKeys,
Symbol,
} = primordials;
const { Buffer } = require('buffer');
+1
View File
@@ -3,6 +3,7 @@
const {
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const errors = require('internal/errors');
+4
View File
@@ -1,5 +1,9 @@
'use strict';
const {
Symbol,
} = primordials;
const { setUnrefTimeout } = require('internal/timers');
const { PerformanceEntry, notify } = internalBinding('performance');
+1
View File
@@ -8,6 +8,7 @@ const {
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ReflectGetPrototypeOf,
Symbol,
} = primordials;
const assert = require('internal/assert');
+1
View File
@@ -11,6 +11,7 @@ const {
ObjectDefineProperty,
ObjectPrototypeHasOwnProperty,
ReflectGetPrototypeOf,
Symbol,
} = primordials;
const {
+1
View File
@@ -6,6 +6,7 @@ const {
Number,
ObjectCreate,
ObjectKeys,
Symbol,
} = primordials;
const binding = internalBinding('http2');
+4
View File
@@ -1,5 +1,9 @@
'use strict';
const {
Symbol,
} = primordials;
const { setImmediate } = require('timers');
const assert = require('internal/assert');
const { Socket } = require('net');
+4
View File
@@ -1,5 +1,9 @@
'use strict';
const {
Symbol,
} = primordials;
const Buffer = require('buffer').Buffer;
const { writeBuffer } = internalBinding('fs');
const errors = require('internal/errors');
+1
View File
@@ -2,6 +2,7 @@
const {
Array,
Symbol,
} = primordials;
const kCompare = Symbol('compare');
+4
View File
@@ -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');
+1
View File
@@ -2,6 +2,7 @@
const {
Array,
Symbol,
} = primordials;
const { Buffer } = require('buffer');
+1
View File
@@ -4,6 +4,7 @@ const {
ObjectCreate,
ObjectGetPrototypeOf,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const finished = require('internal/streams/end-of-stream');
+4
View File
@@ -1,5 +1,9 @@
'use strict';
const {
Symbol,
} = primordials;
const { Buffer } = require('buffer');
const { inspect } = require('internal/util/inspect');
+5
View File
@@ -1,4 +1,9 @@
'use strict';
const {
Symbol,
} = primordials;
const { Duplex } = require('stream');
const kCallback = Symbol('Callback');
+4
View File
@@ -1,5 +1,9 @@
'use strict';
const {
Symbol,
} = primordials;
const {
ERR_INVALID_ARG_TYPE
} = require('internal/errors').codes;
+1
View File
@@ -77,6 +77,7 @@ const {
MathTrunc,
NumberMIN_SAFE_INTEGER,
ObjectCreate,
Symbol,
} = primordials;
const {
+1
View File
@@ -4,6 +4,7 @@ const {
ObjectKeys,
SafeMap,
SafeSet,
Symbol,
} = primordials;
const { trace } = internalBinding('trace_events');
+1
View File
@@ -11,6 +11,7 @@ const {
ObjectKeys,
ReflectGetOwnPropertyDescriptor,
ReflectOwnKeys,
Symbol,
} = primordials;
const { inspect } = require('internal/util/inspect');
+2
View File
@@ -11,7 +11,9 @@ const {
ObjectGetPrototypeOf,
ObjectSetPrototypeOf,
ReflectConstruct,
Symbol,
} = primordials;
const {
codes: {
ERR_INVALID_ARG_TYPE,
+1
View File
@@ -15,6 +15,7 @@ const {
ObjectPrototypePropertyIsEnumerable,
ObjectPrototypeToString,
StringPrototypeValueOf,
Symbol,
SymbolPrototypeValueOf,
} = primordials;
+1 -1
View File
@@ -5,8 +5,8 @@ const {
ArrayIsArray,
ObjectCreate,
ObjectDefineProperty,
Symbol,
SafePromise,
Symbol,
} = primordials;
const { isContext } = internalBinding('contextify');
+1
View File
@@ -7,6 +7,7 @@ const {
MathMax,
ObjectCreate,
ObjectEntries,
Symbol,
} = primordials;
const EventEmitter = require('events');
+1
View File
@@ -7,6 +7,7 @@ const {
ObjectGetOwnPropertyDescriptors,
ObjectGetPrototypeOf,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const {
+1
View File
@@ -28,6 +28,7 @@ const {
NumberIsNaN,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const EventEmitter = require('events');
+1
View File
@@ -23,6 +23,7 @@
const {
ObjectDefineProperties,
Symbol,
} = primordials;
const { safeGetenv } = internalBinding('credentials');
+1
View File
@@ -7,6 +7,7 @@ const {
ObjectDefineProperties,
ObjectDefineProperty,
ObjectKeys,
Symbol,
} = primordials;
const {
+1
View File
@@ -36,6 +36,7 @@ const {
NumberIsNaN,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const {
+1
View File
@@ -55,6 +55,7 @@ const {
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const {
+1
View File
@@ -24,6 +24,7 @@
const {
ArrayBufferIsView,
ObjectDefineProperties,
Symbol,
} = primordials;
const { Buffer } = require('buffer');
+1
View File
@@ -2,6 +2,7 @@
const {
ArrayIsArray,
Symbol,
} = primordials;
const { hasTracing } = internalBinding('config');
+1
View File
@@ -17,6 +17,7 @@
const {
Array,
ObjectPrototypeToString,
Symbol,
} = primordials;
const { Buffer } = require('buffer');
+1
View File
@@ -24,6 +24,7 @@
const {
ArrayIsArray,
ArrayPrototypeForEach,
Symbol,
} = primordials;
const {
+3 -1
View File
@@ -5,8 +5,10 @@ const {
ArrayPrototypeForEach,
ArrayPrototypeMap,
FunctionPrototypeBind,
ObjectKeys
ObjectKeys,
Symbol,
} = primordials;
const {
ERR_INVALID_ARG_TYPE,
ERR_WASI_ALREADY_STARTED
+1
View File
@@ -31,6 +31,7 @@ const {
ObjectGetPrototypeOf,
ObjectKeys,
ObjectSetPrototypeOf,
Symbol,
} = primordials;
const {