Skip to content

Commit 757c104

Browse files
authoredJan 10, 2023
tools: add prefer-proto rule
fixup: add support for `Object.create(null)` fixup: extend to any 1-argument Object.create call fixup: add tests PR-URL: nodejs#46083 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 5d9a9a6 commit 757c104

File tree

87 files changed

+307
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+307
-231
lines changed
 

‎.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ module.exports = {
314314
// Custom rules from eslint-plugin-node-core
315315
'node-core/no-unescaped-regexp-dot': 'error',
316316
'node-core/no-duplicate-requires': 'error',
317+
'node-core/prefer-proto': 'error',
317318
},
318319
globals: {
319320
ByteLengthQueuingStrategy: 'readable',

‎benchmark/es/map-bench.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function runObject(n) {
2525
}
2626

2727
function runNullProtoObject(n) {
28-
const m = Object.create(null);
28+
const m = { __proto__: null };
2929
bench.start();
3030
for (let i = 0; i < n; i++) {
3131
m[`i${i}`] = i;
@@ -51,7 +51,7 @@ function runNullProtoLiteralObject(n) {
5151
}
5252

5353
function StorageObject() {}
54-
StorageObject.prototype = Object.create(null);
54+
StorageObject.prototype = { __proto__: null };
5555

5656
function runStorageObject(n) {
5757
const m = new StorageObject();

0 commit comments

Comments
 (0)
Please sign in to comment.