tools: add lint rule to keep primordials in ASCII order

PR-URL: https://github.com/nodejs/node/pull/52592
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
Antoine du Hamel 2024-04-21 18:53:08 +02:00 committed by GitHub
parent 461722d64c
commit a596af0819
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
96 changed files with 337 additions and 190 deletions

View File

@ -185,6 +185,7 @@ rules:
- groups: [['&&', '||']] - groups: [['&&', '||']]
# Custom rules in tools/eslint-rules # Custom rules in tools/eslint-rules
node-core/alphabetize-primordials: error
node-core/avoid-prototype-pollution: error node-core/avoid-prototype-pollution: error
node-core/lowercase-name-for-primitive: error node-core/lowercase-name-for-primitive: error
node-core/non-ascii-character: error node-core/non-ascii-character: error
@ -266,3 +267,7 @@ globals:
module: false module: false
internalBinding: false internalBinding: false
primordials: false primordials: false
overrides:
- files: [internal/per_context/primordials.js]
rules:
node-core/alphabetize-primordials: [error, {enforceTopPosition: false}]

View File

@ -23,8 +23,8 @@
const { const {
MathMin, MathMin,
Symbol,
RegExpPrototypeExec, RegExpPrototypeExec,
Symbol,
} = primordials; } = primordials;
const { setImmediate } = require('timers'); const { setImmediate } = require('timers');

View File

