From b7c0914e0fd59123c10adcc6c626d1dd5ca2a0e9 Mon Sep 17 00:00:00 2001 From: Nodari Chkuaselidze Date: Thu, 25 Apr 2024 20:40:41 +0400 Subject: [PATCH] pkg: update lint and fix rbt performance for v14 and v16. rbt: remove public class fields (minor) as node v14 and v16 struggle with performance when they are declared. (almost 5x) --- .eslintrc.json | 18 ++++-------------- lib/key.js | 1 + lib/rbt.js | 36 ------------------------------------ 3 files changed, 5 insertions(+), 50 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 4db51ca..45ef023 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,19 +1,9 @@ { "env": { - "es6": true, + "es2022": true, "node": true }, "extends": "eslint:recommended", - "globals": { - "Atomics": "readable", - "BigInt": "readable", - "BigInt64Array": "readable", - "BigUint64Array": "readable", - "queueMicrotask": "readable", - "SharedArrayBuffer": "readable", - "TextEncoder": "readable", - "TextDecoder": "readable" - }, "overrides": [ { "files": ["*.mjs"], @@ -39,13 +29,13 @@ }, "rules": { "max-len": "off", - "prefer-arrow-callback": "off" + "prefer-arrow-callback": "off", + "no-return-assign": "off" } } ], - "parser": "babel-eslint", "parserOptions": { - "ecmaVersion": 10, + "ecmaVersion": 13, "ecmaFeatures": { "globalReturn": true }, diff --git a/lib/key.js b/lib/key.js index 6fb7dda..d1b6fc3 100644 --- a/lib/key.js +++ b/lib/key.js @@ -343,6 +343,7 @@ class BaseKey { assert(typeof name === 'string'); + // eslint-disable-next-line no-prototype-builtins if (!types.hasOwnProperty(name)) throw new Error(`Invalid type name: ${name}.`); diff --git a/lib/rbt.js b/lib/rbt.js index 61332fa..436c14e 100644 --- a/lib/rbt.js +++ b/lib/rbt.js @@ -759,24 +759,6 @@ class RBTIterator { */ class RBTNode { - /** @type {Buffer} */ - key; - - /** @type {Buffer} */ - value; - - /** @type {Number} */ - color; - - /** @type {RBTNode|RBTSentinel} */ - parent; - - /** @type {RBTNode|RBTSentinel} */ - left; - - /** @type {RBTNode|RBTSentinel} */ - right; - /** * Create an RBT node. * @constructor @@ -849,24 +831,6 @@ class RBTNode { */ class RBTSentinel { - /** @type {null} */ - key; - - /** @type {null} */ - value; - - /** @type {Number} */ - color; - - /** @type {null} */ - parent; - - /** @type {null} */ - left; - - /** @type {null} */ - right; - /** * Create an RBT Sentinel Node. * @constructor