From 7fc5980cfe79c9b7ff19837397823a583c9fd8fe Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Thu, 28 Nov 2019 08:19:55 +0100 Subject: lib: enforce use of Boolean from primordials Refs: https://github.com/nodejs/node/issues/30697 PR-URL: https://github.com/nodejs/node/pull/30698 Reviewed-By: Trivikram Kamat Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Yongsheng Zhang --- lib/.eslintrc.yaml | 2 ++ lib/_http_client.js | 1 + lib/internal/cluster/round_robin_handle.js | 5 +++++ lib/internal/console/constructor.js | 1 + lib/internal/http2/compat.js | 1 + lib/internal/readline/utils.js | 4 ++++ lib/internal/repl/history.js | 4 ++++ lib/net.js | 1 + lib/perf_hooks.js | 1 + 9 files changed, 20 insertions(+) (limited to 'lib') diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 1b75d7e742..d50f6f2f36 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -11,6 +11,8 @@ rules: - error - name: Array message: "Use `const { Array } = primordials;` instead of the global." + - name: Boolean + message: "Use `const { Boolean } = primordials;` instead of the global." - name: JSON message: "Use `const { JSON } = primordials;` instead of the global." - name: Math diff --git a/lib/_http_client.js b/lib/_http_client.js index 7292fd255e..249a6d6028 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -23,6 +23,7 @@ const { ArrayIsArray, + Boolean, ObjectAssign, ObjectKeys, ObjectSetPrototypeOf, diff --git a/lib/internal/cluster/round_robin_handle.js b/lib/internal/cluster/round_robin_handle.js index 6794e8d419..61023b8370 100644 --- a/lib/internal/cluster/round_robin_handle.js +++ b/lib/internal/cluster/round_robin_handle.js @@ -1,4 +1,9 @@ 'use strict'; + +const { + Boolean, +} = primordials; + const assert = require('internal/assert'); const net = require('net'); const { sendHelper } = require('internal/cluster/utils'); diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 0e96f16dfd..69dd4a6e4a 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -6,6 +6,7 @@ const { ArrayFrom, ArrayIsArray, + Boolean, MathFloor, ObjectDefineProperties, ObjectDefineProperty, diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index b8d7dadb94..6a55b4edd1 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -2,6 +2,7 @@ const { ArrayIsArray, + Boolean, ObjectAssign, ObjectCreate, ObjectKeys, diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js index b6957f6e8a..27110f8279 100644 --- a/lib/internal/readline/utils.js +++ b/lib/internal/readline/utils.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Boolean, +} = primordials; + // Regex used for ansi escape code splitting // Adopted from https://github.com/chalk/ansi-regex/blob/master/index.js // License: MIT, authors: @sindresorhus, Qix-, and arjunmehta diff --git a/lib/internal/repl/history.js b/lib/internal/repl/history.js index 1af974e83e..6404e821b1 100644 --- a/lib/internal/repl/history.js +++ b/lib/internal/repl/history.js @@ -1,5 +1,9 @@ 'use strict'; +const { + Boolean, +} = primordials; + const { Interface } = require('readline'); const path = require('path'); const fs = require('fs'); diff --git a/lib/net.js b/lib/net.js index 8fb5d2cd13..3370ecf117 100644 --- a/lib/net.js +++ b/lib/net.js @@ -23,6 +23,7 @@ const { ArrayIsArray, + Boolean, ObjectDefineProperty, ObjectSetPrototypeOf, } = primordials; diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 32db324e6b..7121fb3899 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -2,6 +2,7 @@ const { ArrayIsArray, + Boolean, ObjectDefineProperties, ObjectDefineProperty, ObjectKeys, -- cgit v1.2.3