From 373a3193bc54283cb03adc2aa75bb2b29685cbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Thu, 28 Nov 2019 08:19:55 +0100 Subject: [PATCH] lib: enforce use of Boolean from primordials Refs: https://github.com/nodejs/node/issues/30697 --- 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(+) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 1b75d7e742e66d..d50f6f2f367146 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 7292fd255edb97..249a6d6028f7af 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 6794e8d41996f1..61023b83705bcb 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 0e96f16dfd3eb5..69dd4a6e4a7955 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 b8d7dadb94fa92..6a55b4edd19311 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 b6957f6e8a1a61..27110f82797c41 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 1af974e83e1b79..6404e821b13e0d 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 8fb5d2cd138ebb..3370ecf117046f 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 32db324e6bc985..7121fb389984b0 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -2,6 +2,7 @@ const { ArrayIsArray, + Boolean, ObjectDefineProperties, ObjectDefineProperty, ObjectKeys,