Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
lib: force using primordials for JSON, Math and Reflect
Use the "no-restricted-globals" ESLint rule to lint for it. PR-URL: #27027 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- Loading branch information
Showing
with
83 additions
and 3 deletions.
- +1 −0 lib/.eslintrc.yaml
- +2 −0 lib/_http_common.js
- +2 −0 lib/async_hooks.js
- +2 −0 lib/buffer.js
- +2 −0 lib/domain.js
- +2 −0 lib/events.js
- +2 −0 lib/fs.js
- +2 −0 lib/inspector.js
- +2 −0 lib/internal/assert/assertion_error.js
- +2 −0 lib/internal/async_hooks.js
- +1 −2 lib/internal/bootstrap/node.js
- +1 −1 lib/internal/bootstrap/primordials.js
- +2 −0 lib/internal/buffer.js
- +2 −0 lib/internal/child_process.js
- +2 −0 lib/internal/cli_table.js
- +2 −0 lib/internal/console/constructor.js
- +2 −0 lib/internal/console/global.js
- +2 −0 lib/internal/crypto/random.js
- +2 −0 lib/internal/freeze_intrinsics.js
- +2 −0 lib/internal/fs/promises.js
- +2 −0 lib/internal/fs/read_file_context.js
- +2 −0 lib/internal/fs/streams.js
- +2 −0 lib/internal/fs/utils.js
- +2 −0 lib/internal/http2/compat.js
- +2 −0 lib/internal/http2/core.js
- +2 −0 lib/internal/http2/util.js
- +2 −0 lib/internal/main/print_help.js
- +2 −0 lib/internal/modules/cjs/loader.js
- +2 −0 lib/internal/process/execution.js
- +2 −0 lib/internal/process/policy.js
- +2 −0 lib/internal/process/task_queues.js
- +2 −0 lib/internal/profiler.js
- +2 −0 lib/internal/streams/state.js
- +2 −0 lib/internal/timers.js
- +2 −0 lib/internal/url.js
- +2 −0 lib/internal/util.js
- +2 −0 lib/internal/util/inspect.js
- +2 −0 lib/internal/v8_prof_processor.js
- +2 −0 lib/readline.js
- +2 −0 lib/repl.js
- +2 −0 lib/timers.js
- +2 −0 lib/util.js
- +2 −0 lib/zlib.js
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -21,6 +21,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { getOptionValue } = require('internal/options'); | ||
|
|
||
| const { methods, HTTPParser } = | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const { | ||
| ERR_ASYNC_CALLBACK, | ||
| ERR_INVALID_ASYNC_ID | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -21,6 +21,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { | ||
| byteLengthUtf8, | ||
| copy: _copy, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -21,6 +21,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Math, Reflect } = primordials; | ||
|
|
||
| var spliceOne; | ||
|
|
||
| const { | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -24,6 +24,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Math, Reflect } = primordials; | ||
|
|
||
| const { fs: constants } = internalBinding('constants'); | ||
| const { | ||
| S_IFIFO, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { JSON } = primordials; | ||
|
|
||
| const { | ||
| ERR_INSPECTOR_ALREADY_CONNECTED, | ||
| ERR_INSPECTOR_CLOSED, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { inspect } = require('internal/util/inspect'); | ||
| const { codes: { | ||
| ERR_INVALID_ARG_TYPE | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const { | ||
| ERR_ASYNC_TYPE, | ||
| ERR_INVALID_ASYNC_ID | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { | ||
| ERR_BUFFER_OUT_OF_BOUNDS, | ||
| ERR_INVALID_ARG_TYPE, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { JSON } = primordials; | ||
|
|
||
| const { | ||
| errnoException, | ||
| codes: { | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -12,6 +12,8 @@ | ||
| // Therefore, the console.Console.prototype is not | ||
| // in the global console prototype chain anymore. | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const { | ||
| Console, | ||
| kBindStreamsLazy, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { | ||
| F_OK, | ||
| O_SYMLINK, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { Buffer } = require('buffer'); | ||
|
|
||
| const { FSReqCallback, close, read } = internalBinding('fs'); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { | ||
| FSReqCallback, | ||
| writeBuffers | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const { Buffer, kMaxLength } = require('buffer'); | ||
| const { | ||
| codes: { | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const assert = require('internal/assert'); | ||
| const Stream = require('stream'); | ||
| const Readable = Stream.Readable; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -2,6 +2,8 @@ | ||
|
|
||
| /* eslint-disable no-use-before-define */ | ||
|
|
||
| const { Math, Reflect } = primordials; | ||
|
|
||
| const { | ||
| assertCrypto, | ||
| customInspectSymbol: kInspect, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const binding = internalBinding('http2'); | ||
| const { | ||
| codes: { | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| /* eslint-disable no-restricted-globals */ | ||
|
|
||
| const { types } = internalBinding('options'); | ||
| const hasCrypto = Boolean(process.versions.openssl); | ||
|
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { JSON } = primordials; | ||
|
|
||
| const path = require('path'); | ||
|
|
||
| const { | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { JSON, Reflect } = primordials; | ||
|
|
||
| const { | ||
| ERR_MANIFEST_TDZ, | ||
| } = require('internal/errors').codes; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const { | ||
| // For easy access to the nextTick state in the C++ land, | ||
| // and to avoid unnecessary calls into JS land. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { ERR_INVALID_OPT_VALUE } = require('internal/errors').codes; | ||
|
|
||
| function highWaterMarkFrom(options, isDuplex, duplexKey) { | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const { inspect } = require('internal/util/inspect'); | ||
| const { | ||
| encodeStr, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const { | ||
| ERR_INVALID_ARG_TYPE, | ||
| ERR_NO_CRYPTO, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { JSON, Math } = primordials; | ||
|
|
||
| const { | ||
| getOwnNonIndexProperties, | ||
| getPromiseDetails, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -1,5 +1,7 @@ | ||
| 'use strict'; | ||
|
|
||
| const { JSON } = primordials; | ||
|
|
||
| const vm = require('vm'); | ||
|
|
||
| const scriptFiles = [ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -27,6 +27,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { | ||
| ERR_INVALID_CURSOR_POS, | ||
| ERR_INVALID_OPT_VALUE | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -42,6 +42,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { | ||
| builtinLibs, | ||
| makeRequireFunction, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -21,6 +21,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { | ||
| immediateInfo, | ||
| toggleImmediateRef | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -21,6 +21,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Reflect } = primordials; | ||
|
|
||
| const { | ||
| codes: { | ||
| ERR_FALSY_VALUE_REJECTION, | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -21,6 +21,8 @@ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const { Math } = primordials; | ||
|
|
||
| const { | ||
| codes: { | ||
| ERR_BROTLI_INVALID_PARAM, | ||