lib: replace use of Error with primordials

PR-URL: https://github.com/nodejs/node/pull/31163
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Sebastien Ahkrin 2020-01-02 19:19:02 +01:00 committed by Rich Trott
parent 256c9a43f4
commit c9b93e2344
29 changed files with 34 additions and 0 deletions

View File

@ -15,6 +15,8 @@ rules:
message: "Use `const { BigInt } = primordials;` instead of the global."
- name: Boolean
message: "Use `const { Boolean } = primordials;` instead of the global."
- name: Error
message: "Use `const { Error } = primordials;` instead of the global."
- name: JSON
message: "Use `const { JSON } = primordials;` instead of the global."
- name: Math

View File

@ -24,6 +24,7 @@
const {
ArrayIsArray,
Boolean,
Error,
NumberIsFinite,
ObjectAssign,
ObjectKeys,

View File

@ -22,6 +22,7 @@
'use strict';
const {
Error,
ObjectKeys,
ObjectSetPrototypeOf,
Symbol,

View File

@ -21,6 +21,7 @@
'use strict';
const {
Error,
ObjectAssign,
ObjectIs,
ObjectKeys,

View File

@ -24,6 +24,7 @@
const {
Array,
ArrayIsArray,
Error,
MathFloor,
MathMin,
MathTrunc,

View File

@ -23,6 +23,7 @@
const {
ArrayIsArray,
Error,
NumberIsInteger,
ObjectAssign,
ObjectDefineProperty,

View File

@ -28,6 +28,7 @@
const {
Array,
Error,
ObjectDefineProperty,
ReflectApply,
Symbol,

View File

@ -24,6 +24,7 @@
const {
Array,
Boolean,
Error,
MathMin,
NumberIsNaN,
ObjectCreate,

View File

@ -1,6 +1,7 @@
'use strict';
const {
Error,
MathMax,
ObjectCreate,
ObjectDefineProperty,

View File

@ -1,6 +1,7 @@
'use strict';
const {
Error,
FunctionPrototypeBind,
NumberIsSafeInteger,
ObjectDefineProperty,

View File

@ -44,6 +44,7 @@
/* global process, getLinkedBinding, getInternalBinding, primordials */
const {
Error,
ReflectGet,
ObjectCreate,
ObjectDefineProperty,

View File

@ -7,6 +7,7 @@ const {
ArrayFrom,
ArrayIsArray,
Boolean,
Error,
MathFloor,
Number,
ObjectDefineProperties,

View File

@ -3,6 +3,7 @@
const Buffer = require('buffer').Buffer;
const {
ArrayPrototypeForEach,
Error,
FunctionPrototypeCall,
ObjectAssign,
ObjectCreate,

View File

@ -12,6 +12,7 @@
const {
ArrayIsArray,
Error,
MathAbs,
NumberIsInteger,
ObjectDefineProperty,

View File

@ -4,6 +4,7 @@ const {
ArrayIsArray,
BigInt,
DateNow,
Error,
Number,
NumberIsFinite,
ObjectSetPrototypeOf,

View File

@ -2,6 +2,7 @@
const {
ArrayIsArray,
Error,
MathMax,
Number,
ObjectCreate,

View File

@ -23,6 +23,7 @@
const {
ArrayIsArray,
Error,
JSONParse,
ObjectCreate,
ObjectDefineProperty,

View File

@ -1,6 +1,7 @@
'use strict';
const {
Error,
ObjectDefineProperties,
ObjectDefineProperty,
SafeWeakMap,

View File

@ -1,6 +1,7 @@
'use strict';
const {
Error,
ObjectDefineProperty,
WeakMap,
} = primordials;

View File

@ -2,6 +2,7 @@
const {
ArrayIsArray,
Error,
} = primordials;
const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;

View File

@ -1,5 +1,9 @@
'use strict';
const {
Error,
} = primordials;
const debug = require('internal/util/debuglog').debuglog('source_map');
const { findSourceMap } = require('internal/source_map/source_map_cache');
const {

View File

@ -3,6 +3,7 @@
const {
ArrayFrom,
ArrayIsArray,
Error,
ObjectCreate,
ObjectDefineProperties,
ObjectDefineProperty,

View File

@ -5,6 +5,7 @@ const {
BigIntPrototypeValueOf,
BooleanPrototypeValueOf,
DatePrototypeGetTime,
Error,
NumberIsNaN,
NumberPrototypeValueOf,
ObjectGetOwnPropertySymbols,

View File

@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* eslint-disable no-restricted-globals */
module.exports = { versionCheck };
// Don't execute when required directly instead of being eval'd from

View File

@ -24,6 +24,7 @@
const {
ArrayIsArray,
Boolean,
Error,
Number,
NumberIsNaN,
ObjectDefineProperty,

View File

@ -43,6 +43,7 @@
'use strict';
const {
Error,
MathMax,
NumberIsNaN,
ObjectAssign,

View File

@ -23,6 +23,7 @@
const {
ArrayIsArray,
Error,
NumberIsSafeInteger,
ObjectDefineProperties,
ObjectDefineProperty,

View File

@ -17,6 +17,7 @@
const {
Array,
ArrayBuffer,
Error,
Float32Array,
Float64Array,
Int16Array,

View File

@ -22,6 +22,7 @@
'use strict';
const {
Error,
MathMax,
NumberIsFinite,
NumberIsNaN,