@ -29,9 +29,9 @@ const {
NumberPrototypeToString, NumberPrototypeToString,
ObjectDefineProperty, ObjectDefineProperty,
ObjectKeys, ObjectKeys,
ObjectValues,
ObjectPrototypeHasOwnProperty, ObjectPrototypeHasOwnProperty,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
ObjectValues,
RegExpPrototypeExec, RegExpPrototypeExec,
SafeSet, SafeSet,
StringPrototypeToLowerCase, StringPrototypeToLowerCase,

View File

@ -28,8 +28,8 @@ const {
MathMin, MathMin,
ObjectKeys, ObjectKeys,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
RegExpPrototypeExec,
ReflectApply, ReflectApply,
RegExpPrototypeExec,
Symbol, Symbol,
SymbolAsyncDispose, SymbolAsyncDispose,
SymbolFor, SymbolFor,

View File

@ -21,14 +21,14 @@
'use strict'; 'use strict';
const tls = require('tls');
const { const {
ArrayPrototypePush, ArrayPrototypePush,
JSONParse, JSONParse,
RegExpPrototypeSymbolReplace, RegExpPrototypeSymbolReplace,
} = primordials; } = primordials;
const tls = require('tls');
const { const {
codes: { codes: {
ERR_TLS_INVALID_PROTOCOL_VERSION, ERR_TLS_INVALID_PROTOCOL_VERSION,

View File

@ -9,10 +9,10 @@ const {
FunctionPrototypeBind, FunctionPrototypeBind,
NumberIsSafeInteger, NumberIsSafeInteger,
ObjectDefineProperties, ObjectDefineProperties,
ObjectFreeze,
ObjectIs, ObjectIs,
ReflectApply, ReflectApply,
Symbol, Symbol,
ObjectFreeze,
} = primordials; } = primordials;
const { const {

View File

@ -41,10 +41,10 @@ const {
StringPrototypeTrim, StringPrototypeTrim,
SymbolSpecies, SymbolSpecies,
SymbolToPrimitive, SymbolToPrimitive,
TypedArrayPrototypeFill,
TypedArrayPrototypeGetBuffer, TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteLength, TypedArrayPrototypeGetByteLength,
TypedArrayPrototypeGetByteOffset, TypedArrayPrototypeGetByteOffset,
TypedArrayPrototypeFill,
TypedArrayPrototypeGetLength, TypedArrayPrototypeGetLength,
TypedArrayPrototypeSet, TypedArrayPrototypeSet,
TypedArrayPrototypeSlice, TypedArrayPrototypeSlice,

View File

@ -28,11 +28,11 @@ const {
ArrayPrototypeJoin, ArrayPrototypeJoin,
ArrayPrototypeLastIndexOf, ArrayPrototypeLastIndexOf,
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypePushApply,
ArrayPrototypeSlice, ArrayPrototypeSlice,
ArrayPrototypeSort, ArrayPrototypeSort,
ArrayPrototypeSplice, ArrayPrototypeSplice,
ArrayPrototypeUnshift, ArrayPrototypeUnshift,
ArrayPrototypePushApply,
NumberIsInteger, NumberIsInteger,
ObjectAssign, ObjectAssign,
ObjectDefineProperty, ObjectDefineProperty,

View File

@ -25,8 +25,8 @@
'use strict'; 'use strict';
const { const {
ObjectDefineProperty,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty,
} = primordials; } = primordials;
const { const {

View File

@ -5,15 +5,15 @@ const {
ArrayPrototypeIndexOf, ArrayPrototypeIndexOf,
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypeSplice, ArrayPrototypeSplice,
SafeFinalizationRegistry,
ObjectDefineProperty, ObjectDefineProperty,
ObjectGetPrototypeOf, ObjectGetPrototypeOf,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
Promise, Promise,
PromisePrototypeThen, PromisePrototypeThen,
PromiseResolve,
PromiseReject, PromiseReject,
PromiseResolve,
ReflectApply, ReflectApply,
SafeFinalizationRegistry,
SafeMap, SafeMap,
SymbolHasInstance, SymbolHasInstance,
} = primordials; } = primordials;

View File

@ -34,8 +34,8 @@ const {
FunctionPrototypeBind, FunctionPrototypeBind,
FunctionPrototypeCall, FunctionPrototypeCall,
NumberMAX_SAFE_INTEGER, NumberMAX_SAFE_INTEGER,
ObjectDefineProperty,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty,
ObjectGetPrototypeOf, ObjectGetPrototypeOf,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
Promise, Promise,
@ -46,9 +46,9 @@ const {
String, String,
StringPrototypeSplit, StringPrototypeSplit,
Symbol, Symbol,
SymbolFor,
SymbolAsyncIterator, SymbolAsyncIterator,
SymbolDispose, SymbolDispose,
SymbolFor,
} = primordials; } = primordials;
const kRejection = SymbolFor('nodejs.rejection'); const kRejection = SymbolFor('nodejs.rejection');

View File

@ -3,8 +3,8 @@
const { const {
ArrayPrototypeSlice, ArrayPrototypeSlice,
ErrorCaptureStackTrace, ErrorCaptureStackTrace,
ObjectPrototypeHasOwnProperty,
ObjectDefineProperty, ObjectDefineProperty,
ObjectPrototypeHasOwnProperty,
Symbol, Symbol,
} = primordials; } = primordials;

View File

@ -10,8 +10,8 @@ const {
PromiseReject, PromiseReject,
RegExpPrototypeExec, RegExpPrototypeExec,
RegExpPrototypeSymbolReplace, RegExpPrototypeSymbolReplace,
StringPrototypeToLowerCase,
StringPrototypeSplit, StringPrototypeSplit,
StringPrototypeToLowerCase,
Symbol, Symbol,
SymbolIterator, SymbolIterator,
SymbolToStringTag, SymbolToStringTag,

View File

@ -59,9 +59,9 @@ const {
Number, Number,
NumberIsNaN, NumberIsNaN,
ObjectDefineProperty, ObjectDefineProperty,
ObjectFreeze,
ObjectGetPrototypeOf, ObjectGetPrototypeOf,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
ObjectFreeze,
SymbolToStringTag, SymbolToStringTag,
globalThis, globalThis,
} = primordials; } = primordials;

View File

@ -64,8 +64,8 @@ const {
SafeMap, SafeMap,
SafeSet, SafeSet,
String, String,
StringPrototypeStartsWith,
StringPrototypeSlice, StringPrototypeSlice,
StringPrototypeStartsWith,
TypeError, TypeError,
} = primordials; } = primordials;

View File

@ -1,6 +1,9 @@
'use strict'; 'use strict';
const { ObjectDefineProperty } = primordials; const {
ObjectDefineProperty,
} = primordials;
const rawMethods = internalBinding('process_methods'); const rawMethods = internalBinding('process_methods');
const { const {
namespace: { namespace: {

View File

@ -1,6 +1,8 @@
'use strict'; 'use strict';
const { ObjectDefineProperty } = primordials; const {
ObjectDefineProperty,
} = primordials;
delete process._debugProcess; delete process._debugProcess;
delete process._debugEnd; delete process._debugEnd;

View File

@ -9,9 +9,9 @@
*/ */
const { const {
globalThis,
ObjectDefineProperty, ObjectDefineProperty,
ObjectGetOwnPropertyDescriptor, ObjectGetOwnPropertyDescriptor,
globalThis,
} = primordials; } = primordials;
const { const {

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
const { const {
ArrayPrototypePush,
JSONParse, JSONParse,
JSONStringify, JSONStringify,
StringPrototypeSplit, StringPrototypeSplit,
ArrayPrototypePush,
Symbol, Symbol,
TypedArrayPrototypeSubarray, TypedArrayPrototypeSubarray,
} = primordials; } = primordials;

View File

@ -1,5 +1,9 @@
'use strict'; 'use strict';
const { SafeMap } = primordials;
const {
SafeMap,
} = primordials;
const assert = require('internal/assert'); const assert = require('internal/assert');
const dgram = require('internal/dgram'); const dgram = require('internal/dgram');
const net = require('net'); const net = require('net');

View File

@ -26,8 +26,8 @@ const {
RegExpPrototypeSymbolReplace, RegExpPrototypeSymbolReplace,
SafeArrayIterator, SafeArrayIterator,
SafeMap, SafeMap,
SafeWeakMap,
SafeSet, SafeSet,
SafeWeakMap,
StringPrototypeIncludes, StringPrototypeIncludes,
StringPrototypePadStart, StringPrototypePadStart,
StringPrototypeRepeat, StringPrototypeRepeat,

View File

@ -7,6 +7,7 @@ const {
ArrayPrototypeIncludes, ArrayPrototypeIncludes,
ArrayPrototypePush, ArrayPrototypePush,
MathFloor, MathFloor,
PromiseReject,
SafeSet, SafeSet,
TypedArrayPrototypeSlice, TypedArrayPrototypeSlice,
} = primordials; } = primordials;
@ -47,8 +48,6 @@ const {
promisify, promisify,
} = require('internal/util'); } = require('internal/util');
const { PromiseReject } = primordials;
const { const {
InternalCryptoKey, InternalCryptoKey,
SecretKeyObject, SecretKeyObject,

View File

@ -3,8 +3,8 @@
const { const {
ArrayFrom, ArrayFrom,
ArrayPrototypeSlice, ArrayPrototypeSlice,
ObjectDefineProperty,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
Symbol, Symbol,
SymbolToStringTag, SymbolToStringTag,

View File

@ -1,9 +1,9 @@
'use strict'; 'use strict';
const { const {
ArrayPrototypeMap,
ObjectDefineProperty, ObjectDefineProperty,
ReflectApply, ReflectApply,
ArrayPrototypeMap,
Symbol, Symbol,
} = primordials; } = primordials;

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const Buffer = require('buffer').Buffer;
const { const {
ArrayPrototypeForEach, ArrayPrototypeForEach,
Error, Error,
@ -19,15 +18,17 @@ const {
SafeSet, SafeSet,
StringFromCharCode, StringFromCharCode,
StringPrototypeSubstring, StringPrototypeSubstring,
SymbolFor,
SymbolToStringTag, SymbolToStringTag,
SyntaxError, SyntaxError,
SymbolFor,
TypeError, TypeError,
TypedArrayPrototypeGetBuffer, TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteOffset,
TypedArrayPrototypeGetByteLength, TypedArrayPrototypeGetByteLength,
TypedArrayPrototypeGetByteOffset,
URIError, URIError,
} = primordials; } = primordials;
const { Buffer } = require('buffer');
const { inspect: { custom: customInspectSymbol } } = require('util'); const { inspect: { custom: customInspectSymbol } } = require('util');
const kSerializedError = 0; const kSerializedError = 0;

View File

@ -33,10 +33,10 @@ const {
Number, Number,
NumberIsInteger, NumberIsInteger,
ObjectAssign, ObjectAssign,
ObjectDefineProperty,
ObjectDefineProperties, ObjectDefineProperties,
ObjectIsExtensible, ObjectDefineProperty,
ObjectGetOwnPropertyDescriptor, ObjectGetOwnPropertyDescriptor,
ObjectIsExtensible,
ObjectKeys, ObjectKeys,
ObjectPrototypeHasOwnProperty, ObjectPrototypeHasOwnProperty,
RangeError, RangeError,

View File

@ -103,6 +103,8 @@ const {
TypeErrorPrototype, TypeErrorPrototype,
TypedArray, TypedArray,
TypedArrayPrototype, TypedArrayPrototype,
URIError,
URIErrorPrototype,
Uint16Array, Uint16Array,
Uint16ArrayPrototype, Uint16ArrayPrototype,
Uint32Array, Uint32Array,
@ -111,8 +113,6 @@ const {
Uint8ArrayPrototype, Uint8ArrayPrototype,
Uint8ClampedArray, Uint8ClampedArray,
Uint8ClampedArrayPrototype, Uint8ClampedArrayPrototype,
URIError,
URIErrorPrototype,
WeakMap, WeakMap,
WeakMapPrototype, WeakMapPrototype,
WeakRef, WeakRef,

View File

@ -1,4 +1,19 @@
'use strict'; 'use strict';
const {
ArrayFrom,
ArrayPrototypeAt,
ArrayPrototypeFlatMap,
ArrayPrototypeMap,
ArrayPrototypePop,
ArrayPrototypePush,
ArrayPrototypeSome,
PromisePrototypeThen,
SafeMap,
SafeSet,
StringPrototypeEndsWith,
} = primordials;
const { lstatSync, readdirSync } = require('fs'); const { lstatSync, readdirSync } = require('fs');
const { lstat, readdir } = require('fs/promises'); const { lstat, readdir } = require('fs/promises');
const { join, resolve } = require('path'); const { join, resolve } = require('path');
@ -13,20 +28,6 @@ const {
validateStringArray, validateStringArray,
} = require('internal/validators'); } = require('internal/validators');
const {
ArrayFrom,
ArrayPrototypeAt,
ArrayPrototypeMap,
ArrayPrototypeFlatMap,
ArrayPrototypePop,
ArrayPrototypePush,
ArrayPrototypeSome,
PromisePrototypeThen,
SafeMap,
SafeSet,
StringPrototypeEndsWith,
} = primordials;
let minimatch; let minimatch;
function lazyMinimatch() { function lazyMinimatch() {
minimatch ??= require('internal/deps/minimatch/index'); minimatch ??= require('internal/deps/minimatch/index');

View File

@ -1,22 +1,22 @@
'use strict'; 'use strict';
const { const {
ArrayPrototypePush,
ArrayPrototypePop, ArrayPrototypePop,
ArrayPrototypePush,
Error, Error,
ErrorCaptureStackTrace, ErrorCaptureStackTrace,
FunctionPrototypeBind,
MathMax, MathMax,
MathMin, MathMin,
Promise, Promise,
PromisePrototypeThen, PromisePrototypeThen,
PromiseResolve,
PromiseReject, PromiseReject,
PromiseResolve,
SafeArrayIterator, SafeArrayIterator,
SafePromisePrototypeFinally, SafePromisePrototypeFinally,
Symbol, Symbol,
SymbolAsyncDispose, SymbolAsyncDispose,
Uint8Array, Uint8Array,
FunctionPrototypeBind,
uncurryThis, uncurryThis,
} = primordials; } = primordials;

View File

@ -8,10 +8,10 @@ const {
DatePrototypeGetTime, DatePrototypeGetTime,
ErrorCaptureStackTrace, ErrorCaptureStackTrace,
FunctionPrototypeCall, FunctionPrototypeCall,
Number,
NumberIsFinite,
MathMin, MathMin,
MathRound, MathRound,
Number,
NumberIsFinite,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty, ObjectDefineProperty,
ObjectIs, ObjectIs,

View File

@ -1,8 +1,8 @@
'use strict'; 'use strict';
const { const {
ArrayPrototypeMap,
Symbol, Symbol,
Uint8Array, Uint8Array,
ArrayPrototypeMap,
} = primordials; } = primordials;
const { const {
kUpdateTimer, kUpdateTimer,

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
const { const {
Symbol,
Date, Date,
DatePrototypeGetMilliseconds, DatePrototypeGetMilliseconds,
DatePrototypeToUTCString, DatePrototypeToUTCString,
Symbol,
} = primordials; } = primordials;
const { setUnrefTimeout } = require('internal/timers'); const { setUnrefTimeout } = require('internal/timers');

View File

@ -11,8 +11,8 @@ const {
Proxy, Proxy,
ReflectApply, ReflectApply,
ReflectGetPrototypeOf, ReflectGetPrototypeOf,
StringPrototypeIncludes,
SafeArrayIterator, SafeArrayIterator,
StringPrototypeIncludes,
StringPrototypeToLowerCase, StringPrototypeToLowerCase,
StringPrototypeTrim, StringPrototypeTrim,
Symbol, Symbol,

View File

@ -11,9 +11,9 @@ const {
MathMin, MathMin,
Number, Number,
ObjectAssign, ObjectAssign,
ObjectKeys,
ObjectDefineProperty, ObjectDefineProperty,
ObjectEntries, ObjectEntries,
ObjectKeys,
ObjectPrototypeHasOwnProperty, ObjectPrototypeHasOwnProperty,
Promise, Promise,
PromisePrototypeThen, PromisePrototypeThen,

View File

@ -1,12 +1,12 @@
'use strict'; 'use strict';
let hook;
let config;
const { const {
SafeSet, SafeSet,
} = primordials; } = primordials;
let hook;
let config;
function lazyHookCreation() { function lazyHookCreation() {
const inspector = internalBinding('inspector'); const inspector = internalBinding('inspector');
const { createHook } = require('async_hooks'); const { createHook } = require('async_hooks');

View File

@ -2,8 +2,8 @@
const { const {
ArrayPrototypeFilter, ArrayPrototypeFilter,
ArrayPrototypeIncludes, ArrayPrototypeIncludes,
ObjectFromEntries,
ObjectEntries, ObjectEntries,
ObjectFromEntries,
SafeArrayIterator, SafeArrayIterator,
} = primordials; } = primordials;
const { types } = require('util'); const { types } = require('util');

View File

@ -9,11 +9,11 @@ const {
ObjectKeys, ObjectKeys,
RegExp, RegExp,
RegExpPrototypeSymbolReplace, RegExpPrototypeSymbolReplace,
SafeMap,
StringPrototypeLocaleCompare, StringPrototypeLocaleCompare,
StringPrototypeRepeat,
StringPrototypeSlice, StringPrototypeSlice,
StringPrototypeTrimStart, StringPrototypeTrimStart,
StringPrototypeRepeat,
SafeMap,
} = primordials; } = primordials;
const { types } = internalBinding('options'); const { types } = internalBinding('options');

View File

@ -1,6 +1,8 @@
'use strict'; 'use strict';
const { RegExpPrototypeExec } = primordials; const {
RegExpPrototypeExec,
} = primordials;
const { const {
prepareMainThreadExecution, prepareMainThreadExecution,

View File

@ -1,4 +1,11 @@
'use strict'; 'use strict';
const {
NumberParseInt,
RegExpPrototypeExec,
StringPrototypeSplit,
} = primordials;
const { const {
prepareMainThreadExecution, prepareMainThreadExecution,
markBootstrapComplete, markBootstrapComplete,
@ -13,11 +20,7 @@ const {
ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_VALUE,
}, },
} = require('internal/errors'); } = require('internal/errors');
const {
NumberParseInt,
RegExpPrototypeExec,
StringPrototypeSplit,
} = primordials;
let debug = require('internal/util/debuglog').debuglog('test_runner', (fn) => { let debug = require('internal/util/debuglog').debuglog('test_runner', (fn) => {
debug = fn; debug = fn;
}); });

View File

@ -4,8 +4,8 @@ const {
ArrayPrototypeFilter, ArrayPrototypeFilter,
ArrayPrototypeIncludes, ArrayPrototypeIncludes,
ObjectKeys, ObjectKeys,
ObjectValues,
ObjectPrototypeHasOwnProperty, ObjectPrototypeHasOwnProperty,
ObjectValues,
} = primordials; } = primordials;
const { validateString } = require('internal/validators'); const { validateString } = require('internal/validators');

View File

@ -1,6 +1,9 @@
'use strict'; 'use strict';
const { RegExpPrototypeExec } = primordials; const {
RegExpPrototypeExec,
} = primordials;
const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('internal/options');
const { getValidatedPath } = require('internal/fs/utils'); const { getValidatedPath } = require('internal/fs/utils');
const pathModule = require('path'); const pathModule = require('path');

View File

@ -1,13 +1,13 @@
'use strict'; 'use strict';
const { const {
RegExpPrototypeExec,
ObjectPrototypeHasOwnProperty, ObjectPrototypeHasOwnProperty,
PromisePrototypeThen, PromisePrototypeThen,
PromiseResolve, PromiseResolve,
RegExpPrototypeExec,
SafeSet, SafeSet,
StringPrototypeIncludes,
StringPrototypeCharCodeAt, StringPrototypeCharCodeAt,
StringPrototypeIncludes,
StringPrototypeSlice, StringPrototypeSlice,
} = primordials; } = primordials;
const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('internal/options');

View File

@ -1,6 +1,9 @@
'use strict'; 'use strict';
const { StringPrototypeStartsWith } = primordials; const {
StringPrototypeStartsWith,
} = primordials;
const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('internal/options');
const { fileURLToPath } = require('internal/url'); const { fileURLToPath } = require('internal/url');
const { dirname } = require('path'); const { dirname } = require('path');

View File

@ -1,11 +1,5 @@
'use strict'; 'use strict';
// This is needed to avoid cycles in esm/resolve <-> cjs/loader
const {
kIsExecuting,
kRequiredModuleSymbol,
} = require('internal/modules/cjs/loader');
const { const {
ArrayPrototypeJoin, ArrayPrototypeJoin,
ArrayPrototypeMap, ArrayPrototypeMap,
@ -18,6 +12,13 @@ const {
hardenRegExp, hardenRegExp,
} = primordials; } = primordials;
// This is needed to avoid cycles in esm/resolve <-> cjs/loader
const {
kIsExecuting,
kRequiredModuleSymbol,
} = require('internal/modules/cjs/loader');
const { imported_cjs_symbol } = internalBinding('symbols'); const { imported_cjs_symbol } = internalBinding('symbols');
const assert = require('internal/assert'); const assert = require('internal/assert');

View File

@ -6,11 +6,11 @@ const {
ArrayPrototypeSome, ArrayPrototypeSome,
FunctionPrototype, FunctionPrototype,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
PromiseResolve,
PromisePrototypeThen, PromisePrototypeThen,
PromiseResolve,
ReflectApply,
RegExpPrototypeExec, RegExpPrototypeExec,
RegExpPrototypeSymbolReplace, RegExpPrototypeSymbolReplace,
ReflectApply,
SafePromiseAllReturnArrayLike, SafePromiseAllReturnArrayLike,
SafePromiseAllReturnVoid, SafePromiseAllReturnVoid,
SafeSet, SafeSet,

View File

@ -5,8 +5,8 @@ const {
Boolean, Boolean,
JSONParse, JSONParse,
ObjectGetPrototypeOf, ObjectGetPrototypeOf,
ObjectPrototypeHasOwnProperty,
ObjectKeys, ObjectKeys,
ObjectPrototypeHasOwnProperty,
ReflectApply, ReflectApply,
SafeArrayIterator, SafeArrayIterator,
SafeMap, SafeMap,

View File

@ -2,9 +2,9 @@
const { const {
ArrayIsArray, ArrayIsArray,
ObjectFreeze,
SafeSet, SafeSet,
SafeWeakMap, SafeWeakMap,
ObjectFreeze,
} = primordials; } = primordials;
const { const {

View File

@ -3,9 +3,9 @@
const { const {
ArrayIsArray, ArrayIsArray,
JSONParse, JSONParse,
StringPrototypeSlice,
StringPrototypeLastIndexOf,
ObjectDefineProperty, ObjectDefineProperty,
StringPrototypeLastIndexOf,
StringPrototypeSlice,
} = primordials; } = primordials;
const modulesBinding = internalBinding('modules'); const modulesBinding = internalBinding('modules');
const { resolve, sep } = require('path'); const { resolve, sep } = require('path');

View File

@ -2,12 +2,12 @@
const { const {
ObjectDefineProperties, ObjectDefineProperties,
ObjectFreeze,
StringPrototypeIndexOf, StringPrototypeIndexOf,
StringPrototypeSlice, StringPrototypeSlice,
StringPrototypeToUpperCase, StringPrototypeToUpperCase,
ObjectFreeze,
globalThis,
Symbol, Symbol,
globalThis,
} = primordials; } = primordials;
const { const {

View File

@ -1,14 +1,14 @@
'use strict'; 'use strict';
const {
StringPrototypeSlice,
} = primordials;
const { const {
getCLIOptions, getCLIOptions,
getEmbedderOptions: getEmbedderOptionsFromBinding, getEmbedderOptions: getEmbedderOptionsFromBinding,
} = internalBinding('options'); } = internalBinding('options');
const {
StringPrototypeSlice,
} = primordials;
let warnOnAllowUnauthorized = true; let warnOnAllowUnauthorized = true;
let optionsMap; let optionsMap;

View File

@ -6,9 +6,9 @@ const {
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty, ObjectDefineProperty,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
SafeWeakMap,
SafeMap, SafeMap,
SafeSet, SafeSet,
SafeWeakMap,
SymbolToStringTag, SymbolToStringTag,
TypeError, TypeError,
} = primordials; } = primordials;

View File

@ -287,8 +287,8 @@ const {
PromiseResolve, PromiseResolve,
ReflectApply, ReflectApply,
ReflectConstruct, ReflectConstruct,
ReflectSet,
ReflectGet, ReflectGet,
ReflectSet,
RegExp, RegExp,
RegExpPrototype, RegExpPrototype,
RegExpPrototypeExec, RegExpPrototypeExec,

View File

@ -2,8 +2,8 @@
const { const {
FunctionPrototypeBind, FunctionPrototypeBind,
ObjectDefineProperties,
MathCeil, MathCeil,
ObjectDefineProperties,
ReflectApply, ReflectApply,
ReflectConstruct, ReflectConstruct,
} = primordials; } = primordials;

View File

@ -2,9 +2,9 @@
const { const {
ObjectDefineProperties, ObjectDefineProperties,
SafeArrayIterator,
SafeMap, SafeMap,
SafeSet, SafeSet,
SafeArrayIterator,
Symbol, Symbol,
SymbolToStringTag, SymbolToStringTag,
} = primordials; } = primordials;

View File

@ -9,9 +9,9 @@ const {
ObjectKeys, ObjectKeys,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
RegExpPrototypeExec, RegExpPrototypeExec,
RegExpPrototypeSymbolReplace,
SafeMap, SafeMap,
SafeSet, SafeSet,
RegExpPrototypeSymbolReplace,
StringPrototypeEndsWith, StringPrototypeEndsWith,
StringPrototypeStartsWith, StringPrototypeStartsWith,
Symbol, Symbol,

View File

@ -1,8 +1,8 @@
'use strict'; 'use strict';
const { const {
Symbol,
RegExpPrototypeExec, RegExpPrototypeExec,
Symbol,
globalThis, globalThis,
} = primordials; } = primordials;

View File

@ -14,8 +14,8 @@ const {
BigUint64Array, BigUint64Array,
Float64Array, Float64Array,
NumberMAX_SAFE_INTEGER, NumberMAX_SAFE_INTEGER,
ObjectFreeze,
ObjectDefineProperty, ObjectDefineProperty,
ObjectFreeze,
ReflectApply, ReflectApply,
RegExpPrototypeExec, RegExpPrototypeExec,
SafeArrayIterator, SafeArrayIterator,

View File

@ -1,4 +1,9 @@
'use strict'; 'use strict';
const {
JSONParse,
} = primordials;
const { const {
ERR_SYNTHETIC, ERR_SYNTHETIC,
} = require('internal/errors').codes; } = require('internal/errors').codes;
@ -10,9 +15,7 @@ const {
validateString, validateString,
} = require('internal/validators'); } = require('internal/validators');
const nr = internalBinding('report'); const nr = internalBinding('report');
const {
JSONParse,
} = primordials;
const report = { const report = {
writeReport(file, err) { writeReport(file, err) {
if (typeof file === 'object' && file !== null) { if (typeof file === 'object' && file !== null) {

View File

@ -3,10 +3,10 @@
const { const {
ArrayIsArray, ArrayIsArray,
Error, Error,
ErrorPrototypeToString,
ErrorCaptureStackTrace, ErrorCaptureStackTrace,
String, ErrorPrototypeToString,
SafeSet, SafeSet,
String,
} = primordials; } = primordials;
const { const {

View File

@ -2,9 +2,9 @@
const { const {
ArrayPrototypeIndexOf, ArrayPrototypeIndexOf,
ArrayPrototypePush,
ArrayPrototypeSlice, ArrayPrototypeSlice,
ArrayPrototypeSplice, ArrayPrototypeSplice,
ArrayPrototypePush,
FunctionPrototypeBind, FunctionPrototypeBind,
} = primordials; } = primordials;

View File

@ -9,8 +9,8 @@ const {
ArrayPrototypePop, ArrayPrototypePop,
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypeReverse, ArrayPrototypeReverse,
ArrayPrototypeSplice,
ArrayPrototypeShift, ArrayPrototypeShift,
ArrayPrototypeSplice,
ArrayPrototypeUnshift, ArrayPrototypeUnshift,
DateNow, DateNow,
FunctionPrototypeCall, FunctionPrototypeCall,
@ -21,6 +21,7 @@ const {
NumberIsFinite, NumberIsFinite,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
RegExpPrototypeExec, RegExpPrototypeExec,
SafeStringIterator,
StringPrototypeCodePointAt, StringPrototypeCodePointAt,
StringPrototypeEndsWith, StringPrototypeEndsWith,
StringPrototypeRepeat, StringPrototypeRepeat,
@ -28,9 +29,8 @@ const {
StringPrototypeStartsWith, StringPrototypeStartsWith,
StringPrototypeTrim, StringPrototypeTrim,
Symbol, Symbol,
SymbolDispose,
SymbolAsyncIterator, SymbolAsyncIterator,
SafeStringIterator, SymbolDispose,
} = primordials; } = primordials;
const { codes } = require('internal/errors'); const { codes } = require('internal/errors');

View File

@ -6,10 +6,10 @@ const {
ArrayPrototypeMap, ArrayPrototypeMap,
ErrorPrototypeToString, ErrorPrototypeToString,
RegExpPrototypeSymbolSplit, RegExpPrototypeSymbolSplit,
SafeStringIterator,
StringPrototypeRepeat, StringPrototypeRepeat,
StringPrototypeSlice, StringPrototypeSlice,
StringPrototypeStartsWith, StringPrototypeStartsWith,
SafeStringIterator,
} = primordials; } = primordials;
let debug = require('internal/util/debuglog').debuglog('source_map', (fn) => { let debug = require('internal/util/debuglog').debuglog('source_map', (fn) => {

View File

@ -1,5 +1,8 @@
'use strict'; 'use strict';
const {
Symbol,
} = primordials;
const { const {
aggregateTwoErrors, aggregateTwoErrors,
codes: { codes: {
@ -7,9 +10,6 @@ const {
}, },
AbortError, AbortError,
} = require('internal/errors'); } = require('internal/errors');
const {
Symbol,
} = primordials;
const { const {
kIsDestroyed, kIsDestroyed,
isDestroyed, isDestroyed,

View File

@ -1,5 +1,9 @@
'use strict'; 'use strict';
const {
FunctionPrototypeCall,
} = primordials;
const { const {
isReadable, isReadable,
isWritable, isWritable,
@ -31,10 +35,6 @@ const {
} = require('internal/blob'); } = require('internal/blob');
const { AbortController } = require('internal/abort_controller'); const { AbortController } = require('internal/abort_controller');
const {
FunctionPrototypeCall,
} = primordials;
// This is needed for pre node 17. // This is needed for pre node 17.
class Duplexify extends Duplex { class Duplexify extends Duplex {
constructor(options) { constructor(options) {

View File

@ -3,6 +3,12 @@
'use strict'; 'use strict';
const {
Promise,
PromisePrototypeThen,
SymbolDispose,
} = primordials;
const { const {
AbortError, AbortError,
codes, codes,
@ -22,12 +28,6 @@ const {
validateBoolean, validateBoolean,
} = require('internal/validators'); } = require('internal/validators');
const {
Promise,
PromisePrototypeThen,
SymbolDispose,
} = primordials;
const { const {
isClosed, isClosed,
isReadable, isReadable,

View File

@ -1,5 +1,18 @@
'use strict'; 'use strict';
const {
ArrayPrototypePush,
Boolean,
MathFloor,
Number,
NumberIsNaN,
Promise,
PromisePrototypeThen,
PromiseReject,
PromiseResolve,
Symbol,
} = primordials;
const { AbortController, AbortSignal } = require('internal/abort_controller'); const { AbortController, AbortSignal } = require('internal/abort_controller');
const { const {
@ -24,19 +37,6 @@ const {
} = require('internal/streams/add-abort-signal'); } = require('internal/streams/add-abort-signal');
const { isWritable, isNodeStream } = require('internal/streams/utils'); const { isWritable, isNodeStream } = require('internal/streams/utils');
const {
ArrayPrototypePush,
Boolean,
MathFloor,
Number,
NumberIsNaN,
Promise,
PromiseReject,
PromiseResolve,
PromisePrototypeThen,
Symbol,
} = primordials;
const kEmpty = Symbol('kEmpty'); const kEmpty = Symbol('kEmpty');
const kEof = Symbol('kEof'); const kEof = Symbol('kEof');

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
const { const {
SymbolAsyncIterator,
SymbolIterator,
SymbolFor,
Symbol, Symbol,
SymbolAsyncIterator,
SymbolFor,
SymbolIterator,
} = primordials; } = primordials;
// We need to use SymbolFor to make these globally available // We need to use SymbolFor to make these globally available

View File

@ -29,8 +29,8 @@ const {
ArrayPrototypeSlice, ArrayPrototypeSlice,
Error, Error,
FunctionPrototypeSymbolHasInstance, FunctionPrototypeSymbolHasInstance,
ObjectDefineProperty,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
StringPrototypeToLowerCase, StringPrototypeToLowerCase,
Symbol, Symbol,

View File

@ -5,6 +5,8 @@ const {
ArrayPrototypePush, ArrayPrototypePush,
JSONParse, JSONParse,
MathFloor, MathFloor,
MathMax,
MathMin,
NumberParseInt, NumberParseInt,
ObjectAssign, ObjectAssign,
RegExpPrototypeExec, RegExpPrototypeExec,
@ -14,8 +16,6 @@ const {
StringPrototypeIncludes, StringPrototypeIncludes,
StringPrototypeLocaleCompare, StringPrototypeLocaleCompare,
StringPrototypeStartsWith, StringPrototypeStartsWith,
MathMax,
MathMin,
} = primordials; } = primordials;
const { const {
copyFileSync, copyFileSync,

View File

@ -1,9 +1,5 @@
'use strict'; 'use strict';
const {
emitExperimentalWarning,
} = require('internal/util');
const { const {
ArrayPrototypeAt, ArrayPrototypeAt,
ArrayPrototypeForEach, ArrayPrototypeForEach,
@ -13,23 +9,27 @@ const {
FunctionPrototypeApply, FunctionPrototypeApply,
FunctionPrototypeBind, FunctionPrototypeBind,
FunctionPrototypeToString, FunctionPrototypeToString,
globalThis,
NumberIsNaN, NumberIsNaN,
ObjectDefineProperty,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty,
ObjectGetOwnPropertyDescriptor, ObjectGetOwnPropertyDescriptor,
ObjectGetOwnPropertyDescriptors, ObjectGetOwnPropertyDescriptors,
Promise, Promise,
Symbol, Symbol,
SymbolAsyncIterator, SymbolAsyncIterator,
SymbolDispose, SymbolDispose,
globalThis,
} = primordials; } = primordials;
const { const {
validateAbortSignal, validateAbortSignal,
validateArray, validateArray,
validateNumber, validateNumber,
} = require('internal/validators'); } = require('internal/validators');
const {
emitExperimentalWarning,
} = require('internal/util');
const { const {
AbortError, AbortError,
codes: { ERR_INVALID_STATE, ERR_INVALID_ARG_VALUE }, codes: { ERR_INVALID_STATE, ERR_INVALID_ARG_VALUE },

View File

@ -1,5 +1,8 @@
'use strict'; 'use strict';
const { MathMax } = primordials;
const {
MathMax,
} = primordials;
module.exports = async function* dot(source) { module.exports = async function* dot(source) {
let count = 0; let count = 0;

View File

@ -1,8 +1,8 @@
'use strict'; 'use strict';
const { const {
ArrayPrototypeFilter, ArrayPrototypeFilter,
ArrayPrototypeMap,
ArrayPrototypeJoin, ArrayPrototypeJoin,
ArrayPrototypeMap,
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypeSome, ArrayPrototypeSome,
NumberPrototypeToFixed, NumberPrototypeToFixed,

View File

@ -6,10 +6,10 @@ const {
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypeShift, ArrayPrototypeShift,
ArrayPrototypeUnshift, ArrayPrototypeUnshift,
hardenRegExp,
RegExpPrototypeSymbolSplit, RegExpPrototypeSymbolSplit,
SafeMap, SafeMap,
StringPrototypeRepeat, StringPrototypeRepeat,
hardenRegExp,
} = primordials; } = primordials;
const assert = require('assert'); const assert = require('assert');
const Transform = require('internal/streams/transform'); const Transform = require('internal/streams/transform');

View File

@ -9,8 +9,8 @@ const {
RegExpPrototypeSymbolSplit, RegExpPrototypeSymbolSplit,
SafeMap, SafeMap,
SafeSet, SafeSet,
StringPrototypeReplaceAll,
StringPrototypeRepeat, StringPrototypeRepeat,
StringPrototypeReplaceAll,
} = primordials; } = primordials;
const { inspectWithNoCustomRetry } = require('internal/errors'); const { inspectWithNoCustomRetry } = require('internal/errors');
const { isError, kEmptyObject } = require('internal/util'); const { isError, kEmptyObject } = require('internal/util');

View File

@ -5,8 +5,8 @@ const {
ArrayPrototypeFilter, ArrayPrototypeFilter,
ArrayPrototypeForEach, ArrayPrototypeForEach,
ArrayPrototypeIncludes, ArrayPrototypeIncludes,
ArrayPrototypeMap,
ArrayPrototypeJoin, ArrayPrototypeJoin,
ArrayPrototypeMap,
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypeShift, ArrayPrototypeShift,
ArrayPrototypeSlice, ArrayPrototypeSlice,
@ -14,11 +14,11 @@ const {
ArrayPrototypeSort, ArrayPrototypeSort,
ObjectAssign, ObjectAssign,
PromisePrototypeThen, PromisePrototypeThen,
PromiseResolve,
SafeMap,
SafePromiseAll, SafePromiseAll,
SafePromiseAllReturnVoid, SafePromiseAllReturnVoid,
SafePromiseAllSettledReturnVoid, SafePromiseAllSettledReturnVoid,
PromiseResolve,
SafeMap,
SafeSet, SafeSet,
StringPrototypeIndexOf, StringPrototypeIndexOf,
StringPrototypeSlice, StringPrototypeSlice,

View File

@ -11,21 +11,21 @@ const {
FunctionPrototype, FunctionPrototype,
MathMax, MathMax,
Number, Number,
ObjectDefineProperty,
ObjectSeal, ObjectSeal,
PromisePrototypeThen, PromisePrototypeThen,
PromiseResolve, PromiseResolve,
SafePromisePrototypeFinally,
StringPrototypeStartsWith,
StringPrototypeTrim,
ReflectApply, ReflectApply,
RegExpPrototypeExec, RegExpPrototypeExec,
SafeMap, SafeMap,
SafeSet,
SafePromiseAll, SafePromiseAll,
SafePromisePrototypeFinally,
SafePromiseRace, SafePromiseRace,
SymbolDispose, SafeSet,
ObjectDefineProperty, StringPrototypeStartsWith,
StringPrototypeTrim,
Symbol, Symbol,
SymbolDispose,
} = primordials; } = primordials;
const { getCallerLocation } = internalBinding('util'); const { getCallerLocation } = internalBinding('util');
const { addAbortListener } = require('internal/events/abort_listener'); const { addAbortListener } = require('internal/events/abort_listener');

View File

@ -1,22 +1,22 @@
'use strict'; 'use strict';
const { const {
ArrayPrototypeFlatMap,
ArrayPrototypeJoin, ArrayPrototypeJoin,
ArrayPrototypeMap, ArrayPrototypeMap,
ArrayPrototypeFlatMap,
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypeReduce, ArrayPrototypeReduce,
ArrayPrototypeSome, ArrayPrototypeSome,
ObjectGetOwnPropertyDescriptor,
MathFloor, MathFloor,
MathMax, MathMax,
MathMin, MathMin,
NumberPrototypeToFixed, NumberPrototypeToFixed,
SafePromiseAllReturnArrayLike, ObjectGetOwnPropertyDescriptor,
RegExp, RegExp,
RegExpPrototypeExec, RegExpPrototypeExec,
SafeMap, SafeMap,
StringPrototypePadStart, SafePromiseAllReturnArrayLike,
StringPrototypePadEnd, StringPrototypePadEnd,
StringPrototypePadStart,
StringPrototypeRepeat, StringPrototypeRepeat,
StringPrototypeSlice, StringPrototypeSlice,
} = primordials; } = primordials;

View File

@ -1,16 +1,16 @@
'use strict'; 'use strict';
const {
ReflectConstruct,
Symbol,
} = primordials;
const EventEmitter = require('events'); const EventEmitter = require('events');
const { kEmptyObject } = require('internal/util'); const { kEmptyObject } = require('internal/util');
const { Duplex } = require('stream'); const { Duplex } = require('stream');
const _tls_wrap = require('_tls_wrap'); const _tls_wrap = require('_tls_wrap');
const _tls_common = require('_tls_common'); const _tls_common = require('_tls_common');
const {
Symbol,
ReflectConstruct,
} = primordials;
const kCallback = Symbol('Callback'); const kCallback = Symbol('Callback');
const kOtherSide = Symbol('Other'); const kOtherSide = Symbol('Other');

View File

@ -12,10 +12,10 @@ const {
FunctionPrototypeCall, FunctionPrototypeCall,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty, ObjectDefineProperty,
ObjectFreeze,
ObjectGetOwnPropertyDescriptor, ObjectGetOwnPropertyDescriptor,
ObjectGetOwnPropertyDescriptors, ObjectGetOwnPropertyDescriptors,
ObjectGetPrototypeOf, ObjectGetPrototypeOf,
ObjectFreeze,
ObjectPrototypeHasOwnProperty, ObjectPrototypeHasOwnProperty,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
ObjectValues, ObjectValues,
@ -28,9 +28,9 @@ const {
RegExpPrototypeGetHasIndices, RegExpPrototypeGetHasIndices,
RegExpPrototypeGetIgnoreCase, RegExpPrototypeGetIgnoreCase,
RegExpPrototypeGetMultiline, RegExpPrototypeGetMultiline,
RegExpPrototypeGetSource,
RegExpPrototypeGetSticky, RegExpPrototypeGetSticky,
RegExpPrototypeGetUnicode, RegExpPrototypeGetUnicode,
RegExpPrototypeGetSource,
SafeMap, SafeMap,
SafeSet, SafeSet,
SafeWeakMap, SafeWeakMap,

View File

@ -20,8 +20,8 @@ const {
SafeSet, SafeSet,
StringPrototypeValueOf, StringPrototypeValueOf,
SymbolPrototypeValueOf, SymbolPrototypeValueOf,
TypedArrayPrototypeGetSymbolToStringTag,
TypedArrayPrototypeGetByteLength, TypedArrayPrototypeGetByteLength,
TypedArrayPrototypeGetSymbolToStringTag,
Uint8Array, Uint8Array,
} = primordials; } = primordials;

View File

@ -13,8 +13,8 @@ const {
ArrayPrototypePush, ArrayPrototypePush,
ArrayPrototypePushApply, ArrayPrototypePushApply,
ArrayPrototypeSlice, ArrayPrototypeSlice,
ArrayPrototypeSplice,
ArrayPrototypeSort, ArrayPrototypeSort,
ArrayPrototypeSplice,
ArrayPrototypeUnshift, ArrayPrototypeUnshift,
BigIntPrototypeValueOf, BigIntPrototypeValueOf,
BooleanPrototypeValueOf, BooleanPrototypeValueOf,
@ -26,8 +26,8 @@ const {
FunctionPrototypeCall, FunctionPrototypeCall,
FunctionPrototypeToString, FunctionPrototypeToString,
JSONStringify, JSONStringify,
MapPrototypeGetSize,
MapPrototypeEntries, MapPrototypeEntries,
MapPrototypeGetSize,
MathFloor, MathFloor,
MathMax, MathMax,
MathMin, MathMin,
@ -61,14 +61,15 @@ const {
RegExpPrototypeSymbolReplace, RegExpPrototypeSymbolReplace,
RegExpPrototypeSymbolSplit, RegExpPrototypeSymbolSplit,
RegExpPrototypeToString, RegExpPrototypeToString,
SafeStringIterator,
SafeMap, SafeMap,
SafeSet, SafeSet,
SafeStringIterator,
SetPrototypeGetSize, SetPrototypeGetSize,
SetPrototypeValues, SetPrototypeValues,
String, String,
StringPrototypeCharCodeAt, StringPrototypeCharCodeAt,
StringPrototypeCodePointAt, StringPrototypeCodePointAt,
StringPrototypeEndsWith,
StringPrototypeIncludes, StringPrototypeIncludes,
StringPrototypeIndexOf, StringPrototypeIndexOf,
StringPrototypeLastIndexOf, StringPrototypeLastIndexOf,
@ -79,14 +80,13 @@ const {
StringPrototypeReplaceAll, StringPrototypeReplaceAll,
StringPrototypeSlice, StringPrototypeSlice,
StringPrototypeSplit, StringPrototypeSplit,
StringPrototypeEndsWith,
StringPrototypeStartsWith, StringPrototypeStartsWith,
StringPrototypeToLowerCase, StringPrototypeToLowerCase,
StringPrototypeTrim, StringPrototypeTrim,
StringPrototypeValueOf, StringPrototypeValueOf,
SymbolIterator,
SymbolPrototypeToString, SymbolPrototypeToString,
SymbolPrototypeValueOf, SymbolPrototypeValueOf,
SymbolIterator,
SymbolToStringTag, SymbolToStringTag,
TypedArrayPrototypeGetLength, TypedArrayPrototypeGetLength,
TypedArrayPrototypeGetSymbolToStringTag, TypedArrayPrototypeGetSymbolToStringTag,

View File

@ -1,8 +1,8 @@
'use strict'; 'use strict';
const { const {
ArrayPrototypeSome,
ArrayPrototypePushApply, ArrayPrototypePushApply,
ArrayPrototypeSome,
FunctionPrototypeBind, FunctionPrototypeBind,
ObjectDefineProperty, ObjectDefineProperty,
ObjectKeys, ObjectKeys,

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const assert = require('internal/assert');
const { const {
ArrayIsArray, ArrayIsArray,
ArrayPrototypeForEach, ArrayPrototypeForEach,
@ -18,6 +17,7 @@ const {
TypeError, TypeError,
} = primordials; } = primordials;
const assert = require('internal/assert');
const { const {
isModuleNamespaceObject, isModuleNamespaceObject,
} = require('internal/util/types'); } = require('internal/util/types');

View File

@ -10,10 +10,10 @@ const {
SafePromiseAll, SafePromiseAll,
SafePromisePrototypeFinally, SafePromisePrototypeFinally,
SafeSet, SafeSet,
TypeError,
TypedArrayPrototypeGetBuffer, TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteLength, TypedArrayPrototypeGetByteLength,
TypedArrayPrototypeGetByteOffset, TypedArrayPrototypeGetByteOffset,
TypeError,
Uint8Array, Uint8Array,
} = primordials; } = primordials;

View File

@ -15,8 +15,8 @@ const {
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
Promise, Promise,
PromisePrototypeThen, PromisePrototypeThen,
PromiseResolve,
PromiseReject, PromiseReject,
PromiseResolve,
SafePromiseAll, SafePromiseAll,
Symbol, Symbol,
SymbolAsyncIterator, SymbolAsyncIterator,

View File

@ -5,8 +5,8 @@ const {
ObjectDefineProperties, ObjectDefineProperties,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
PromisePrototypeThen, PromisePrototypeThen,
SymbolToStringTag,
Symbol, Symbol,
SymbolToStringTag,
} = primordials; } = primordials;
const { const {

View File

@ -9,8 +9,8 @@ const {
ObjectSetPrototypeOf, ObjectSetPrototypeOf,
Promise, Promise,
PromisePrototypeThen, PromisePrototypeThen,
PromiseResolve,
PromiseReject, PromiseReject,
PromiseResolve,
Symbol, Symbol,
SymbolToStringTag, SymbolToStringTag,
} = primordials; } = primordials;

View File

@ -8,8 +8,8 @@ const {
FunctionPrototypeCall, FunctionPrototypeCall,
ObjectAssign, ObjectAssign,
ObjectCreate, ObjectCreate,
ObjectDefineProperty,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty,
ObjectGetOwnPropertyDescriptors, ObjectGetOwnPropertyDescriptors,
ObjectGetPrototypeOf, ObjectGetPrototypeOf,
ObjectSetPrototypeOf, ObjectSetPrototypeOf,

View File

@ -87,9 +87,9 @@ const {
StringPrototypeSlice, StringPrototypeSlice,
StringPrototypeSplit, StringPrototypeSplit,
StringPrototypeStartsWith, StringPrototypeStartsWith,
StringPrototypeToLocaleLowerCase,
StringPrototypeTrim, StringPrototypeTrim,
StringPrototypeTrimStart, StringPrototypeTrimStart,
StringPrototypeToLocaleLowerCase,
Symbol, Symbol,
SyntaxError, SyntaxError,
SyntaxErrorPrototype, SyntaxErrorPrototype,

View File

@ -1,5 +1,10 @@
'use strict'; 'use strict';
const { ObjectAssign, ObjectDefineProperty } = primordials;
const {
ObjectAssign,
ObjectDefineProperty,
} = primordials;
const { test, suite, before, after, beforeEach, afterEach } = require('internal/test_runner/harness'); const { test, suite, before, after, beforeEach, afterEach } = require('internal/test_runner/harness');
const { run } = require('internal/test_runner/runner'); const { run } = require('internal/test_runner/runner');

View File

@ -1,6 +1,9 @@
'use strict'; 'use strict';
const { ObjectDefineProperties, ReflectConstruct } = primordials; const {
ObjectDefineProperties,
ReflectConstruct,
} = primordials;
let dot; let dot;
let junit; let junit;

View File

@ -23,8 +23,8 @@
const { const {
MathTrunc, MathTrunc,
ObjectDefineProperty,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty,
SymbolDispose, SymbolDispose,
SymbolToPrimitive, SymbolToPrimitive,
} = primordials; } = primordials;

View File

@ -25,6 +25,7 @@ const {
Int16Array, Int16Array,
Int32Array, Int32Array,
Int8Array, Int8Array,
JSONParse,
ObjectPrototypeToString, ObjectPrototypeToString,
Uint16Array, Uint16Array,
Uint32Array, Uint32Array,
@ -64,7 +65,6 @@ const {
} = require('internal/heap_utils'); } = require('internal/heap_utils');
const promiseHooks = require('internal/promise_hooks'); const promiseHooks = require('internal/promise_hooks');
const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('internal/options');
const { JSONParse } = primordials;
/** /**
* Generates a snapshot of the current V8 heap * Generates a snapshot of the current V8 heap
* and writes it to a JSON file. * and writes it to a JSON file.

View File

@ -24,9 +24,9 @@
const { const {
ArrayPrototypeForEach, ArrayPrototypeForEach,
ObjectFreeze, ObjectFreeze,
Symbol,
PromiseReject, PromiseReject,
ReflectApply, ReflectApply,
Symbol,
} = primordials; } = primordials;
const { const {

View File

@ -0,0 +1,57 @@
'use strict';
const common = require('../common');
if ((!common.hasCrypto) || (!common.hasIntl)) {
common.skip('ESLint tests require crypto and Intl');
}
common.skipIfEslintMissing();
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/alphabetize-primordials');
new RuleTester({
parserOptions: { ecmaVersion: 6 },
env: { es6: true }
})
.run('alphabetize-primordials', rule, {
valid: [
'new Array()',
'"use strict";const {\nArray\n} = primordials;',
'"use strict";const {\n\tArray,\n\tDate,\n} = primordials',
'"use strict";const {\nDate,Array\n} = notPrimordials',
'"use strict";const {\nDate,globalThis:{Array}\n} = primordials',
'"use strict";const {\nBigInt,globalThis:{Array,Date,SharedArrayBuffer,parseInt}\n} = primordials',
'"use strict";const {\nFunctionPrototypeBind,Uint32Array,globalThis:{SharedArrayBuffer}\n} = primordials',
{
code: '"use strict";const fs = require("fs");const {\nArray\n} = primordials',
options: [{ enforceTopPosition: false }],
},
],
invalid: [
{
code: '"use strict";const {Array} = primordials;',
errors: [{ message: /destructuring from primordials should be multiline/ }],
},
{
code: '"use strict";const fs = require("fs");const {Date,Array} = primordials',
errors: [
{ message: /destructuring from primordials should be multiline/ },
{ message: /destructuring from primordials should be the first expression/ },
{ message: /Date >= Array/ },
],
},
{
code: 'function fn() {"use strict";const {\nArray,\n} = primordials}',
errors: [{ message: /destructuring from primordials should be the first expression/ }],
},
{
code: '"use strict";const {\nDate,Array} = primordials',
errors: [{ message: /Date >= Array/ }],
},
{
code: '"use strict";const {\nglobalThis:{Date, Array}} = primordials',
errors: [{ message: /Date >= Array/ }],
},
]
});

View File

@ -0,0 +1,49 @@
'use strict';
const prefix = 'Out of ASCIIbetical order - ';
const opStr = ' >= ';
module.exports = {
meta: {
schema: [{
type: 'object',
properties: {
enforceTopPosition: { type: 'boolean' },
},
additionalProperties: false,
}],
},
create: function(context) {
const enforceTopPosition = context.options.every((option) => option.enforceTopPosition !== false);
return {
'VariableDeclaration:not(Program>:first-child+*) > VariableDeclarator[init.name="primordials"]'(node) {
if (enforceTopPosition) {
context.report({
node,
message: 'destructuring from primordials should be the first expression after "use strict"',
});
}
},
'VariableDeclaration > VariableDeclarator[init.name="primordials"]'({ id: node }) {
const { loc } = node;
if (loc.start.line === loc.end.line) {
context.report({
node,
message: 'destructuring from primordials should be multiline',
});
}
},
'VariableDeclaration > VariableDeclarator[init.name="primordials"] Property:not(:first-child)'(node) {
const { properties } = node.parent;
const prev = properties[properties.indexOf(node) - 1].key.name;
const curr = node.key.name;
if (prev >= curr) {
const message = [prefix, prev, opStr, curr].join('');
context.report({ node, message });
}
},
};
},
};