From de3a1c30197f75833d7211a37b1f291d3e61e099 Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin Date: Thu, 28 Nov 2019 10:30:51 +0100 Subject: [PATCH] lib: enforce use of primordial Number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/30700 Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat --- lib/.eslintrc.yaml | 2 ++ lib/internal/buffer.js | 1 + lib/internal/console/constructor.js | 1 + lib/internal/fs/utils.js | 1 + lib/internal/http2/util.js | 1 + lib/internal/repl.js | 1 + lib/internal/url.js | 1 + lib/internal/util/inspect.js | 3 ++- lib/net.js | 1 + 9 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index d50f6f2f367146..2823b7aa0d1def 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -17,6 +17,8 @@ rules: message: "Use `const { JSON } = primordials;` instead of the global." - name: Math message: "Use `const { Math } = primordials;` instead of the global." + - name: Number + message: "Use `const { Number } = primordials;` instead of the global." - name: Object message: "Use `const { Object } = primordials;` instead of the global." - name: Reflect diff --git a/lib/internal/buffer.js b/lib/internal/buffer.js index a14909e491c4f2..8d55f780fadc2d 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -2,6 +2,7 @@ const { MathFloor, + Number, } = primordials; const { diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 69dd4a6e4a7955..76b2066e9b7fd0 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -8,6 +8,7 @@ const { ArrayIsArray, Boolean, MathFloor, + Number, ObjectDefineProperties, ObjectDefineProperty, ObjectKeys, diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index c1dd1878ee2488..951030c5a50bd1 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -3,6 +3,7 @@ const { ArrayIsArray, DateNow, + Number, NumberIsFinite, ObjectSetPrototypeOf, ReflectOwnKeys, diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js index b43d6d421a4be0..d97ce2f13f0306 100644 --- a/lib/internal/http2/util.js +++ b/lib/internal/http2/util.js @@ -3,6 +3,7 @@ const { ArrayIsArray, MathMax, + Number, ObjectCreate, ObjectKeys, } = primordials; diff --git a/lib/internal/repl.js b/lib/internal/repl.js index 75a68c8ea859ef..565ab049c71487 100644 --- a/lib/internal/repl.js +++ b/lib/internal/repl.js @@ -1,6 +1,7 @@ 'use strict'; const { + Number, NumberIsNaN, ObjectCreate, } = primordials; diff --git a/lib/internal/url.js b/lib/internal/url.js index a30bcf5b9855e6..3c75baf27b0973 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -2,6 +2,7 @@ const { Array, + Number, ObjectCreate, ObjectDefineProperties, ObjectDefineProperty, diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 2a7dd40eca1b7e..f0888dc2a2dac9 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -16,6 +16,7 @@ const { MathMin, MathRound, MathSqrt, + Number, NumberIsNaN, NumberPrototypeValueOf, ObjectAssign, @@ -39,7 +40,7 @@ const { SymbolPrototypeValueOf, SymbolIterator, SymbolToStringTag, - uncurryThis + uncurryThis, } = primordials; const { diff --git a/lib/net.js b/lib/net.js index db63a0cc9da516..02fd18748036a3 100644 --- a/lib/net.js +++ b/lib/net.js @@ -24,6 +24,7 @@ const { ArrayIsArray, Boolean, + Number, NumberIsNaN, ObjectDefineProperty, ObjectSetPrototypeOf,