From 696515d0521621520b64016b219d0da8d2666e90 Mon Sep 17 00:00:00 2001 From: Marcin Lewandowski Date: Fri, 5 Apr 2024 21:13:42 +0200 Subject: [PATCH 1/4] using unicore to enforce rules --- .eslintrc.js | 19 +- package-lock.json | 1062 ++++++++++++++++++++++++++++++++++----------- package.json | 3 +- 3 files changed, 834 insertions(+), 250 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e80070b5..00edc862 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,8 @@ module.exports = { }, "extends": [ "eslint:recommended", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "plugin:unicorn/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -14,12 +15,24 @@ module.exports = { "sourceType": "module" }, "plugins": [ - "@typescript-eslint" + "@typescript-eslint", + "unicorn" ], "rules": { + "no-console": "warn", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/no-unused-vars": "off", - "no-console": "warn", + "unicorn/prefer-node-protocol": "error", + "unicorn/prevent-abbreviations": "off", + "unicorn/filename-case": "off", + "unicorn/no-null": "off", + "unicorn/catch-error-name": "off", + "unicorn/no-array-push-push": "off", + "unicorn/no-lonely-if": "off", + "unicorn/explicit-length-check": "off", + "unicorn/numeric-separators-style": "off", + "unicorn/no-await-expression-member": "off", + "unicorn/no-zero-fractions": "off" } } diff --git a/package-lock.json b/package-lock.json index 654b378e..fb530a79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,8 @@ "@typescript-eslint/eslint-plugin": "^7.4.0", "@typescript-eslint/parser": "^7.4.0", "cross-os": "^1.5.0", - "eslint": "^8.22.0", + "eslint": "^8.57.0", + "eslint-plugin-unicorn": "^52.0.0", "glob": "^10.3.12", "http-proxy-agent": "^7.0.2", "lodash.orderby": "^4.6.0", @@ -99,27 +100,27 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.1.tgz", - "integrity": "sha512-Pc65opHDliVpRHuKfzI+gSA4zcgr65O4cl64fFJIWEEh8JoHIHh0Oez1Eo8Arz8zq/JhgKodQaxEwUPRtZylVA==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.4.tgz", + "integrity": "sha512-vg8Gih2MLK+kOkHJp4gBEIkyaIi00jgWot2D9QOmmfLC8jINSOzmCLta6Bvz/JSBCqnegV0L80jhxkol5GWNfQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.24.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.3.tgz", - "integrity": "sha512-5FcvN1JHw2sHJChotgx8Ek0lyuh4kCKelgMTTqhYJJtloNvUfpAFMeNQUtdlIaktwrSV9LtCdqwk48wL2wBacQ==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.4.tgz", + "integrity": "sha512-MBVlMXP+kkl5394RBLSxxk/iLTeVGuXTV3cIDXavPpMMqnSnt6apKgan/U8O3USWZCWZT/TbgfEpKa4uMgN4Dg==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.24.2", - "@babel/generator": "^7.24.1", + "@babel/generator": "^7.24.4", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.24.1", - "@babel/parser": "^7.24.1", + "@babel/helpers": "^7.24.4", + "@babel/parser": "^7.24.4", "@babel/template": "^7.24.0", "@babel/traverse": "^7.24.1", "@babel/types": "^7.24.0", @@ -153,9 +154,9 @@ } }, "node_modules/@babel/generator": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.1.tgz", - "integrity": "sha512-DfCRfZsBcrPEHUfuBMgbJ1Ut01Y/itOs+hY2nFLgqsqXd52/iSiVq5TITtUasIUgm+IIKdY2/1I7auiQOEeC9A==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.4.tgz", + "integrity": "sha512-Xd6+v6SnjWVx/nus+y0l1sxMOTOMBkyL4+BIdbALyatQnAe/SRVjANeDPSCYaX+i1iJmuGSKf3Z+E+V/va1Hvw==", "dev": true, "dependencies": { "@babel/types": "^7.24.0", @@ -309,9 +310,9 @@ } }, "node_modules/@babel/helpers": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.1.tgz", - "integrity": "sha512-BpU09QqEe6ZCHuIHFphEFgvNSrubve1FtyMton26ekZ85gRGi6LrTF7zArARp2YvyFxloeiRmtSCq5sjh1WqIg==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.4.tgz", + "integrity": "sha512-FewdlZbSiwaVGlgT1DPANDuCHaDMiOo+D/IDYRFYjHOuv66xMSJ7fQwwODwRNAPkADIO/z1EoF/l2BCWlWABDw==", "dev": true, "dependencies": { "@babel/template": "^7.24.0", @@ -409,9 +410,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.1.tgz", - "integrity": "sha512-Zo9c7N3xdOIQrNip7Lc9wvRPzlRtovHVE4lkz8WEDr7uYh/GMQhSiIgFxGIArRHYdJE5kxtZjAf8rT0xhdLCzg==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.4.tgz", + "integrity": "sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -421,9 +422,9 @@ } }, "node_modules/@babel/runtime-corejs3": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.24.1.tgz", - "integrity": "sha512-T9ko/35G+Bkl+win48GduaPlhSlOjjE5s1TeiEcD+QpxlLQnoEfb/nO/T+TQqkm+ipFwORn+rB8w14iJ/uD0bg==", + "version": "7.24.4", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.24.4.tgz", + "integrity": "sha512-VOQOexSilscN24VEY810G/PqtpFvx/z6UqDIjIWbDe2368HhDLkYN5TYwaEz/+eRCUkhJ2WaNLLmQAlxzfWj4w==", "dependencies": { "core-js-pure": "^3.30.2", "regenerator-runtime": "^0.14.0" @@ -640,9 +641,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, "node_modules/@isaacs/cliui": { @@ -674,41 +675,6 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/@isaacs/cliui/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@isaacs/cliui/node_modules/strip-ansi": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", @@ -724,23 +690,6 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1029,9 +978,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.19.26", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.26.tgz", - "integrity": "sha512-+wiMJsIwLOYCvUqSdKTrfkS8mpTp+MPINe6+Np4TAGFWWRWiBQ5kSq9nZGCSPkzx9mvT+uEukzpX4MOSCydcvw==", + "version": "18.19.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.29.tgz", + "integrity": "sha512-5pAX7ggTmWZdhUrhRWLPf+5oM7F80bcKVCBbr0zwEkTNzTJL2CWQjznpFgHYy6GrzkYi2Yjy7DHKoynFxqPV8g==", "dependencies": { "undici-types": "~5.26.4" } @@ -1045,6 +994,12 @@ "form-data": "^4.0.0" } }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", + "dev": true + }, "node_modules/@types/pluralize": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/pluralize/-/pluralize-0.0.29.tgz", @@ -1137,16 +1092,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.4.0.tgz", - "integrity": "sha512-yHMQ/oFaM7HZdVrVm/M2WHaNPgyuJH4WelkSVEWSSsir34kxW2kDJCxlXRhhGWEsMN0WAW/vLpKfKVcm8k+MPw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.5.0.tgz", + "integrity": "sha512-HpqNTH8Du34nLxbKgVMGljZMG0rJd2O9ecvr2QLYp+7512ty1j42KnsFwspPXg1Vh8an9YImf6CokUBltisZFQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.4.0", - "@typescript-eslint/type-utils": "7.4.0", - "@typescript-eslint/utils": "7.4.0", - "@typescript-eslint/visitor-keys": "7.4.0", + "@typescript-eslint/scope-manager": "7.5.0", + "@typescript-eslint/type-utils": "7.5.0", + "@typescript-eslint/utils": "7.5.0", + "@typescript-eslint/visitor-keys": "7.5.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1172,15 +1127,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.4.0.tgz", - "integrity": "sha512-ZvKHxHLusweEUVwrGRXXUVzFgnWhigo4JurEj0dGF1tbcGh6buL+ejDdjxOQxv6ytcY1uhun1p2sm8iWStlgLQ==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.5.0.tgz", + "integrity": "sha512-cj+XGhNujfD2/wzR1tabNsidnYRaFfEkcULdcIyVBYcXjBvBKOes+mpMBP7hMpOyk+gBcfXsrg4NBGAStQyxjQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.4.0", - "@typescript-eslint/types": "7.4.0", - "@typescript-eslint/typescript-estree": "7.4.0", - "@typescript-eslint/visitor-keys": "7.4.0", + "@typescript-eslint/scope-manager": "7.5.0", + "@typescript-eslint/types": "7.5.0", + "@typescript-eslint/typescript-estree": "7.5.0", + "@typescript-eslint/visitor-keys": "7.5.0", "debug": "^4.3.4" }, "engines": { @@ -1200,13 +1155,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.4.0.tgz", - "integrity": "sha512-68VqENG5HK27ypafqLVs8qO+RkNc7TezCduYrx8YJpXq2QGZ30vmNZGJJJC48+MVn4G2dCV8m5ZTVnzRexTVtw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.5.0.tgz", + "integrity": "sha512-Z1r7uJY0MDeUlql9XJ6kRVgk/sP11sr3HKXn268HZyqL7i4cEfrdFuSSY/0tUqT37l5zT0tJOsuDP16kio85iA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.4.0", - "@typescript-eslint/visitor-keys": "7.4.0" + "@typescript-eslint/types": "7.5.0", + "@typescript-eslint/visitor-keys": "7.5.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -1217,13 +1172,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.4.0.tgz", - "integrity": "sha512-247ETeHgr9WTRMqHbbQdzwzhuyaJ8dPTuyuUEMANqzMRB1rj/9qFIuIXK7l0FX9i9FXbHeBQl/4uz6mYuCE7Aw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.5.0.tgz", + "integrity": "sha512-A021Rj33+G8mx2Dqh0nMO9GyjjIBK3MqgVgZ2qlKf6CJy51wY/lkkFqq3TqqnH34XyAHUkq27IjlUkWlQRpLHw==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.4.0", - "@typescript-eslint/utils": "7.4.0", + "@typescript-eslint/typescript-estree": "7.5.0", + "@typescript-eslint/utils": "7.5.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1244,9 +1199,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.4.0.tgz", - "integrity": "sha512-mjQopsbffzJskos5B4HmbsadSJQWaRK0UxqQ7GuNA9Ga4bEKeiO6b2DnB6cM6bpc8lemaPseh0H9B/wyg+J7rw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.5.0.tgz", + "integrity": "sha512-tv5B4IHeAdhR7uS4+bf8Ov3k793VEVHd45viRRkehIUZxm0WF82VPiLgHzA/Xl4TGPg1ZD49vfxBKFPecD5/mg==", "dev": true, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -1257,13 +1212,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.4.0.tgz", - "integrity": "sha512-A99j5AYoME/UBQ1ucEbbMEmGkN7SE0BvZFreSnTd1luq7yulcHdyGamZKizU7canpGDWGJ+Q6ZA9SyQobipePg==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.5.0.tgz", + "integrity": "sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.4.0", - "@typescript-eslint/visitor-keys": "7.4.0", + "@typescript-eslint/types": "7.5.0", + "@typescript-eslint/visitor-keys": "7.5.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1285,17 +1240,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.4.0.tgz", - "integrity": "sha512-NQt9QLM4Tt8qrlBVY9lkMYzfYtNz8/6qwZg8pI3cMGlPnj6mOpRxxAm7BMJN9K0AiY+1BwJ5lVC650YJqYOuNg==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.5.0.tgz", + "integrity": "sha512-3vZl9u0R+/FLQcpy2EHyRGNqAS/ofJ3Ji8aebilfJe+fobK8+LbIFmrHciLVDxjDoONmufDcnVSF38KwMEOjzw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.4.0", - "@typescript-eslint/types": "7.4.0", - "@typescript-eslint/typescript-estree": "7.4.0", + "@typescript-eslint/scope-manager": "7.5.0", + "@typescript-eslint/types": "7.5.0", + "@typescript-eslint/typescript-estree": "7.5.0", "semver": "^7.5.4" }, "engines": { @@ -1310,12 +1265,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.4.0.tgz", - "integrity": "sha512-0zkC7YM0iX5Y41homUUeW1CHtZR01K3ybjM1l6QczoMuay0XKtrb93kv95AxUGwdjGr64nNqnOCwmEl616N8CA==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.5.0.tgz", + "integrity": "sha512-mcuHM/QircmA6O7fy6nn2w/3ditQkj+SgtOc8DW3uQ10Yfj42amm2i+6F2K4YAOPNNTmE6iM1ynM6lrSwdendA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.4.0", + "@typescript-eslint/types": "7.5.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1363,9 +1318,9 @@ } }, "node_modules/agent-base": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", - "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", "dev": true, "dependencies": { "debug": "^4.3.4" @@ -1541,6 +1496,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bluebird": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", + "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==", + "dev": true + }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -1624,6 +1585,18 @@ "node": ">=0.2.0" } }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bundle-name": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", @@ -1700,9 +1673,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001600", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001600.tgz", - "integrity": "sha512-+2S9/2JFhYmYaDpZvo0lKkfvuKIglrx68MwOBqMGHhQsNkLjB5xtc/TGoEPs+MxjSyN/72qer2g97nzR641mOQ==", + "version": "1.0.30001606", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001606.tgz", + "integrity": "sha512-LPbwnW4vfpJId225pwjZJOgX1m9sGfbw/RKJvw/t0QhYOOaTXHvkjVGFGPpvwEzufrjvTlsULnVTxdy4/6cqkg==", "dev": true, "funding": [ { @@ -1819,6 +1792,42 @@ "node": ">= 6" } }, + "node_modules/ci-info": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz", + "integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/clean-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clean-regexp/-/clean-regexp-1.0.0.tgz", + "integrity": "sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/clean-regexp/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -1839,6 +1848,43 @@ "wrap-ansi": "^7.0.0" } }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1895,6 +1941,19 @@ "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", "dev": true }, + "node_modules/core-js-compat": { + "version": "3.36.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.36.1.tgz", + "integrity": "sha512-Dk997v9ZCt3X/npqzyGdTlq6t7lDBhZwGvV94PKzDArjp7BTRm7WlDAXYd/OWdeFHO8OChQYRJNJvUCqCbrtKA==", + "dev": true, + "dependencies": { + "browserslist": "^4.23.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/core-js-pure": { "version": "3.36.1", "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.36.1.tgz", @@ -1906,9 +1965,10 @@ } }, "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true }, "node_modules/create-require": { "version": "1.1.1", @@ -2124,12 +2184,6 @@ "readable-stream": "^2.0.2" } }, - "node_modules/duplexer2/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, "node_modules/duplexer2/node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", @@ -2151,15 +2205,6 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/duplexer2/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -2167,17 +2212,26 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.721", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.721.tgz", - "integrity": "sha512-k1x2r6foI8iJOp+1qTxbbrrWMsOiHkzGBYwYigaq+apO1FSqtn44KTo3Sy69qt7CRr7149zTcsDvH7MUKsOuIQ==", + "version": "1.4.728", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.728.tgz", + "integrity": "sha512-Ud1v7hJJYIqehlUJGqR6PF1Ek8l80zWwxA6nGxigBsGJ9f9M2fciHyrIiNMerSHSH3p+0/Ia7jIlnDkt41h5cw==", "dev": true }, "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, "node_modules/es-define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", @@ -2290,6 +2344,60 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-plugin-unicorn": { + "version": "52.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-52.0.0.tgz", + "integrity": "sha512-1Yzm7/m+0R4djH0tjDjfVei/ju2w3AzUGjG6q8JnuNIL5xIwsflyCooW5sfBvQp2pMYQFSWWCFONsjCax1EHng==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "@eslint-community/eslint-utils": "^4.4.0", + "@eslint/eslintrc": "^2.1.4", + "ci-info": "^4.0.0", + "clean-regexp": "^1.0.0", + "core-js-compat": "^3.34.0", + "esquery": "^1.5.0", + "indent-string": "^4.0.0", + "is-builtin-module": "^3.2.1", + "jsesc": "^3.0.2", + "pluralize": "^8.0.0", + "read-pkg-up": "^7.0.1", + "regexp-tree": "^0.1.27", + "regjsparser": "^0.10.0", + "semver": "^7.5.4", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" + }, + "peerDependencies": { + "eslint": ">=8.56.0" + } + }, + "node_modules/eslint-plugin-unicorn/node_modules/jsesc": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/eslint-plugin-unicorn/node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -2619,16 +2727,19 @@ "dev": true }, "node_modules/foreground-child": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", - "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", "dev": true, "dependencies": { "cross-spawn": "^7.0.0", - "signal-exit": "^3.0.2" + "signal-exit": "^4.0.1" }, "engines": { - "node": ">=8.0.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/form-data": { @@ -2670,20 +2781,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/fstream": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", @@ -2840,34 +2937,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob/node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -3022,6 +3091,12 @@ "upper-case": "^1.1.3" } }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -3099,6 +3174,12 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -3116,7 +3197,34 @@ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, - "node_modules/is-docker": { + "node_modules/is-builtin-module": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.3.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", @@ -3276,6 +3384,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3520,6 +3634,12 @@ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -3572,6 +3692,12 @@ "node": ">= 0.8.0" } }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, "node_modules/listenercount": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", @@ -3736,6 +3862,15 @@ "node": ">= 0.6" } }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -3946,6 +4081,27 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -4017,6 +4173,12 @@ "wrap-ansi": "^6.2.0" } }, + "node_modules/nyc/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "node_modules/nyc/node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -4030,6 +4192,19 @@ "node": ">=8" } }, + "node_modules/nyc/node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/nyc/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -4125,6 +4300,26 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/nyc/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/nyc/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/nyc/node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -4355,6 +4550,24 @@ "node": ">=6" } }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/pascal-case": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-2.0.1.tgz", @@ -4399,6 +4612,12 @@ "node": ">=8" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "node_modules/path-scurry": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", @@ -4605,6 +4824,108 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", @@ -4635,6 +4956,36 @@ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, + "node_modules/regexp-tree": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz", + "integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==", + "dev": true, + "bin": { + "regexp-tree": "bin/regexp-tree" + } + }, + "node_modules/regjsparser": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.10.0.tgz", + "integrity": "sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==", + "dev": true, + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, "node_modules/release-zalgo": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", @@ -4662,6 +5013,23 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -4738,6 +5106,7 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, "funding": [ { "type": "github", @@ -4884,10 +5253,16 @@ } }, "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, "node_modules/sinon": { "version": "17.0.1", @@ -4979,6 +5354,19 @@ "concat-map": "0.0.1" } }, + "node_modules/spawn-wrap/node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/spawn-wrap/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -5026,6 +5414,44 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/spawn-wrap/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.17.tgz", + "integrity": "sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==", + "dev": true + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -5046,25 +5472,33 @@ } }, "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dependencies": { - "safe-buffer": "~5.2.0" + "safe-buffer": "~5.1.0" } }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/string-width-cjs": { @@ -5082,6 +5516,39 @@ "node": ">=8" } }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -5116,6 +5583,18 @@ "node": ">=8" } }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -5140,6 +5619,18 @@ "node": ">=8" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/swap-case": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz", @@ -5362,9 +5853,9 @@ } }, "node_modules/typescript": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", - "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", + "integrity": "sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5397,18 +5888,6 @@ "setimmediate": "~1.0.4" } }, - "node_modules/unzipper/node_modules/bluebird": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", - "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==", - "dev": true - }, - "node_modules/unzipper/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, "node_modules/unzipper/node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", @@ -5430,15 +5909,6 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/unzipper/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", @@ -5514,6 +5984,16 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "node_modules/verror": { "version": "1.10.1", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz", @@ -5527,6 +6007,11 @@ "node": ">=0.6.0" } }, + "node_modules/verror/node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -5569,17 +6054,17 @@ "dev": true }, "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" @@ -5603,6 +6088,65 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -5621,6 +6165,12 @@ "typedarray-to-buffer": "^3.1.5" } }, + "node_modules/write-file-atomic/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, "node_modules/ws": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", @@ -5730,6 +6280,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/package.json b/package.json index 155d1252..e30a412a 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,8 @@ "@typescript-eslint/eslint-plugin": "^7.4.0", "@typescript-eslint/parser": "^7.4.0", "cross-os": "^1.5.0", - "eslint": "^8.22.0", + "eslint": "^8.57.0", + "eslint-plugin-unicorn": "^52.0.0", "glob": "^10.3.12", "http-proxy-agent": "^7.0.2", "lodash.orderby": "^4.6.0", From 934fd9dbe8ba1655aaddefb7b944b369221148a0 Mon Sep 17 00:00:00 2001 From: Marcin Lewandowski Date: Fri, 5 Apr 2024 23:16:06 +0200 Subject: [PATCH 2/4] enforcing rules --- src/Auth/Certificate.ts | 2 +- src/Documents/BulkInsertOperation.ts | 2 +- src/Documents/Changes/DatabaseChanges.ts | 2 +- .../Changes/DatabaseConnectionState.ts | 2 +- src/Documents/DocumentStoreBase.ts | 2 +- src/Documents/Session/AbstractDocumentQuery.ts | 6 +++--- src/Documents/Session/DocumentSession.ts | 2 +- .../InMemoryDocumentSessionOperations.ts | 8 ++++---- src/Documents/Session/JavaScriptMap.ts | 2 +- src/Documents/Session/SessionTimeSeriesBase.ts | 6 +++--- src/Documents/Session/Tokens/DeclareToken.ts | 2 +- src/Documents/Smuggler/BackupUtils.ts | 4 ++-- src/Documents/Smuggler/DatabaseSmuggler.ts | 4 ++-- .../Subscriptions/DocumentSubscriptions.ts | 2 +- .../Subscriptions/SubscriptionBatch.ts | 2 +- .../Subscriptions/SubscriptionWorker.ts | 6 +++--- src/Exceptions/index.ts | 6 +++--- src/Http/ClusterRequestExecutor.ts | 2 +- src/Http/RavenCommand.ts | 2 +- src/Http/RavenCommandResponsePipeline.ts | 4 ++-- src/Http/RequestExecutor.ts | 12 ++++++------ src/Primitives/Events.ts | 2 +- .../Commands/GetDatabaseTopologyCommand.ts | 2 +- src/ServerWide/Tcp/TcpNegotiateParameters.ts | 2 +- src/ServerWide/Tcp/TcpNegotiation.ts | 2 +- src/Types/readable-stream.ts | 2 +- src/Utility/HttpUtil.ts | 2 +- src/Utility/LogUtil.ts | 2 +- src/Utility/PromiseUtil.ts | 2 +- src/Utility/StringBuilder.ts | 2 +- src/Utility/TcpUtils.ts | 10 +++++----- src/Utility/TimeUtil.ts | 4 ++-- src/Utility/UriUtil.ts | 2 +- .../Commands/DeleteDocumentCommandTest.ts | 2 +- .../Commands/GetDocumentCommandTests.ts | 2 +- .../Commands/GetNextOperationIdCommandTests.ts | 2 +- .../Commands/GetStatisticsCommandTests.ts | 2 +- .../Commands/PutDocumentCommandTests.ts | 2 +- .../Documents/CustomKeyCaseConventionsTests.ts | 2 +- test/Documents/DisableTrackingTests.ts | 2 +- test/Documents/IdGeneration.ts | 2 +- test/Documents/MetadataAsDictTests.ts | 2 +- .../Operations/ClientConfigurationTest.ts | 2 +- test/Documents/Operations/DeleteByQueryTest.ts | 2 +- .../Operations/IndexesOperationsTests.ts | 2 +- test/Documents/Queries/HashCalculatorTest.ts | 2 +- .../IDocumentQueryCustomizationMethodsTest.ts | 2 +- test/Documents/ReadmeSamples.ts | 8 ++++---- test/Documents/SessionApiTests.ts | 2 +- test/Executor/CompressionTests.ts | 2 +- test/Executor/RequestExecutorTests.ts | 4 ++-- test/Issues/Github_204.ts | 2 +- test/Issues/Github_315.ts | 2 +- test/Issues/Github_67.ts | 4 ++-- test/Issues/RDBC-244.ts | 2 +- test/Issues/RDBC_202.ts | 2 +- test/Issues/RDBC_203.ts | 2 +- test/Issues/RDBC_213.ts | 2 +- test/Issues/RDBC_230.ts | 2 +- test/Issues/RDBC_233.ts | 2 +- test/Issues/RDBC_236.ts | 2 +- test/Issues/RDBC_247.ts | 2 +- test/Issues/RDBC_259.ts | 2 +- test/Issues/RDBC_265.ts | 2 +- test/Issues/RDBC_649.ts | 2 +- test/Issues/RDBC_658.ts | 2 +- test/Issues/RDBC_681.ts | 2 +- test/Issues/RavenDB_10566.ts | 2 +- test/Issues/RavenDB_10641.ts | 2 +- test/Issues/RavenDB_11649.ts | 2 +- test/Issues/RavenDB_11703.ts | 2 +- test/Issues/RavenDB_11770.ts | 2 +- test/Mapping/JsonTests.ts | 2 +- test/Mapping/ObjectMapperTests.ts | 2 +- test/Mapping/ObjectUtilTests.ts | 2 +- test/Mapping/StreamJsonTests.ts | 6 +++--- test/Mapping/StreamTests.ts | 2 +- .../Attachments/AttachmentsRevisionsTest.ts | 2 +- .../Attachments/AttachmentsSessionTest.ts | 2 +- test/Ported/BackupsTest.ts | 4 ++-- .../Bugs/Caching/CachingOfDocumentInclude.ts | 2 +- test/Ported/Bugs/SimpleMultiMapTest.ts | 2 +- test/Ported/BulkInsert/BulkInsertsTest.ts | 2 +- test/Ported/Cluster/ClusterTransactionTest.ts | 2 +- test/Ported/CompactTest.ts | 2 +- test/Ported/ContainsTest.ts | 2 +- .../Ported/Core/Streaming/DocumentStreaming.ts | 2 +- test/Ported/Core/Streaming/QueryStreaming.ts | 2 +- test/Ported/Counters/CountersSingleNodeTest.ts | 2 +- test/Ported/Counters/PatchOnCountersTest.ts | 2 +- test/Ported/Counters/QueryOnCountersTest.ts | 2 +- test/Ported/Counters/SessionCountersTest.ts | 2 +- test/Ported/CrudTest.ts | 2 +- test/Ported/CustomSerializationTest.ts | 2 +- test/Ported/DeleteTest.ts | 2 +- test/Ported/Documents/BasicDocumentsTest.ts | 2 +- test/Ported/Documents/LoadTest.ts | 2 +- test/Ported/ExistsTest.ts | 2 +- test/Ported/Faceted/AggregationTest.ts | 2 +- test/Ported/Faceted/FacetPagingTest.ts | 2 +- test/Ported/FirstClassPatchTest.ts | 2 +- test/Ported/HiLoTest.ts | 2 +- test/Ported/HttpsTest.ts | 2 +- test/Ported/Indexing/DetectIndexTypeTest.ts | 2 +- test/Ported/Indexing/IndexesFromClientTest.ts | 2 +- test/Ported/Indexing/JavaScriptIndexTest.ts | 2 +- test/Ported/Issues/RavenDB_11058.ts | 2 +- test/Ported/Issues/RavenDB_11166.ts | 2 +- test/Ported/Issues/RavenDB_11440.ts | 12 ++++++++---- test/Ported/Issues/RavenDB_12169.ts | 2 +- test/Ported/Issues/RavenDB_12790.ts | 2 +- test/Ported/Issues/RavenDB_14164.ts | 10 +++++----- test/Ported/Issues/RavenDB_14919.ts | 12 ++++++------ test/Ported/Issues/RavenDB_18364.ts | 2 +- test/Ported/Issues/RavenDB_19598.ts | 2 +- test/Ported/Issues/RavenDB_5669.ts | 2 +- test/Ported/Issues/RavenDB_6292.ts | 2 +- test/Ported/Issues/RavenDB_8328Test.ts | 2 +- test/Ported/Issues/RavenDB_903.ts | 2 +- test/Ported/Lazy/LazyTest.ts | 2 +- test/Ported/LoadIntoStreamTest.ts | 2 +- test/Ported/LoadTest.ts | 2 +- .../MailingList/LazyAggregationEmbedded.ts | 2 +- test/Ported/MailingList/LoadAllStartingWith.ts | 2 +- test/Ported/MailingList/NoTrackingTest.ts | 2 +- test/Ported/MoreLikeThis/MoreLikeThisTest.ts | 2 +- test/Ported/NextAndSeedIdentitiesTest.ts | 2 +- test/Ported/PatchTest.ts | 2 +- test/Ported/Queries/HighlightsTest.ts | 4 ++-- .../Queries/QueriesWithCustomFunctionsTests.ts | 2 +- test/Ported/Queries/RegexQueryTest.ts | 2 +- test/Ported/QueryTest.ts | 6 +++--- test/Ported/RequestExecutor.ts | 14 +++++++------- test/Ported/RevisionsTest.ts | 2 +- .../Server/Documents/Indexing/RavenDB_8761.ts | 2 +- .../Documents/Notifications/ChangesTest.ts | 2 +- .../Notifications/SecuredChangesTest.ts | 2 +- .../Server/Patching/AdvancedPatchingTest.ts | 2 +- ...RecordingTransactionOperationsMergerTest.ts | 4 ++-- .../Replication/DocumentReplicationTest.ts | 2 +- test/Ported/SmugglerTest.ts | 4 ++-- test/Ported/Spatial/BoundingBoxIndexTest.ts | 2 +- test/Ported/Spatial/RavenDB_9676.ts | 2 +- test/Ported/Spatial/SimonBartlettTest.ts | 2 +- test/Ported/Spatial/SpatialQueriesTest.ts | 2 +- test/Ported/Spatial/SpatialSearchTest.ts | 2 +- test/Ported/Spatial/SpatialSortingTest.ts | 2 +- test/Ported/Spatial/SpatialTest.ts | 2 +- test/Ported/StoreTest.ts | 2 +- .../RevisionsSubscriptionsTest.ts | 2 +- .../SecuredSubscriptionsBasicTest.ts | 2 +- .../Subscriptions/SubscriptionsBasicTest.ts | 2 +- test/Ported/Suggestions/SuggestionsLazyTest.ts | 2 +- test/Ported/Suggestions/SuggestionsTest.ts | 2 +- .../TimeSeries/TimeSeriesConfiguration.ts | 4 ++-- test/Ported/TrackEntityTest.ts | 2 +- test/Ported/UniqueValuesTest.ts | 2 +- test/Ported/WhatChangedTest.ts | 2 +- .../CaseInsensitivePrimitivesTests.ts | 2 +- test/Primitives/TypeUtilTests.ts | 2 +- .../GetClusterTopologyCommandTests.ts | 2 +- test/ServerWide/GetDatabaseRecordTest.ts | 2 +- test/ServerWide/GetTcpInfoCommandTests.ts | 2 +- test/ServerWide/GetTopologyCommandTests.ts | 2 +- test/TestDriver/RavenServerRunner.ts | 6 +++--- test/TestDriver/index.ts | 7 ++++--- test/Utilities/SemaphoreUtilTests.ts | 2 +- test/Utils/AssertExtensions.ts | 4 ++-- test/Utils/RavenTestHelper.ts | 2 +- test/Utils/ReplicationTestContext.ts | 10 +++------- test/Utils/TestUtil.ts | 18 +++++++++--------- 171 files changed, 247 insertions(+), 246 deletions(-) diff --git a/src/Auth/Certificate.ts b/src/Auth/Certificate.ts index 7b91f778..3a8dd2d9 100644 --- a/src/Auth/Certificate.ts +++ b/src/Auth/Certificate.ts @@ -1,7 +1,7 @@ import { IAuthOptions } from "./AuthOptions"; import { StringUtil } from "../Utility/StringUtil"; import { throwError } from "../Exceptions"; -import { AgentOptions } from "https"; +import { AgentOptions } from "node:https"; import WebSocket = require("ws"); export type CertificateType = "pem" | "pfx"; diff --git a/src/Documents/BulkInsertOperation.ts b/src/Documents/BulkInsertOperation.ts index 3feba027..53fdf69a 100644 --- a/src/Documents/BulkInsertOperation.ts +++ b/src/Documents/BulkInsertOperation.ts @@ -27,7 +27,7 @@ import { ClassConstructor, EntityConstructor } from "../Types"; import { TimeSeriesOperations } from "./TimeSeries/TimeSeriesOperations"; import { TimeSeriesValuesHelper } from "./Session/TimeSeries/TimeSeriesValuesHelper"; import { Timer } from "../Primitives/Timer"; -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; import { BulkInsertOnProgressEventArgs } from "./Session/SessionEvents"; export class BulkInsertOperation { diff --git a/src/Documents/Changes/DatabaseChanges.ts b/src/Documents/Changes/DatabaseChanges.ts index 0f745c5c..c3df0407 100644 --- a/src/Documents/Changes/DatabaseChanges.ts +++ b/src/Documents/Changes/DatabaseChanges.ts @@ -10,7 +10,7 @@ import { throwError } from "../../Exceptions"; import * as semaphore from "semaphore"; import * as WebSocket from "ws"; import { StringUtil } from "../../Utility/StringUtil"; -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; import * as PromiseUtil from "../../Utility/PromiseUtil"; import { IDefer } from "../../Utility/PromiseUtil"; import { acquireSemaphore } from "../../Utility/SemaphoreUtil"; diff --git a/src/Documents/Changes/DatabaseConnectionState.ts b/src/Documents/Changes/DatabaseConnectionState.ts index 85cf430c..a04b9a81 100644 --- a/src/Documents/Changes/DatabaseConnectionState.ts +++ b/src/Documents/Changes/DatabaseConnectionState.ts @@ -1,6 +1,6 @@ import { DatabaseChange } from "./DatabaseChange"; import { ChangesType, IChangesConnectionState } from "./IChangesConnectionState"; -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; import { getError } from "../../Exceptions"; import { IDefer } from "../../Utility/PromiseUtil"; import * as PromiseUtil from "../../Utility/PromiseUtil"; diff --git a/src/Documents/DocumentStoreBase.ts b/src/Documents/DocumentStoreBase.ts index c75603e2..d7c532c0 100644 --- a/src/Documents/DocumentStoreBase.ts +++ b/src/Documents/DocumentStoreBase.ts @@ -1,5 +1,5 @@ import { MaintenanceOperationExecutor } from "./Operations/MaintenanceOperationExecutor"; -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; import { IDocumentStore, SessionDisposingEventArgs } from "./IDocumentStore"; import { throwError } from "../Exceptions"; import { validateUri } from "../Utility/UriUtil"; diff --git a/src/Documents/Session/AbstractDocumentQuery.ts b/src/Documents/Session/AbstractDocumentQuery.ts index 20fe5e58..0b8fac37 100644 --- a/src/Documents/Session/AbstractDocumentQuery.ts +++ b/src/Documents/Session/AbstractDocumentQuery.ts @@ -38,7 +38,7 @@ import { CounterIncludesToken } from "./Tokens/CounterIncludesToken"; import { QueryResult } from "../Queries/QueryResult"; import { DocumentType } from "../DocumentAbstractions"; import { QueryEventsEmitter } from "./QueryEvents"; -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; import { StringUtil } from "../../Utility/StringUtil"; import { IntersectMarkerToken } from "./Tokens/IntersectMarkerToken"; import { DocumentConventions } from "../Conventions/DocumentConventions"; @@ -76,7 +76,7 @@ import { QueryHighlightings } from "../Queries/Highlighting/QueryHighlightings"; import { ExplanationOptions } from "../Queries/Explanation/ExplanationOptions"; import { CountersByDocId } from "./CounterInternalTypes"; import { IncludeBuilderBase } from "./Loaders/IncludeBuilderBase"; -import * as os from "os"; +import * as os from "node:os"; import { GraphQueryToken } from "./Tokens/GraphQueryToken"; import { IncludesUtil } from "./IncludesUtil"; import { TimeSeriesIncludesToken } from "./Tokens/TimeSeriesIncludesToken"; @@ -1383,7 +1383,7 @@ export abstract class AbstractDocumentQuery 0 - || DatesComparator.compare(rightDate(localRanges[localRanges.length - 1].to), leftDate(newRange.from)) < 0) { + || DatesComparator.compare(rightDate(localRanges.at(-1).to), leftDate(newRange.from)) < 0) { // the entire range [from, to] is out of cache bounds const index = DatesComparator.compare(leftDate(localRanges[0].from), rightDate(newRange.to)) > 0 ? 0 : localRanges.length; diff --git a/src/Documents/Session/JavaScriptMap.ts b/src/Documents/Session/JavaScriptMap.ts index 9734c1b9..98b45f35 100644 --- a/src/Documents/Session/JavaScriptMap.ts +++ b/src/Documents/Session/JavaScriptMap.ts @@ -1,4 +1,4 @@ -import * as os from "os"; +import * as os from "node:os"; export class JavaScriptMap { private readonly _suffix: number; diff --git a/src/Documents/Session/SessionTimeSeriesBase.ts b/src/Documents/Session/SessionTimeSeriesBase.ts index 69504b75..14fbae2f 100644 --- a/src/Documents/Session/SessionTimeSeriesBase.ts +++ b/src/Documents/Session/SessionTimeSeriesBase.ts @@ -315,7 +315,7 @@ export class SessionTimeSeriesBase { rangesToGetFromServer.push({ name: this.name, - from: ranges[ranges.length - 1].to, + from: ranges.at(-1).to, to }); } @@ -460,7 +460,7 @@ export class SessionTimeSeriesBase { let shouldSkip = false; if (mergedValues.length > 0) { - shouldSkip = ranges[i].entries[0].timestamp.getTime() === mergedValues[mergedValues.length - 1].timestamp.getTime(); + shouldSkip = ranges[i].entries[0].timestamp.getTime() === mergedValues.at(-1).timestamp.getTime(); } const toAdd = ranges[i].entries.slice(!shouldSkip ? 0 : 1); @@ -543,7 +543,7 @@ export class SessionTimeSeriesBase { return ranges.length === 0 || DatesComparator.compare(leftDate(ranges[0].from), rightDate(to)) > 0 - || DatesComparator.compare(rightDate(ranges[ranges.length - 1].to), leftDate(from)) < 0; + || DatesComparator.compare(rightDate(ranges.at(-1).to), leftDate(from)) < 0; } } diff --git a/src/Documents/Session/Tokens/DeclareToken.ts b/src/Documents/Session/Tokens/DeclareToken.ts index 299b80e0..545f3fc7 100644 --- a/src/Documents/Session/Tokens/DeclareToken.ts +++ b/src/Documents/Session/Tokens/DeclareToken.ts @@ -1,5 +1,5 @@ import { QueryToken } from "./QueryToken"; -import * as os from "os"; +import * as os from "node:os"; export class DeclareToken extends QueryToken { diff --git a/src/Documents/Smuggler/BackupUtils.ts b/src/Documents/Smuggler/BackupUtils.ts index fdebb29c..199ea5f1 100644 --- a/src/Documents/Smuggler/BackupUtils.ts +++ b/src/Documents/Smuggler/BackupUtils.ts @@ -1,7 +1,7 @@ import { CONSTANTS } from "../../Constants"; import { StringUtil } from "../../Utility/StringUtil"; -import * as path from "path"; -import * as fs from "fs"; +import * as path from "node:path"; +import * as fs from "node:fs"; export class BackupUtils { // eslint-disable-next-line @typescript-eslint/no-empty-function diff --git a/src/Documents/Smuggler/DatabaseSmuggler.ts b/src/Documents/Smuggler/DatabaseSmuggler.ts index e8690562..8cc3e99a 100644 --- a/src/Documents/Smuggler/DatabaseSmuggler.ts +++ b/src/Documents/Smuggler/DatabaseSmuggler.ts @@ -7,10 +7,10 @@ import { DatabaseSmugglerExportOptions } from "./DatabaseSmugglerExportOptions"; import { HttpCache } from "../../Http/HttpCache"; import { HeadersBuilder } from "../../Utility/HttpUtil"; import { DatabaseSmugglerOptions } from "./DatabaseSmugglerOptions"; -import * as fs from "fs"; +import * as fs from "node:fs"; import * as StreamUtil from "../../Utility/StreamUtil"; import { LengthUnawareFormData } from "../../Utility/LengthUnawareFormData"; -import * as path from "path"; +import * as path from "node:path"; import { BackupUtils } from "./BackupUtils"; import { RequestExecutor } from "../../Http/RequestExecutor"; import { OperationCompletionAwaiter } from "../Operations/OperationCompletionAwaiter"; diff --git a/src/Documents/Subscriptions/DocumentSubscriptions.ts b/src/Documents/Subscriptions/DocumentSubscriptions.ts index 5844346a..d0ddcdcd 100644 --- a/src/Documents/Subscriptions/DocumentSubscriptions.ts +++ b/src/Documents/Subscriptions/DocumentSubscriptions.ts @@ -16,7 +16,7 @@ import { DropSubscriptionConnectionCommand } from "../Commands/DropSubscriptionC import { GetSubscriptionsCommand } from "../Commands/GetSubscriptionsCommand"; import { ToggleOngoingTaskStateOperation } from "../Operations/OngoingTasks/ToggleOngoingTaskStateOperation"; import { SubscriptionIncludeBuilder } from "../Session/Loaders/SubscriptionIncludeBuilder"; -import * as os from "os"; +import * as os from "node:os"; import { IncludesUtil } from "../Session/IncludesUtil"; import { StringBuilder } from "../../Utility/StringBuilder"; import { SubscriptionUpdateOptions } from "./SubscriptionUpdateOptions"; diff --git a/src/Documents/Subscriptions/SubscriptionBatch.ts b/src/Documents/Subscriptions/SubscriptionBatch.ts index 78d34177..1e7f91c3 100644 --- a/src/Documents/Subscriptions/SubscriptionBatch.ts +++ b/src/Documents/Subscriptions/SubscriptionBatch.ts @@ -2,7 +2,7 @@ import { DocumentType } from "../DocumentAbstractions"; import { getLogger } from "../../Utility/LogUtil"; import { GenerateEntityIdOnTheClient } from "../Identity/GenerateEntityIdOnTheClient"; import { throwError } from "../../Exceptions"; -import * as os from "os"; +import * as os from "node:os"; import { CONSTANTS } from "../../Constants"; import { StringUtil } from "../../Utility/StringUtil"; import { createMetadataDictionary } from "../../Mapping/MetadataAsDictionary"; diff --git a/src/Documents/Subscriptions/SubscriptionWorker.ts b/src/Documents/Subscriptions/SubscriptionWorker.ts index 22ba17bd..c8f8d04c 100644 --- a/src/Documents/Subscriptions/SubscriptionWorker.ts +++ b/src/Documents/Subscriptions/SubscriptionWorker.ts @@ -4,7 +4,7 @@ import { getLogger } from "../../Utility/LogUtil"; import { DocumentStore } from "../DocumentStore"; import { SubscriptionWorkerOptions } from "./SubscriptionWorkerOptions"; import { SubscriptionBatch } from "./SubscriptionBatch"; -import { Socket } from "net"; +import { Socket } from "node:net"; import { StringUtil } from "../../Utility/StringUtil"; import { getError, throwError, RavenErrorType } from "../../Exceptions"; import { TcpUtils } from "../../Utility/TcpUtils"; @@ -17,7 +17,7 @@ import { } from "../../ServerWide/Tcp/TcpConnectionHeaderMessage"; import { OUT_OF_RANGE_STATUS, TcpNegotiation } from "../../ServerWide/Tcp/TcpNegotiation"; import { TcpConnectionHeaderResponse } from "../../ServerWide/Tcp/TcpConnectionHeaderResponse"; -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; import { TimeUtil } from "../../Utility/TimeUtil"; import { ObjectUtil } from "../../Utility/ObjectUtil"; import { SubscriptionConnectionServerMessage } from "./SubscriptionConnectionServerMessage"; @@ -30,7 +30,7 @@ import { ServerNode } from "../../Http/ServerNode"; import { RequestExecutor } from "../../Http/RequestExecutor"; import { GetTcpInfoCommand, TcpConnectionInfo } from "../../ServerWide/Commands/GetTcpInfoCommand"; import { GetTcpInfoForRemoteTaskCommand } from "../Commands/GetTcpInfoForRemoteTaskCommand"; -import * as os from "os"; +import * as os from "node:os"; import { DocumentConventions } from "../Conventions/DocumentConventions"; import { ServerCasing, ServerResponse } from "../../Types"; import { CONSTANTS } from "../../Constants"; diff --git a/src/Exceptions/index.ts b/src/Exceptions/index.ts index 1a196594..253e1a5f 100644 --- a/src/Exceptions/index.ts +++ b/src/Exceptions/index.ts @@ -3,7 +3,7 @@ import { closeHttpResponse } from "../Utility/HttpUtil"; import { StatusCodes } from "../Http/StatusCode"; import { HttpResponse } from "../Primitives/Http"; import { JsonSerializer } from "../Mapping/Json/Serializer"; -import * as os from "os"; +import * as os from "node:os"; export function printError(err: Error): string { return VError.fullStack(err); @@ -244,9 +244,9 @@ export class ExceptionDispatcher { const prefix = "Raven.Client.Exceptions."; if (typeAsString && typeAsString.startsWith(prefix)) { const exceptionName = typeAsString.substring(prefix.length); - if (exceptionName.indexOf(".") !== -1) { + if (exceptionName.includes(".")) { const tokens = exceptionName.split("."); - return tokens[tokens.length - 1] as RavenErrorType; + return tokens.at(-1) as RavenErrorType; } return exceptionName; diff --git a/src/Http/ClusterRequestExecutor.ts b/src/Http/ClusterRequestExecutor.ts index 22ca894d..6ea693c7 100644 --- a/src/Http/ClusterRequestExecutor.ts +++ b/src/Http/ClusterRequestExecutor.ts @@ -1,6 +1,6 @@ import { GetClusterTopologyCommand } from "../ServerWide/Commands/GetClusterTopologyCommand"; import { NodeSelector } from "./NodeSelector"; -import * as os from "os"; +import * as os from "node:os"; import * as semaphore from "semaphore"; import { getLogger } from "../Utility/LogUtil"; import { RequestExecutor, IRequestExecutorOptions } from "./RequestExecutor"; diff --git a/src/Http/RavenCommand.ts b/src/Http/RavenCommand.ts index aa9d28bb..9b3c7675 100644 --- a/src/Http/RavenCommand.ts +++ b/src/Http/RavenCommand.ts @@ -12,7 +12,7 @@ import { TypeInfo } from "../Mapping/ObjectMapper"; import { JsonSerializer } from "../Mapping/Json/Serializer"; import { RavenCommandResponsePipeline } from "./RavenCommandResponsePipeline"; import { DocumentConventions } from "../Documents/Conventions/DocumentConventions"; -import * as http from "http"; +import * as http from "node:http"; import { ObjectTypeDescriptor } from "../Types"; import { ReadableWebToNodeStream } from "../Utility/ReadableWebToNodeStream"; import { LengthUnawareFormData } from "../Utility/LengthUnawareFormData"; diff --git a/src/Http/RavenCommandResponsePipeline.ts b/src/Http/RavenCommandResponsePipeline.ts index 7183840a..c5f5f7e6 100644 --- a/src/Http/RavenCommandResponsePipeline.ts +++ b/src/Http/RavenCommandResponsePipeline.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; import * as Parser from "stream-json/Parser"; import { ObjectKeyCaseTransformStreamOptions, @@ -216,7 +216,7 @@ export class RavenCommandResponsePipeline extends EventEmitter { const opts = this._opts; let resultPromise: Promise; if (opts.jsonAsync) { - const asm = Asm.connectTo(streams[streams.length - 1] as any); + const asm = Asm.connectTo(streams.at(-1) as any); resultPromise = new Promise(resolve => { asm.on("done", asm => resolve(asm.current)); }); diff --git a/src/Http/RequestExecutor.ts b/src/Http/RequestExecutor.ts index d5c8d628..130e83a7 100644 --- a/src/Http/RequestExecutor.ts +++ b/src/Http/RequestExecutor.ts @@ -1,4 +1,4 @@ -import * as os from "os"; +import * as os from "node:os"; import * as semaphore from "semaphore"; import * as stream from "readable-stream"; import { acquireSemaphore, SemaphoreAcquisitionContext } from "../Utility/SemaphoreUtil"; @@ -32,12 +32,12 @@ import { validateUri } from "../Utility/UriUtil"; import * as StreamUtil from "../Utility/StreamUtil"; import { closeHttpResponse } from "../Utility/HttpUtil"; import { PromiseStatusTracker } from "../Utility/PromiseUtil"; -import type * as http from "http"; -import type * as https from "https"; +import type * as http from "node:http"; +import type * as https from "node:https"; import { IBroadcast } from "./IBroadcast"; import { StringUtil } from "../Utility/StringUtil"; import { IRaftCommand } from "./IRaftCommand"; -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; import { BeforeRequestEventArgs, FailedRequestEventArgs, @@ -357,7 +357,7 @@ export class RequestExecutor implements IDisposable { return RequestExecutor.HTTPS_AGENT_CACHE.get(cacheKey); } else { // eslint-disable-next-line @typescript-eslint/no-var-requires - const https = require("https"); + const https = require("node:https"); const agent = new https.Agent({ keepAlive: true, @@ -376,7 +376,7 @@ export class RequestExecutor implements IDisposable { private static assertKeepAliveAgent() { if (!RequestExecutor.KEEP_ALIVE_HTTP_AGENT) { // eslint-disable-next-line @typescript-eslint/no-var-requires - const http = require("http"); + const http = require("node:http"); RequestExecutor.KEEP_ALIVE_HTTP_AGENT = new http.Agent({ keepAlive: true diff --git a/src/Primitives/Events.ts b/src/Primitives/Events.ts index 90377cdb..cdf0aa67 100644 --- a/src/Primitives/Events.ts +++ b/src/Primitives/Events.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from "events"; +import { EventEmitter } from "node:events"; export interface TypedEventEmitter extends EventEmitter { addListener(event: string | keyof TEvents | symbol, listener: (...args: any[]) => void): this; diff --git a/src/ServerWide/Commands/GetDatabaseTopologyCommand.ts b/src/ServerWide/Commands/GetDatabaseTopologyCommand.ts index f8e5f6e4..ad101fef 100644 --- a/src/ServerWide/Commands/GetDatabaseTopologyCommand.ts +++ b/src/ServerWide/Commands/GetDatabaseTopologyCommand.ts @@ -32,7 +32,7 @@ export class GetDatabaseTopologyCommand extends RavenCommand { public createRequest(node: ServerNode): HttpRequestParameters { let uri = `${node.url}/topology?name=${node.database}`; - if (node.url.toLowerCase().indexOf(".fiddler") !== -1) { + if (node.url.toLowerCase().includes(".fiddler")) { // we want to keep the '.fiddler' stuff there so we'll keep tracking request // so we are going to ask the server to respect it uri += "&localUrl=" + encodeURIComponent(node.url); diff --git a/src/ServerWide/Tcp/TcpNegotiateParameters.ts b/src/ServerWide/Tcp/TcpNegotiateParameters.ts index 3ed28210..0c2ebd6f 100644 --- a/src/ServerWide/Tcp/TcpNegotiateParameters.ts +++ b/src/ServerWide/Tcp/TcpNegotiateParameters.ts @@ -1,5 +1,5 @@ import { AuthorizationInfo, OperationTypes } from "./TcpConnectionHeaderMessage"; -import { Socket } from "net"; +import { Socket } from "node:net"; import { TcpNegotiationResponse } from "./TcpNegotiationResponse"; import { LicensedFeatures } from "./LicensedFeatures"; diff --git a/src/ServerWide/Tcp/TcpNegotiation.ts b/src/ServerWide/Tcp/TcpNegotiation.ts index cf571bec..f6291a5a 100644 --- a/src/ServerWide/Tcp/TcpNegotiation.ts +++ b/src/ServerWide/Tcp/TcpNegotiation.ts @@ -1,5 +1,5 @@ import { getLogger } from "../../Utility/LogUtil"; -import { Socket } from "net"; +import { Socket } from "node:net"; import { TcpNegotiateParameters } from "./TcpNegotiateParameters"; import { DROP_BASE_LINE, diff --git a/src/Types/readable-stream.ts b/src/Types/readable-stream.ts index 68760a78..8c8f1c71 100644 --- a/src/Types/readable-stream.ts +++ b/src/Types/readable-stream.ts @@ -2,7 +2,7 @@ declare module "readable-stream"; declare module "readable-stream" { - import * as events from "events"; + import * as events from "node:events"; class pipeable extends events.EventEmitter { public pipe(destination: T, options?: { end?: boolean; }): T; diff --git a/src/Utility/HttpUtil.ts b/src/Utility/HttpUtil.ts index 4708b7f5..f155624e 100644 --- a/src/Utility/HttpUtil.ts +++ b/src/Utility/HttpUtil.ts @@ -1,6 +1,6 @@ import { Response as HttpResponse } from "node-fetch" import { HEADERS } from "../Constants"; -import { IncomingHttpHeaders } from "http"; +import { IncomingHttpHeaders } from "node:http"; import { throwError } from "../Exceptions"; export function getRequiredEtagHeader(response: HttpResponse) { diff --git a/src/Utility/LogUtil.ts b/src/Utility/LogUtil.ts index e572606d..5e0ec026 100644 --- a/src/Utility/LogUtil.ts +++ b/src/Utility/LogUtil.ts @@ -1,4 +1,4 @@ -import { debuglog } from "util"; +import { debuglog } from "node:util"; import { printError } from "../Exceptions"; const isDebug = !!process.env.NODE_DEBUG; diff --git a/src/Utility/PromiseUtil.ts b/src/Utility/PromiseUtil.ts index 0829e38f..b1cd7772 100644 --- a/src/Utility/PromiseUtil.ts +++ b/src/Utility/PromiseUtil.ts @@ -1,5 +1,5 @@ import { getError } from "../Exceptions"; -import { clearTimeout } from "timers"; +import { clearTimeout } from "node:timers"; export interface IDefer { resolve: (value: TResult) => void; diff --git a/src/Utility/StringBuilder.ts b/src/Utility/StringBuilder.ts index 4a7c6f91..65215af8 100644 --- a/src/Utility/StringBuilder.ts +++ b/src/Utility/StringBuilder.ts @@ -1,4 +1,4 @@ -import { Stream } from "stream"; +import { Stream } from "node:stream"; export class StringBuilder { private s: any[] = []; diff --git a/src/Utility/TcpUtils.ts b/src/Utility/TcpUtils.ts index a8528110..83c59680 100644 --- a/src/Utility/TcpUtils.ts +++ b/src/Utility/TcpUtils.ts @@ -1,10 +1,10 @@ -import * as net from "net"; -import { Socket } from "net"; -import { URL } from "url"; +import * as net from "node:net"; +import { Socket } from "node:net"; +import { URL } from "node:url"; import { IAuthOptions } from "../Auth/AuthOptions"; -import * as tls from "tls"; +import * as tls from "node:tls"; import { Certificate } from "../Auth/Certificate"; -import { PeerCertificate } from "tls"; +import { PeerCertificate } from "node:tls"; import { getError, throwError } from "../Exceptions"; import { TcpConnectionInfo } from "../ServerWide/Commands/GetTcpInfoCommand"; import { OperationTypes, SupportedFeatures } from "../ServerWide/Tcp/TcpConnectionHeaderMessage"; diff --git a/src/Utility/TimeUtil.ts b/src/Utility/TimeUtil.ts index 5590b327..c6caaa46 100644 --- a/src/Utility/TimeUtil.ts +++ b/src/Utility/TimeUtil.ts @@ -54,8 +54,8 @@ export class TimeUtil { } public static timeSpanToDuration(text: string) { - const hasDays = !!text.match(/^\d+\./); - const hasMillis = !!text.match(/.*\.\d+/); + const hasDays = !!/^\d+\./.test(text); + const hasMillis = !!/.*\.\d+/.test(text); if (hasDays && hasMillis) { const tokens = text.split("."); diff --git a/src/Utility/UriUtil.ts b/src/Utility/UriUtil.ts index 3a30661a..2f2a59dc 100644 --- a/src/Utility/UriUtil.ts +++ b/src/Utility/UriUtil.ts @@ -1,5 +1,5 @@ import { throwError } from "../Exceptions"; -import * as url from "url"; +import * as url from "node:url"; export function isValidUri(uriString: string): boolean { const parsed = url.parse(uriString); diff --git a/test/Documents/Commands/DeleteDocumentCommandTest.ts b/test/Documents/Commands/DeleteDocumentCommandTest.ts index c55bba2a..e262edf7 100644 --- a/test/Documents/Commands/DeleteDocumentCommandTest.ts +++ b/test/Documents/Commands/DeleteDocumentCommandTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Documents/Commands/GetDocumentCommandTests.ts b/test/Documents/Commands/GetDocumentCommandTests.ts index 0c2ba9b1..ef6f12b0 100644 --- a/test/Documents/Commands/GetDocumentCommandTests.ts +++ b/test/Documents/Commands/GetDocumentCommandTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { IDocumentStore, diff --git a/test/Documents/Commands/GetNextOperationIdCommandTests.ts b/test/Documents/Commands/GetNextOperationIdCommandTests.ts index fb019593..5d98183f 100644 --- a/test/Documents/Commands/GetNextOperationIdCommandTests.ts +++ b/test/Documents/Commands/GetNextOperationIdCommandTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Documents/Commands/GetStatisticsCommandTests.ts b/test/Documents/Commands/GetStatisticsCommandTests.ts index e7adb663..3ceceddc 100644 --- a/test/Documents/Commands/GetStatisticsCommandTests.ts +++ b/test/Documents/Commands/GetStatisticsCommandTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { CreateSampleDataOperation } from "../../Utils/CreateSampleDataOperation"; diff --git a/test/Documents/Commands/PutDocumentCommandTests.ts b/test/Documents/Commands/PutDocumentCommandTests.ts index 8810b7fa..c1e48280 100644 --- a/test/Documents/Commands/PutDocumentCommandTests.ts +++ b/test/Documents/Commands/PutDocumentCommandTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Documents/CustomKeyCaseConventionsTests.ts b/test/Documents/CustomKeyCaseConventionsTests.ts index 74e54d2a..0b790d49 100644 --- a/test/Documents/CustomKeyCaseConventionsTests.ts +++ b/test/Documents/CustomKeyCaseConventionsTests.ts @@ -1,5 +1,5 @@ import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; -import * as assert from "assert"; +import * as assert from "node:assert"; import DocumentStore, { IDocumentStore, PatchCommandData, PatchRequest, } from "../../src"; diff --git a/test/Documents/DisableTrackingTests.ts b/test/Documents/DisableTrackingTests.ts index a1749c4a..cc65c211 100644 --- a/test/Documents/DisableTrackingTests.ts +++ b/test/Documents/DisableTrackingTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Documents/IdGeneration.ts b/test/Documents/IdGeneration.ts index 41063cb7..92aa3092 100644 --- a/test/Documents/IdGeneration.ts +++ b/test/Documents/IdGeneration.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Documents/MetadataAsDictTests.ts b/test/Documents/MetadataAsDictTests.ts index fdfd5b2a..cabe4cc2 100644 --- a/test/Documents/MetadataAsDictTests.ts +++ b/test/Documents/MetadataAsDictTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { createMetadataDictionary } from "../../src/Mapping/MetadataAsDictionary"; describe("MetadataAsDictionary", function () { diff --git a/test/Documents/Operations/ClientConfigurationTest.ts b/test/Documents/Operations/ClientConfigurationTest.ts index bead91fa..455e3610 100644 --- a/test/Documents/Operations/ClientConfigurationTest.ts +++ b/test/Documents/Operations/ClientConfigurationTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore, RavenTestContext diff --git a/test/Documents/Operations/DeleteByQueryTest.ts b/test/Documents/Operations/DeleteByQueryTest.ts index 39fd70ce..31c75159 100644 --- a/test/Documents/Operations/DeleteByQueryTest.ts +++ b/test/Documents/Operations/DeleteByQueryTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Documents/Operations/IndexesOperationsTests.ts b/test/Documents/Operations/IndexesOperationsTests.ts index 68ba84c4..2c5181dd 100644 --- a/test/Documents/Operations/IndexesOperationsTests.ts +++ b/test/Documents/Operations/IndexesOperationsTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Documents/Queries/HashCalculatorTest.ts b/test/Documents/Queries/HashCalculatorTest.ts index 453d4ffb..bf5df7f6 100644 --- a/test/Documents/Queries/HashCalculatorTest.ts +++ b/test/Documents/Queries/HashCalculatorTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { HashCalculator } from "../../../src/Documents/Queries/HashCalculator"; import { TypesAwareObjectMapper } from "../../../src"; diff --git a/test/Documents/Queries/IDocumentQueryCustomizationMethodsTest.ts b/test/Documents/Queries/IDocumentQueryCustomizationMethodsTest.ts index 226fffb6..b1c7d884 100644 --- a/test/Documents/Queries/IDocumentQueryCustomizationMethodsTest.ts +++ b/test/Documents/Queries/IDocumentQueryCustomizationMethodsTest.ts @@ -1,6 +1,6 @@ import {AbstractJavaScriptIndexCreationTask, IDocumentStore, IndexQuery } from "../../../src"; import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil"; -import * as assert from "assert"; +import * as assert from "node:assert"; describe("IDocumentQueryCustomizationMethodsTest", function () { diff --git a/test/Documents/ReadmeSamples.ts b/test/Documents/ReadmeSamples.ts index 49f6242f..dd0887a1 100644 --- a/test/Documents/ReadmeSamples.ts +++ b/test/Documents/ReadmeSamples.ts @@ -1,9 +1,9 @@ import * as stream from "readable-stream"; -import * as path from "path"; -import * as fs from "fs"; -import * as assert from "assert"; +import * as path from "node:path"; +import * as fs from "node:fs"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; -import * as util from "util"; +import * as util from "node:util"; import DocumentStore, { IDocumentStore, diff --git a/test/Documents/SessionApiTests.ts b/test/Documents/SessionApiTests.ts index 5f6d0f16..2c7a0823 100644 --- a/test/Documents/SessionApiTests.ts +++ b/test/Documents/SessionApiTests.ts @@ -1,5 +1,5 @@ import { User } from "../Assets/Entities"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Executor/CompressionTests.ts b/test/Executor/CompressionTests.ts index 380ce1d9..bdbce0fd 100644 --- a/test/Executor/CompressionTests.ts +++ b/test/Executor/CompressionTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import * as sinon from "sinon"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; diff --git a/test/Executor/RequestExecutorTests.ts b/test/Executor/RequestExecutorTests.ts index 3bef049e..8e4ca14c 100644 --- a/test/Executor/RequestExecutorTests.ts +++ b/test/Executor/RequestExecutorTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { @@ -85,7 +85,7 @@ describe("Request executor", function () { const command = databaseNamesOperation.getCommand(documentConventions); await executor.execute(command); - assert.ok(command.result.indexOf(store.database) !== -1); + assert.ok(command.result.includes(store.database)); } finally { executor.dispose(); } diff --git a/test/Issues/Github_204.ts b/test/Issues/Github_204.ts index 017cf714..d8a8c76a 100644 --- a/test/Issues/Github_204.ts +++ b/test/Issues/Github_204.ts @@ -3,7 +3,7 @@ import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { IDocumentStore, } from "../../src"; -import * as assert from "assert"; +import * as assert from "node:assert"; describe("GitHub-204", function () { diff --git a/test/Issues/Github_315.ts b/test/Issues/Github_315.ts index 66636297..0f816e53 100644 --- a/test/Issues/Github_315.ts +++ b/test/Issues/Github_315.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Issues/Github_67.ts b/test/Issues/Github_67.ts index c57f4d13..46811986 100644 --- a/test/Issues/Github_67.ts +++ b/test/Issues/Github_67.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { @@ -19,7 +19,7 @@ describe("Issue #67", function () { it("can pass a url with a trailing slash", async () => { const url = store.urls[0] + "/"; - assert.strictEqual(url[url.length - 1], "/"); + assert.strictEqual(url.at(-1), "/"); // add a trailing slash to our store's URL let testStore: DocumentStore; diff --git a/test/Issues/RDBC-244.ts b/test/Issues/RDBC-244.ts index fd360a45..0535ec51 100644 --- a/test/Issues/RDBC-244.ts +++ b/test/Issues/RDBC-244.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Issues/RDBC_202.ts b/test/Issues/RDBC_202.ts index 7ed1173d..6a8476f2 100644 --- a/test/Issues/RDBC_202.ts +++ b/test/Issues/RDBC_202.ts @@ -2,7 +2,7 @@ import { DocumentStore, } from "../../src"; import { IAuthOptions } from "../../src/Auth/AuthOptions"; -import * as assert from "assert"; +import * as assert from "node:assert"; describe("[RDBC-202] DocumentStore", function () { diff --git a/test/Issues/RDBC_203.ts b/test/Issues/RDBC_203.ts index afeebc6e..4f2ea486 100644 --- a/test/Issues/RDBC_203.ts +++ b/test/Issues/RDBC_203.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { DocumentStore, IDocumentStore, GetDatabaseNamesOperation } from "../../src"; diff --git a/test/Issues/RDBC_213.ts b/test/Issues/RDBC_213.ts index 30e56f46..8418d7d5 100644 --- a/test/Issues/RDBC_213.ts +++ b/test/Issues/RDBC_213.ts @@ -2,7 +2,7 @@ import { IDocumentStore, } from "../../src"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; -import * as assert from "assert"; +import * as assert from "node:assert"; describe("[RDBC-213] Metadata is not saved", function () { diff --git a/test/Issues/RDBC_230.ts b/test/Issues/RDBC_230.ts index 28e1751f..fca3b3ef 100644 --- a/test/Issues/RDBC_230.ts +++ b/test/Issues/RDBC_230.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { User } from "../Assets/Entities"; diff --git a/test/Issues/RDBC_233.ts b/test/Issues/RDBC_233.ts index fe79b970..3f377067 100644 --- a/test/Issues/RDBC_233.ts +++ b/test/Issues/RDBC_233.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import DocumentStore, { diff --git a/test/Issues/RDBC_236.ts b/test/Issues/RDBC_236.ts index 587000ac..4ae7ffcb 100644 --- a/test/Issues/RDBC_236.ts +++ b/test/Issues/RDBC_236.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import * as moment from "moment"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; diff --git a/test/Issues/RDBC_247.ts b/test/Issues/RDBC_247.ts index 9eee592f..8f25bdb7 100644 --- a/test/Issues/RDBC_247.ts +++ b/test/Issues/RDBC_247.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { User } from "../Assets/Entities"; import { assertThrows } from "../Utils/AssertExtensions"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; diff --git a/test/Issues/RDBC_259.ts b/test/Issues/RDBC_259.ts index b4f412a4..d05d9990 100644 --- a/test/Issues/RDBC_259.ts +++ b/test/Issues/RDBC_259.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Issues/RDBC_265.ts b/test/Issues/RDBC_265.ts index 375c8077..a17b150d 100644 --- a/test/Issues/RDBC_265.ts +++ b/test/Issues/RDBC_265.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { User } from "../Assets/Entities"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; diff --git a/test/Issues/RDBC_649.ts b/test/Issues/RDBC_649.ts index 7a73bc15..c27ba0eb 100644 --- a/test/Issues/RDBC_649.ts +++ b/test/Issues/RDBC_649.ts @@ -1,5 +1,5 @@ import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { IDocumentSession, IDocumentStore diff --git a/test/Issues/RDBC_658.ts b/test/Issues/RDBC_658.ts index 96a9e449..20ec4e9a 100644 --- a/test/Issues/RDBC_658.ts +++ b/test/Issues/RDBC_658.ts @@ -1,5 +1,5 @@ import {ClusterTestContext, disposeTestDocumentStore, RavenTestContext} from "../Utils/TestUtil"; -import * as assert from "assert"; +import * as assert from "node:assert"; import {assertThat} from "../Utils/AssertExtensions"; import { AddDatabaseNodeOperation, diff --git a/test/Issues/RDBC_681.ts b/test/Issues/RDBC_681.ts index 00758c31..27949f5b 100644 --- a/test/Issues/RDBC_681.ts +++ b/test/Issues/RDBC_681.ts @@ -1,6 +1,6 @@ import { IDocumentStore } from "../../src"; import { disposeTestDocumentStore, testContext } from "../Utils/TestUtil"; -import * as assert from "assert"; +import * as assert from "node:assert"; describe("[RDBC-681] @nested-object-types doesn’t store type information for newly added fields on update", function () { diff --git a/test/Issues/RavenDB_10566.ts b/test/Issues/RavenDB_10566.ts index 22053353..7a08a87b 100644 --- a/test/Issues/RavenDB_10566.ts +++ b/test/Issues/RavenDB_10566.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { User } from "../Assets/Entities"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; diff --git a/test/Issues/RavenDB_10641.ts b/test/Issues/RavenDB_10641.ts index d4a73c64..dca63f38 100644 --- a/test/Issues/RavenDB_10641.ts +++ b/test/Issues/RavenDB_10641.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Issues/RavenDB_11649.ts b/test/Issues/RavenDB_11649.ts index bdbef077..311d397e 100644 --- a/test/Issues/RavenDB_11649.ts +++ b/test/Issues/RavenDB_11649.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Issues/RavenDB_11703.ts b/test/Issues/RavenDB_11703.ts index a1e039c3..a34f96e0 100644 --- a/test/Issues/RavenDB_11703.ts +++ b/test/Issues/RavenDB_11703.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Issues/RavenDB_11770.ts b/test/Issues/RavenDB_11770.ts index 2b3a852c..2b624394 100644 --- a/test/Issues/RavenDB_11770.ts +++ b/test/Issues/RavenDB_11770.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore, RavenTestContext } from "../Utils/TestUtil"; import { diff --git a/test/Mapping/JsonTests.ts b/test/Mapping/JsonTests.ts index 3621473c..0b2836ce 100644 --- a/test/Mapping/JsonTests.ts +++ b/test/Mapping/JsonTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { pascalCaseReplacer, camelCaseReplacer, diff --git a/test/Mapping/ObjectMapperTests.ts b/test/Mapping/ObjectMapperTests.ts index c46662d5..a1e50b13 100644 --- a/test/Mapping/ObjectMapperTests.ts +++ b/test/Mapping/ObjectMapperTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { TypesAwareObjectMapper, diff --git a/test/Mapping/ObjectUtilTests.ts b/test/Mapping/ObjectUtilTests.ts index 8ca50bb3..148e2796 100644 --- a/test/Mapping/ObjectUtilTests.ts +++ b/test/Mapping/ObjectUtilTests.ts @@ -1,6 +1,6 @@ import { CasingConvention } from "./../../src/Utility/ObjectUtil"; import { ObjectChangeCaseOptions } from "./../../src/Utility/ObjectUtil"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { ObjectUtil } from "../../src/Utility/ObjectUtil"; describe("ObjectUtil", function () { diff --git a/test/Mapping/StreamJsonTests.ts b/test/Mapping/StreamJsonTests.ts index 503f9747..71d1910b 100644 --- a/test/Mapping/StreamJsonTests.ts +++ b/test/Mapping/StreamJsonTests.ts @@ -1,7 +1,7 @@ -import * as fs from "fs"; -import * as path from "path"; +import * as fs from "node:fs"; +import * as path from "node:path"; import * as stream from "readable-stream"; -import * as assert from "assert"; +import * as assert from "node:assert"; import * as Parser from "stream-json/Parser"; import * as StreamValues from "stream-json/streamers/StreamValues"; import { stringer } from "stream-json/Stringer"; diff --git a/test/Mapping/StreamTests.ts b/test/Mapping/StreamTests.ts index a6584edc..8ef8dbe4 100644 --- a/test/Mapping/StreamTests.ts +++ b/test/Mapping/StreamTests.ts @@ -1,5 +1,5 @@ import * as stream from "readable-stream"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { parser } from "stream-json/Parser"; import { pick } from "stream-json/filters/Pick"; import { streamArray } from "stream-json/streamers/StreamArray"; diff --git a/test/Ported/Attachments/AttachmentsRevisionsTest.ts b/test/Ported/Attachments/AttachmentsRevisionsTest.ts index 608a5fbe..235603ad 100644 --- a/test/Ported/Attachments/AttachmentsRevisionsTest.ts +++ b/test/Ported/Attachments/AttachmentsRevisionsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore, RavenTestContext } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Attachments/AttachmentsSessionTest.ts b/test/Ported/Attachments/AttachmentsSessionTest.ts index 841fdd1c..aa0b636a 100644 --- a/test/Ported/Attachments/AttachmentsSessionTest.ts +++ b/test/Ported/Attachments/AttachmentsSessionTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/BackupsTest.ts b/test/Ported/BackupsTest.ts index 0c20f4d4..b8cf6dbe 100644 --- a/test/Ported/BackupsTest.ts +++ b/test/Ported/BackupsTest.ts @@ -1,7 +1,7 @@ import { GetOngoingTaskInfoOperation, IDocumentStore, PeriodicBackupConfiguration } from "../../src"; import { disposeTestDocumentStore, RavenTestContext, TemporaryDirContext, testContext } from "../Utils/TestUtil"; -import * as path from "path"; -import * as fs from "fs"; +import * as path from "node:path"; +import * as fs from "node:fs"; import { UpdatePeriodicBackupOperation } from "../../src/Documents/Operations/Backups/UpdatePeriodicBackupOperation"; import { StartBackupOperation } from "../../src/Documents/Operations/Backups/StartBackupOperation"; import { GetPeriodicBackupStatusOperation } from "../../src/Documents/Operations/Backups/GetPeriodicBackupStatusOperation"; diff --git a/test/Ported/Bugs/Caching/CachingOfDocumentInclude.ts b/test/Ported/Bugs/Caching/CachingOfDocumentInclude.ts index 7797b746..cef49ab3 100644 --- a/test/Ported/Bugs/Caching/CachingOfDocumentInclude.ts +++ b/test/Ported/Bugs/Caching/CachingOfDocumentInclude.ts @@ -1,6 +1,6 @@ import { IDocumentStore, Lazy } from "../../../../src"; import { disposeTestDocumentStore, testContext } from "../../../Utils/TestUtil"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { Order, OrderLine } from "../../../Assets/Entities"; import { assertThat } from "../../../Utils/AssertExtensions"; diff --git a/test/Ported/Bugs/SimpleMultiMapTest.ts b/test/Ported/Bugs/SimpleMultiMapTest.ts index 75acf156..e1f6418f 100644 --- a/test/Ported/Bugs/SimpleMultiMapTest.ts +++ b/test/Ported/Bugs/SimpleMultiMapTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/BulkInsert/BulkInsertsTest.ts b/test/Ported/BulkInsert/BulkInsertsTest.ts index 4adf0792..778577d5 100644 --- a/test/Ported/BulkInsert/BulkInsertsTest.ts +++ b/test/Ported/BulkInsert/BulkInsertsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import DocumentStore, { diff --git a/test/Ported/Cluster/ClusterTransactionTest.ts b/test/Ported/Cluster/ClusterTransactionTest.ts index 1ece33d1..a0623aba 100644 --- a/test/Ported/Cluster/ClusterTransactionTest.ts +++ b/test/Ported/Cluster/ClusterTransactionTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { User } from "../../Assets/Entities"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; diff --git a/test/Ported/CompactTest.ts b/test/Ported/CompactTest.ts index fdfe7069..05bcd808 100644 --- a/test/Ported/CompactTest.ts +++ b/test/Ported/CompactTest.ts @@ -1,5 +1,5 @@ import { User } from "../Assets/Entities"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/ContainsTest.ts b/test/Ported/ContainsTest.ts index b540fe38..7935bd8c 100644 --- a/test/Ported/ContainsTest.ts +++ b/test/Ported/ContainsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/Core/Streaming/DocumentStreaming.ts b/test/Ported/Core/Streaming/DocumentStreaming.ts index fdd92b38..5b3ca718 100644 --- a/test/Ported/Core/Streaming/DocumentStreaming.ts +++ b/test/Ported/Core/Streaming/DocumentStreaming.ts @@ -5,7 +5,7 @@ import { IDocumentStore, StreamResult, } from "../../../../src"; -import * as assert from "assert"; +import * as assert from "node:assert"; import * as StreamUtil from "../../../../src/Utility/StreamUtil"; import { User } from "../../../Assets/Entities"; import { CONSTANTS } from "../../../../src/Constants"; diff --git a/test/Ported/Core/Streaming/QueryStreaming.ts b/test/Ported/Core/Streaming/QueryStreaming.ts index 79ed3c4b..3122c75c 100644 --- a/test/Ported/Core/Streaming/QueryStreaming.ts +++ b/test/Ported/Core/Streaming/QueryStreaming.ts @@ -6,7 +6,7 @@ import { StreamQueryStatistics, StreamResult, TimeSeriesRawResult, } from "../../../../src"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { User } from "../../../Assets/Entities"; import * as StreamUtil from "../../../../src/Utility/StreamUtil"; import { CONSTANTS } from "../../../../src/Constants"; diff --git a/test/Ported/Counters/CountersSingleNodeTest.ts b/test/Ported/Counters/CountersSingleNodeTest.ts index 1405ef93..b1b55029 100644 --- a/test/Ported/Counters/CountersSingleNodeTest.ts +++ b/test/Ported/Counters/CountersSingleNodeTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { User } from "../../Assets/Entities"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; diff --git a/test/Ported/Counters/PatchOnCountersTest.ts b/test/Ported/Counters/PatchOnCountersTest.ts index 466cc35c..ec816851 100644 --- a/test/Ported/Counters/PatchOnCountersTest.ts +++ b/test/Ported/Counters/PatchOnCountersTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Counters/QueryOnCountersTest.ts b/test/Ported/Counters/QueryOnCountersTest.ts index abaef947..1068e5d6 100644 --- a/test/Ported/Counters/QueryOnCountersTest.ts +++ b/test/Ported/Counters/QueryOnCountersTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Counters/SessionCountersTest.ts b/test/Ported/Counters/SessionCountersTest.ts index 8dacc242..a582f4c7 100644 --- a/test/Ported/Counters/SessionCountersTest.ts +++ b/test/Ported/Counters/SessionCountersTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/CrudTest.ts b/test/Ported/CrudTest.ts index 2730c922..d2a7a0ae 100644 --- a/test/Ported/CrudTest.ts +++ b/test/Ported/CrudTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/CustomSerializationTest.ts b/test/Ported/CustomSerializationTest.ts index b2cbc216..785220fa 100644 --- a/test/Ported/CustomSerializationTest.ts +++ b/test/Ported/CustomSerializationTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { IDocumentStore } from "../../src"; diff --git a/test/Ported/DeleteTest.ts b/test/Ported/DeleteTest.ts index d7c79ff3..3876addd 100644 --- a/test/Ported/DeleteTest.ts +++ b/test/Ported/DeleteTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/Documents/BasicDocumentsTest.ts b/test/Ported/Documents/BasicDocumentsTest.ts index 0f863244..d907e58f 100644 --- a/test/Ported/Documents/BasicDocumentsTest.ts +++ b/test/Ported/Documents/BasicDocumentsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Documents/LoadTest.ts b/test/Ported/Documents/LoadTest.ts index b77b67b7..49c8a6eb 100644 --- a/test/Ported/Documents/LoadTest.ts +++ b/test/Ported/Documents/LoadTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/ExistsTest.ts b/test/Ported/ExistsTest.ts index 04b4f9d9..ab3f5da4 100644 --- a/test/Ported/ExistsTest.ts +++ b/test/Ported/ExistsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/Faceted/AggregationTest.ts b/test/Ported/Faceted/AggregationTest.ts index ea99b10e..87b87be2 100644 --- a/test/Ported/Faceted/AggregationTest.ts +++ b/test/Ported/Faceted/AggregationTest.ts @@ -1,5 +1,5 @@ import * as moment from "moment"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Faceted/FacetPagingTest.ts b/test/Ported/Faceted/FacetPagingTest.ts index a650957d..a1cf60ee 100644 --- a/test/Ported/Faceted/FacetPagingTest.ts +++ b/test/Ported/Faceted/FacetPagingTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil"; import { Camera, FacetTestContext } from "../../Utils/FacetTestContext"; diff --git a/test/Ported/FirstClassPatchTest.ts b/test/Ported/FirstClassPatchTest.ts index d1cb4b17..c8419f5b 100644 --- a/test/Ported/FirstClassPatchTest.ts +++ b/test/Ported/FirstClassPatchTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { IDocumentStore, InMemoryDocumentSessionOperations } from "../../src"; import { disposeTestDocumentStore, testContext } from "../Utils/TestUtil"; diff --git a/test/Ported/HiLoTest.ts b/test/Ported/HiLoTest.ts index f684f386..7ace0e96 100644 --- a/test/Ported/HiLoTest.ts +++ b/test/Ported/HiLoTest.ts @@ -1,5 +1,5 @@ import { User } from "../Assets/Entities"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/HttpsTest.ts b/test/Ported/HttpsTest.ts index 5256c40c..74e51987 100644 --- a/test/Ported/HttpsTest.ts +++ b/test/Ported/HttpsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/Indexing/DetectIndexTypeTest.ts b/test/Ported/Indexing/DetectIndexTypeTest.ts index e543da61..abb96653 100644 --- a/test/Ported/Indexing/DetectIndexTypeTest.ts +++ b/test/Ported/Indexing/DetectIndexTypeTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { IndexType, diff --git a/test/Ported/Indexing/IndexesFromClientTest.ts b/test/Ported/Indexing/IndexesFromClientTest.ts index 920bd428..228ec958 100644 --- a/test/Ported/Indexing/IndexesFromClientTest.ts +++ b/test/Ported/Indexing/IndexesFromClientTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore diff --git a/test/Ported/Indexing/JavaScriptIndexTest.ts b/test/Ported/Indexing/JavaScriptIndexTest.ts index fcd8e03f..c08ced7a 100644 --- a/test/Ported/Indexing/JavaScriptIndexTest.ts +++ b/test/Ported/Indexing/JavaScriptIndexTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore, storeNewDoc } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Issues/RavenDB_11058.ts b/test/Ported/Issues/RavenDB_11058.ts index bbf040b0..cc9381d3 100644 --- a/test/Ported/Issues/RavenDB_11058.ts +++ b/test/Ported/Issues/RavenDB_11058.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Issues/RavenDB_11166.ts b/test/Ported/Issues/RavenDB_11166.ts index f422af3d..59cd2f1a 100644 --- a/test/Ported/Issues/RavenDB_11166.ts +++ b/test/Ported/Issues/RavenDB_11166.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore, RavenTestContext } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Issues/RavenDB_11440.ts b/test/Ported/Issues/RavenDB_11440.ts index 6cd0677d..e150c430 100644 --- a/test/Ported/Issues/RavenDB_11440.ts +++ b/test/Ported/Issues/RavenDB_11440.ts @@ -25,17 +25,21 @@ describe("RavenDB_11440", function () { let modeToSet: LogMode; switch (configuration.currentMode) { - case "None": + case "None": { modeToSet = "Information"; break; - case "Operations": + } + case "Operations": { modeToSet = "Information"; break; - case "Information": + } + case "Information": { modeToSet = "None"; break; - default: + } + default: { throwError("InvalidOperationException", "Invalid mode: " + configuration.currentMode); + } } const time = 1000 * 24 * 3600 * 1000; diff --git a/test/Ported/Issues/RavenDB_12169.ts b/test/Ported/Issues/RavenDB_12169.ts index ff9b8476..0dd6ecdc 100644 --- a/test/Ported/Issues/RavenDB_12169.ts +++ b/test/Ported/Issues/RavenDB_12169.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { Company } from "../../Assets/Entities"; import { assertThat, assertThrows } from "../../Utils/AssertExtensions"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; diff --git a/test/Ported/Issues/RavenDB_12790.ts b/test/Ported/Issues/RavenDB_12790.ts index ba2c8b0e..7934e2a7 100644 --- a/test/Ported/Issues/RavenDB_12790.ts +++ b/test/Ported/Issues/RavenDB_12790.ts @@ -1,7 +1,7 @@ import { IDocumentStore } from "../../../src"; import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil"; import { assertThrows } from "../../Utils/AssertExtensions"; -import * as assert from "assert"; +import * as assert from "node:assert"; describe("RavenDB-12790", function () { diff --git a/test/Ported/Issues/RavenDB_14164.ts b/test/Ported/Issues/RavenDB_14164.ts index e0352512..cdc0282b 100644 --- a/test/Ported/Issues/RavenDB_14164.ts +++ b/test/Ported/Issues/RavenDB_14164.ts @@ -499,7 +499,7 @@ describe("RavenDB_14164Test", function () { .hasSize(31); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(30, "minutes").toDate().getTime()); // get range [00:45 - 00:60] @@ -642,7 +642,7 @@ describe("RavenDB_14164Test", function () { .hasSize(121); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // should not go to server @@ -730,7 +730,7 @@ describe("RavenDB_14164Test", function () { .hasSize(121); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // should not go to server @@ -788,7 +788,7 @@ describe("RavenDB_14164Test", function () { .hasSize(121); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // should not go to server @@ -844,7 +844,7 @@ describe("RavenDB_14164Test", function () { .hasSize(121); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // should not go to server diff --git a/test/Ported/Issues/RavenDB_14919.ts b/test/Ported/Issues/RavenDB_14919.ts index 9692733b..6fa3d19e 100644 --- a/test/Ported/Issues/RavenDB_14919.ts +++ b/test/Ported/Issues/RavenDB_14919.ts @@ -43,7 +43,7 @@ describe("RavenDB_14919", function () { .isEqualTo(1); } - assertThat(vals.counters[vals.counters.length - 1]) + assertThat(vals.counters.at(-1)) .isNull(); // test with returnFullResults = true @@ -57,7 +57,7 @@ describe("RavenDB_14919", function () { .hasSize(1); } - assertThat(vals.counters[vals.counters.length - 1]) + assertThat(vals.counters.at(-1)) .isNull(); }); @@ -89,7 +89,7 @@ describe("RavenDB_14919", function () { .isEqualTo(i); } - assertThat(vals.counters[vals.counters.length - 1]) + assertThat(vals.counters.at(-1)) .isNull(); // test with returnFullResults = true @@ -103,7 +103,7 @@ describe("RavenDB_14919", function () { .isEqualTo(i); } - assertThat(vals.counters[vals.counters.length - 1]) + assertThat(vals.counters.at(-1)) .isNull(); }); @@ -131,7 +131,7 @@ describe("RavenDB_14919", function () { assertThat(command.result.results) .hasSize(101); - assertThat(command.result.results[command.result.results.length - 1]) + assertThat(command.result.results.at(-1)) .isNull(); }); @@ -161,7 +161,7 @@ describe("RavenDB_14919", function () { assertThat(command.result.results) .hasSize(1001); - assertThat(command.result.results[command.result.results.length - 1]) + assertThat(command.result.results.at(-1)) .isNull(); }) }); \ No newline at end of file diff --git a/test/Ported/Issues/RavenDB_18364.ts b/test/Ported/Issues/RavenDB_18364.ts index 1e368c1b..5019dd12 100644 --- a/test/Ported/Issues/RavenDB_18364.ts +++ b/test/Ported/Issues/RavenDB_18364.ts @@ -1,6 +1,6 @@ import { DocumentStore, IDocumentStore } from "../../../src"; import { ClusterTestContext, RavenTestContext } from "../../Utils/TestUtil"; -import { URL } from "url"; +import { URL } from "node:url"; import { assertThat } from "../../Utils/AssertExtensions"; (RavenTestContext.isPullRequest ? describe.skip : describe)("RavenDB_18364", function () { diff --git a/test/Ported/Issues/RavenDB_19598.ts b/test/Ported/Issues/RavenDB_19598.ts index 27eb2979..40a56822 100644 --- a/test/Ported/Issues/RavenDB_19598.ts +++ b/test/Ported/Issues/RavenDB_19598.ts @@ -1,7 +1,7 @@ import { IDocumentStore } from "../../../src"; import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil"; import { assertThat, assertThrows } from "../../Utils/AssertExtensions"; -import * as assert from "assert"; +import * as assert from "node:assert"; describe("RavenDB_19598Test", function () { let store: IDocumentStore; diff --git a/test/Ported/Issues/RavenDB_5669.ts b/test/Ported/Issues/RavenDB_5669.ts index 1553a22e..dfe01fc8 100644 --- a/test/Ported/Issues/RavenDB_5669.ts +++ b/test/Ported/Issues/RavenDB_5669.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Issues/RavenDB_6292.ts b/test/Ported/Issues/RavenDB_6292.ts index 7f6c4216..27f4c6a0 100644 --- a/test/Ported/Issues/RavenDB_6292.ts +++ b/test/Ported/Issues/RavenDB_6292.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { RavenTestContext, testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Issues/RavenDB_8328Test.ts b/test/Ported/Issues/RavenDB_8328Test.ts index 4e598570..411969bb 100644 --- a/test/Ported/Issues/RavenDB_8328Test.ts +++ b/test/Ported/Issues/RavenDB_8328Test.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore, RavenTestContext } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Issues/RavenDB_903.ts b/test/Ported/Issues/RavenDB_903.ts index 67022a53..b4824b5e 100644 --- a/test/Ported/Issues/RavenDB_903.ts +++ b/test/Ported/Issues/RavenDB_903.ts @@ -1,5 +1,5 @@ import { IDocumentQuery } from "../../../src/Documents/Session/IDocumentQuery"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Lazy/LazyTest.ts b/test/Ported/Lazy/LazyTest.ts index 9be9b5bb..0dd0d8fc 100644 --- a/test/Ported/Lazy/LazyTest.ts +++ b/test/Ported/Lazy/LazyTest.ts @@ -2,7 +2,7 @@ import { EntitiesCollectionObject, IDocumentStore } from "../../../src"; import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil"; import { Company, User } from "../../Assets/Entities"; import { Lazy } from "../../../src/Documents/Lazy"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { assertThat } from "../../Utils/AssertExtensions"; describe("LazyTest", function () { diff --git a/test/Ported/LoadIntoStreamTest.ts b/test/Ported/LoadIntoStreamTest.ts index 421de13c..255557ee 100644 --- a/test/Ported/LoadIntoStreamTest.ts +++ b/test/Ported/LoadIntoStreamTest.ts @@ -3,7 +3,7 @@ import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { IDocumentStore, } from "../../src"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { getStringWritable } from "../Utils/Streams"; import { parseJsonVerbose } from "../Utils/Json"; import * as stream from "readable-stream"; diff --git a/test/Ported/LoadTest.ts b/test/Ported/LoadTest.ts index 851d0217..e99876d8 100644 --- a/test/Ported/LoadTest.ts +++ b/test/Ported/LoadTest.ts @@ -1,6 +1,6 @@ import * as sinon from "sinon"; import { User, GeekPerson } from "../Assets/Entities"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/MailingList/LazyAggregationEmbedded.ts b/test/Ported/MailingList/LazyAggregationEmbedded.ts index 28ee3759..deaa4699 100644 --- a/test/Ported/MailingList/LazyAggregationEmbedded.ts +++ b/test/Ported/MailingList/LazyAggregationEmbedded.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/MailingList/LoadAllStartingWith.ts b/test/Ported/MailingList/LoadAllStartingWith.ts index 728681d6..afea7898 100644 --- a/test/Ported/MailingList/LoadAllStartingWith.ts +++ b/test/Ported/MailingList/LoadAllStartingWith.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { EntitiesCollectionObject, IDocumentStore } from "../../../src"; import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil"; import { Lazy } from "../../../src/Documents/Lazy"; diff --git a/test/Ported/MailingList/NoTrackingTest.ts b/test/Ported/MailingList/NoTrackingTest.ts index 57d7407d..77f2669f 100644 --- a/test/Ported/MailingList/NoTrackingTest.ts +++ b/test/Ported/MailingList/NoTrackingTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/MoreLikeThis/MoreLikeThisTest.ts b/test/Ported/MoreLikeThis/MoreLikeThisTest.ts index 3e848ca7..ad87b103 100644 --- a/test/Ported/MoreLikeThis/MoreLikeThisTest.ts +++ b/test/Ported/MoreLikeThis/MoreLikeThisTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; export abstract class Identity { diff --git a/test/Ported/NextAndSeedIdentitiesTest.ts b/test/Ported/NextAndSeedIdentitiesTest.ts index e546c19a..9f448747 100644 --- a/test/Ported/NextAndSeedIdentitiesTest.ts +++ b/test/Ported/NextAndSeedIdentitiesTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/PatchTest.ts b/test/Ported/PatchTest.ts index c418e12c..2a709241 100644 --- a/test/Ported/PatchTest.ts +++ b/test/Ported/PatchTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/Queries/HighlightsTest.ts b/test/Ported/Queries/HighlightsTest.ts index 798201be..db488aaa 100644 --- a/test/Ported/Queries/HighlightsTest.ts +++ b/test/Ported/Queries/HighlightsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { @@ -121,7 +121,7 @@ describe("HighlightsTest", function () { assert.strictEqual(contentHighlighting.fieldName, "content"); const fragments = contentHighlighting.getFragments(eventItem.id); assert.strictEqual(fragments.length, 1); - assert.ok(fragments[0].indexOf(`session`) !== -1); + assert.ok(fragments[0].includes(`session`)); const orderedResults = []; for (const searchable of results) { diff --git a/test/Ported/Queries/QueriesWithCustomFunctionsTests.ts b/test/Ported/Queries/QueriesWithCustomFunctionsTests.ts index e3f6f587..84ba3455 100644 --- a/test/Ported/Queries/QueriesWithCustomFunctionsTests.ts +++ b/test/Ported/Queries/QueriesWithCustomFunctionsTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Queries/RegexQueryTest.ts b/test/Ported/Queries/RegexQueryTest.ts index e5203a85..4f61e17e 100644 --- a/test/Ported/Queries/RegexQueryTest.ts +++ b/test/Ported/Queries/RegexQueryTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/QueryTest.ts b/test/Ported/QueryTest.ts index 12902bc3..f043199f 100644 --- a/test/Ported/QueryTest.ts +++ b/test/Ported/QueryTest.ts @@ -1,6 +1,6 @@ import * as moment from "moment"; import { User, Event } from "../Assets/Entities"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { @@ -355,8 +355,8 @@ describe("QueryTest", function () { .all(); assert.strictEqual(uniqueNames.length, 2); - assert.ok(uniqueNames.indexOf("Tarzan") !== -1); - assert.ok(uniqueNames.indexOf("John") !== -1); + assert.ok(uniqueNames.includes("Tarzan")); + assert.ok(uniqueNames.includes("John")); }); it("query search with or", async () => { diff --git a/test/Ported/RequestExecutor.ts b/test/Ported/RequestExecutor.ts index e5b161cd..490041b3 100644 --- a/test/Ported/RequestExecutor.ts +++ b/test/Ported/RequestExecutor.ts @@ -3,7 +3,7 @@ import { ClusterTestContext, disposeTestDocumentStore, RavenTestContext, testCon import { throwError } from "../../src/Exceptions"; import { HttpRequestParameters, HttpResponse } from "../../src/Primitives/Http"; import * as stream from "readable-stream"; -import * as http from "http"; +import * as http from "node:http"; import { User } from "../Assets/Entities"; import { assertThat } from "../Utils/AssertExtensions"; @@ -49,21 +49,21 @@ async function onBeforeAfterAndFailRequestInternal(failCount: number, clusterSiz const store = new DocumentStore(leader.url, databaseName); try { store.addSessionListener("beforeRequest", e => { - if (!e.url.match(urlRegex)) { + if (!urlRegex.test(e.url)) { return; } sessionActual.push("OnBeforeRequest"); }); store.addSessionListener("succeedRequest", e => { - if (!e.url.match(urlRegex)) { + if (!urlRegex.test(e.url)) { return; } sessionActual.push("OnAfterRequests"); }); store.addSessionListener("failedRequest", e => { - if (!e.url.match(urlRegex)) { + if (!urlRegex.test(e.url)) { return; } sessionActual.push("OnFailedRequest"); @@ -74,21 +74,21 @@ async function onBeforeAfterAndFailRequestInternal(failCount: number, clusterSiz const requestExecutor = store.getRequestExecutor(); requestExecutor.on("beforeRequest", e => { - if (!e.url.match(urlRegex)) { + if (!urlRegex.test(e.url)) { return; } actual.push("OnBeforeRequest"); }); requestExecutor.on("succeedRequest", e => { - if (!e.url.match(urlRegex)) { + if (!urlRegex.test(e.url)) { return; } actual.push("OnAfterRequests"); }); requestExecutor.on("failedRequest", e => { - if (!e.url.match(urlRegex)) { + if (!urlRegex.test(e.url)) { return; } actual.push("OnFailedRequest"); diff --git a/test/Ported/RevisionsTest.ts b/test/Ported/RevisionsTest.ts index 7d88423e..2fceea07 100644 --- a/test/Ported/RevisionsTest.ts +++ b/test/Ported/RevisionsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore, RavenTestContext } from "../Utils/TestUtil"; import { diff --git a/test/Ported/Server/Documents/Indexing/RavenDB_8761.ts b/test/Ported/Server/Documents/Indexing/RavenDB_8761.ts index 4b5b0546..fe121e39 100644 --- a/test/Ported/Server/Documents/Indexing/RavenDB_8761.ts +++ b/test/Ported/Server/Documents/Indexing/RavenDB_8761.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../../../Utils/TestUtil"; import { diff --git a/test/Ported/Server/Documents/Notifications/ChangesTest.ts b/test/Ported/Server/Documents/Notifications/ChangesTest.ts index a7e2cea9..cf47c80f 100644 --- a/test/Ported/Server/Documents/Notifications/ChangesTest.ts +++ b/test/Ported/Server/Documents/Notifications/ChangesTest.ts @@ -1,5 +1,5 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../../../Utils/TestUtil"; import { diff --git a/test/Ported/Server/Documents/Notifications/SecuredChangesTest.ts b/test/Ported/Server/Documents/Notifications/SecuredChangesTest.ts index a9375528..6520d8a4 100644 --- a/test/Ported/Server/Documents/Notifications/SecuredChangesTest.ts +++ b/test/Ported/Server/Documents/Notifications/SecuredChangesTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../../../Utils/TestUtil"; import { diff --git a/test/Ported/Server/Patching/AdvancedPatchingTest.ts b/test/Ported/Server/Patching/AdvancedPatchingTest.ts index e918efb9..cef47f4a 100644 --- a/test/Ported/Server/Patching/AdvancedPatchingTest.ts +++ b/test/Ported/Server/Patching/AdvancedPatchingTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../../Utils/TestUtil"; import { diff --git a/test/Ported/Server/RecordingTransactionOperationsMergerTest.ts b/test/Ported/Server/RecordingTransactionOperationsMergerTest.ts index afbaf9fa..8861ba4d 100644 --- a/test/Ported/Server/RecordingTransactionOperationsMergerTest.ts +++ b/test/Ported/Server/RecordingTransactionOperationsMergerTest.ts @@ -1,10 +1,10 @@ import { IDocumentStore } from "../../../src"; import { disposeTestDocumentStore, TemporaryDirContext, testContext } from "../../Utils/TestUtil"; -import * as path from "path"; +import * as path from "node:path"; import { StartTransactionsRecordingOperation } from "../../../src/Documents/Operations/TransactionsRecording/StartTransactionsRecordingOperation"; import { StopTransactionsRecordingOperation } from "../../../src/Documents/Operations/TransactionsRecording/StopTransactionsRecordingOperation"; import { assertThat } from "../../Utils/AssertExtensions"; -import * as fs from "fs"; +import * as fs from "node:fs"; import { CreateSampleDataOperation } from "../../Utils/CreateSampleDataOperation"; describe("RecordingTransactionOperationsMergerTest", function () { diff --git a/test/Ported/Server/Replication/DocumentReplicationTest.ts b/test/Ported/Server/Replication/DocumentReplicationTest.ts index f941e0a2..377225c2 100644 --- a/test/Ported/Server/Replication/DocumentReplicationTest.ts +++ b/test/Ported/Server/Replication/DocumentReplicationTest.ts @@ -1,6 +1,6 @@ import { User } from "../../../Assets/Entities"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { RavenTestContext, testContext, disposeTestDocumentStore } from "../../../Utils/TestUtil"; import { diff --git a/test/Ported/SmugglerTest.ts b/test/Ported/SmugglerTest.ts index 44c7d0d6..2676564b 100644 --- a/test/Ported/SmugglerTest.ts +++ b/test/Ported/SmugglerTest.ts @@ -8,9 +8,9 @@ import { disposeTestDocumentStore, TemporaryDirContext, testContext } from "../U import { User } from "../Assets/Entities"; import { UsersByName } from "./QueryTest"; import { assertThat } from "../Utils/AssertExtensions"; -import * as fs from "fs"; +import * as fs from "node:fs"; import { CONSTANTS } from "../../src/Constants"; -import * as path from "path"; +import * as path from "node:path"; import { BackupUtils } from "../../src/Documents/Smuggler/BackupUtils"; describe("SmugglerTest", function () { diff --git a/test/Ported/Spatial/BoundingBoxIndexTest.ts b/test/Ported/Spatial/BoundingBoxIndexTest.ts index e69a4326..0c9c0d87 100644 --- a/test/Ported/Spatial/BoundingBoxIndexTest.ts +++ b/test/Ported/Spatial/BoundingBoxIndexTest.ts @@ -1,6 +1,6 @@ import { AbstractJavaScriptIndexCreationTask, SpatialBounds } from "../../../src"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Spatial/RavenDB_9676.ts b/test/Ported/Spatial/RavenDB_9676.ts index dab0a36c..41a112fe 100644 --- a/test/Ported/Spatial/RavenDB_9676.ts +++ b/test/Ported/Spatial/RavenDB_9676.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Spatial/SimonBartlettTest.ts b/test/Ported/Spatial/SimonBartlettTest.ts index ba7f6d70..5bf645b4 100644 --- a/test/Ported/Spatial/SimonBartlettTest.ts +++ b/test/Ported/Spatial/SimonBartlettTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Spatial/SpatialQueriesTest.ts b/test/Ported/Spatial/SpatialQueriesTest.ts index cfd01717..cd3c31df 100644 --- a/test/Ported/Spatial/SpatialQueriesTest.ts +++ b/test/Ported/Spatial/SpatialQueriesTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Spatial/SpatialSearchTest.ts b/test/Ported/Spatial/SpatialSearchTest.ts index 901e26a2..c372a40a 100644 --- a/test/Ported/Spatial/SpatialSearchTest.ts +++ b/test/Ported/Spatial/SpatialSearchTest.ts @@ -1,5 +1,5 @@ import * as moment from "moment"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Spatial/SpatialSortingTest.ts b/test/Ported/Spatial/SpatialSortingTest.ts index 3750c92a..c76d621f 100644 --- a/test/Ported/Spatial/SpatialSortingTest.ts +++ b/test/Ported/Spatial/SpatialSortingTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Spatial/SpatialTest.ts b/test/Ported/Spatial/SpatialTest.ts index 40a25038..146283cb 100644 --- a/test/Ported/Spatial/SpatialTest.ts +++ b/test/Ported/Spatial/SpatialTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/StoreTest.ts b/test/Ported/StoreTest.ts index bb7f8e5e..27a7b8ff 100644 --- a/test/Ported/StoreTest.ts +++ b/test/Ported/StoreTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/Subscriptions/RevisionsSubscriptionsTest.ts b/test/Ported/Subscriptions/RevisionsSubscriptionsTest.ts index b5aab0cb..33c11001 100644 --- a/test/Ported/Subscriptions/RevisionsSubscriptionsTest.ts +++ b/test/Ported/Subscriptions/RevisionsSubscriptionsTest.ts @@ -7,7 +7,7 @@ import DocumentStore, { RevisionsConfiguration, ConfigureRevisionsOperation } from "../../../src"; -import * as assert from "assert"; +import * as assert from "node:assert"; // skipped for the time being // subscriptions are not working with server version 4.1 diff --git a/test/Ported/Subscriptions/SecuredSubscriptionsBasicTest.ts b/test/Ported/Subscriptions/SecuredSubscriptionsBasicTest.ts index 626e8110..7690f8aa 100644 --- a/test/Ported/Subscriptions/SecuredSubscriptionsBasicTest.ts +++ b/test/Ported/Subscriptions/SecuredSubscriptionsBasicTest.ts @@ -1,5 +1,5 @@ import { User } from "../../Assets/Entities"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import { diff --git a/test/Ported/Subscriptions/SubscriptionsBasicTest.ts b/test/Ported/Subscriptions/SubscriptionsBasicTest.ts index be860cca..c86f09ac 100644 --- a/test/Ported/Subscriptions/SubscriptionsBasicTest.ts +++ b/test/Ported/Subscriptions/SubscriptionsBasicTest.ts @@ -1,5 +1,5 @@ import { Company, Order, User } from "../../Assets/Entities"; -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil"; import DocumentStore, { diff --git a/test/Ported/Suggestions/SuggestionsLazyTest.ts b/test/Ported/Suggestions/SuggestionsLazyTest.ts index f64dbeed..d57d7cce 100644 --- a/test/Ported/Suggestions/SuggestionsLazyTest.ts +++ b/test/Ported/Suggestions/SuggestionsLazyTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { IDocumentStore, IndexDefinition, IndexFieldOptions, PutIndexesOperation } from "../../../src"; import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil"; diff --git a/test/Ported/Suggestions/SuggestionsTest.ts b/test/Ported/Suggestions/SuggestionsTest.ts index 034517b9..4423992e 100644 --- a/test/Ported/Suggestions/SuggestionsTest.ts +++ b/test/Ported/Suggestions/SuggestionsTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { IDocumentStore, IndexDefinition, IndexFieldOptions, PutIndexesOperation, SuggestionOptions } from "../../../src"; import { disposeTestDocumentStore, RavenTestContext, testContext } from "../../Utils/TestUtil"; diff --git a/test/Ported/TimeSeries/TimeSeriesConfiguration.ts b/test/Ported/TimeSeries/TimeSeriesConfiguration.ts index 512961fc..f585d5d3 100644 --- a/test/Ported/TimeSeries/TimeSeriesConfiguration.ts +++ b/test/Ported/TimeSeries/TimeSeriesConfiguration.ts @@ -209,11 +209,11 @@ import { const session = store.openSession(); const ts = await session.timeSeriesFor("users/karmel", "Heartrate").get(); - const tsMillis = ts[ts.length - 1].timestamp.getTime() - ts[0].timestamp.getTime(); + const tsMillis = ts.at(-1).timestamp.getTime() - ts[0].timestamp.getTime(); const ts1 = await session.timeSeriesFor("users/karmel", p1.getTimeSeriesName("Heartrate")).get(); - const ts1Millis = ts1[ts1.length - 1].timestamp.getTime() - ts1[0].timestamp.getTime(); + const ts1Millis = ts1.at(-1).timestamp.getTime() - ts1[0].timestamp.getTime(); assertThat(ts1Millis) .isEqualTo(tsMillis - 600); diff --git a/test/Ported/TrackEntityTest.ts b/test/Ported/TrackEntityTest.ts index ed1693c3..3332303b 100644 --- a/test/Ported/TrackEntityTest.ts +++ b/test/Ported/TrackEntityTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/UniqueValuesTest.ts b/test/Ported/UniqueValuesTest.ts index 75051376..7f47f150 100644 --- a/test/Ported/UniqueValuesTest.ts +++ b/test/Ported/UniqueValuesTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Ported/WhatChangedTest.ts b/test/Ported/WhatChangedTest.ts index 252c8271..3ffeaa9b 100644 --- a/test/Ported/WhatChangedTest.ts +++ b/test/Ported/WhatChangedTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/Primitives/CaseInsensitivePrimitivesTests.ts b/test/Primitives/CaseInsensitivePrimitivesTests.ts index 2327501d..16a76b5e 100644 --- a/test/Primitives/CaseInsensitivePrimitivesTests.ts +++ b/test/Primitives/CaseInsensitivePrimitivesTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { CaseInsensitiveKeysMap } from "../../src/Primitives/CaseInsensitiveKeysMap"; import { CaseInsensitiveStringSet } from "../../src/Primitives/CaseInsensitiveStringSet"; diff --git a/test/Primitives/TypeUtilTests.ts b/test/Primitives/TypeUtilTests.ts index 617cfebd..4d26374a 100644 --- a/test/Primitives/TypeUtilTests.ts +++ b/test/Primitives/TypeUtilTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/ServerWide/GetClusterTopologyCommandTests.ts b/test/ServerWide/GetClusterTopologyCommandTests.ts index 07e4bcf8..39148fe2 100644 --- a/test/ServerWide/GetClusterTopologyCommandTests.ts +++ b/test/ServerWide/GetClusterTopologyCommandTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/ServerWide/GetDatabaseRecordTest.ts b/test/ServerWide/GetDatabaseRecordTest.ts index a3ffc3f5..fb912938 100644 --- a/test/ServerWide/GetDatabaseRecordTest.ts +++ b/test/ServerWide/GetDatabaseRecordTest.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { DatabaseRecordWithEtag, diff --git a/test/ServerWide/GetTcpInfoCommandTests.ts b/test/ServerWide/GetTcpInfoCommandTests.ts index 1e9639f6..f248422e 100644 --- a/test/ServerWide/GetTcpInfoCommandTests.ts +++ b/test/ServerWide/GetTcpInfoCommandTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { diff --git a/test/ServerWide/GetTopologyCommandTests.ts b/test/ServerWide/GetTopologyCommandTests.ts index bcaf34d9..d70b95de 100644 --- a/test/ServerWide/GetTopologyCommandTests.ts +++ b/test/ServerWide/GetTopologyCommandTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil"; import { GetDatabaseTopologyCommand, diff --git a/test/TestDriver/RavenServerRunner.ts b/test/TestDriver/RavenServerRunner.ts index a42d6e57..341cec04 100644 --- a/test/TestDriver/RavenServerRunner.ts +++ b/test/TestDriver/RavenServerRunner.ts @@ -1,6 +1,6 @@ -import * as fs from "fs"; -import * as path from "path"; -import { ChildProcess, spawn } from "child_process"; +import * as fs from "node:fs"; +import * as path from "node:path"; +import { ChildProcess, spawn } from "node:child_process"; import { RavenServerLocator } from "./RavenServerLocator"; import { throwError } from "../../src/Exceptions"; diff --git a/test/TestDriver/index.ts b/test/TestDriver/index.ts index 53e7b12b..239a85b7 100644 --- a/test/TestDriver/index.ts +++ b/test/TestDriver/index.ts @@ -1,5 +1,5 @@ -import { ChildProcess } from "child_process"; -import * as os from "os"; +import { ChildProcess } from "node:child_process"; +import * as os from "node:os"; import { CONSTANTS } from "../../src/Constants"; import { DocumentStore } from "../../src/Documents/DocumentStore"; @@ -19,7 +19,7 @@ import { import { Dog, Entity, Genre, Movie, Rating, User } from "../Assets/Graph"; import { RequestExecutor } from "../../src/Http/RequestExecutor"; import * as proxyAgent from "http-proxy-agent"; -import * as http from "http"; +import * as http from "node:http"; import { Stopwatch } from "../../src/Utility/Stopwatch"; import { delay, wrapWithTimeout } from "../../src/Utility/PromiseUtil"; import { ClusterTestContext } from "../Utils/TestUtil"; @@ -120,6 +120,7 @@ export abstract class RavenTestDriver { try { const url = await wrapWithTimeout(result, 5_000); + // eslint-disable-next-line no-console console.log("DEBUG: RavenDB server URL", url); return url; } catch (err) { diff --git a/test/Utilities/SemaphoreUtilTests.ts b/test/Utilities/SemaphoreUtilTests.ts index e54a4e70..5b1b3957 100644 --- a/test/Utilities/SemaphoreUtilTests.ts +++ b/test/Utilities/SemaphoreUtilTests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; import * as SemaphoreUtil from "../../src/Utility/SemaphoreUtil"; import * as semaphore from "semaphore"; import { delay } from "../../src/Utility/PromiseUtil"; diff --git a/test/Utils/AssertExtensions.ts b/test/Utils/AssertExtensions.ts index bd1a2449..504e2929 100644 --- a/test/Utils/AssertExtensions.ts +++ b/test/Utils/AssertExtensions.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import * as assert from "node:assert"; // eslint-disable-next-line @typescript-eslint/ban-types export async function assertThrows(func: Function, errAssert?: (err: Error) => void) { @@ -48,7 +48,7 @@ export class JavaAssertionBuilder { } public contains(val) { - assert.ok(this._value.indexOf(val) !== -1, `'${this._value}' does not contain '${val}.'`); + assert.ok(this._value.includes(val), `'${this._value}' does not contain '${val}.'`); return this; } diff --git a/test/Utils/RavenTestHelper.ts b/test/Utils/RavenTestHelper.ts index 74b42683..60f4a7de 100644 --- a/test/Utils/RavenTestHelper.ts +++ b/test/Utils/RavenTestHelper.ts @@ -1,5 +1,5 @@ import { GetIndexErrorsOperation, IDocumentStore } from "../../src"; -import * as os from "os"; +import * as os from "node:os"; import { throwError } from "../../src/Exceptions"; import { StringBuilder } from "../../src/Utility/StringBuilder"; diff --git a/test/Utils/ReplicationTestContext.ts b/test/Utils/ReplicationTestContext.ts index edb21674..5fe063ab 100644 --- a/test/Utils/ReplicationTestContext.ts +++ b/test/Utils/ReplicationTestContext.ts @@ -60,13 +60,9 @@ export class ReplicationTestContext { await store.maintenance.send(new PutConnectionStringOperation(connectionString)); - let op: IMaintenanceOperation; - - if ("hubName" in watcher) { - op = new UpdatePullReplicationAsSinkOperation(watcher as PullReplicationAsSink); - } else { - op = new UpdateExternalReplicationOperation(watcher); - } + const op: IMaintenanceOperation = "hubName" in watcher + ? new UpdatePullReplicationAsSinkOperation(watcher as PullReplicationAsSink) + : new UpdateExternalReplicationOperation(watcher); return await store.maintenance.send(op); } diff --git a/test/Utils/TestUtil.ts b/test/Utils/TestUtil.ts index 716646da..de7b768a 100644 --- a/test/Utils/TestUtil.ts +++ b/test/Utils/TestUtil.ts @@ -1,9 +1,9 @@ -import * as fs from "fs"; -import * as path from "path"; -import * as url from "url"; +import * as fs from "node:fs"; +import * as path from "node:path"; +import * as url from "node:url"; import { MultiError, VError } from "verror"; -import * as http from "http"; -import * as https from "https"; +import * as http from "node:http"; +import * as https from "node:https"; import "source-map-support/register"; import { IDisposable } from "../../src/Types/Contracts"; import { RavenTestDriver } from "../TestDriver"; @@ -11,7 +11,7 @@ import { RavenServerLocator } from "../TestDriver/RavenServerLocator"; import { IDocumentStore } from "../../src/Documents/IDocumentStore"; import { getError, throwError } from "../../src/Exceptions"; import { IAuthOptions } from "../../src/Auth/AuthOptions"; -import * as os from "os"; +import * as os from "node:os"; import "../../src/Utility/Polyfills"; import { CreateDatabaseOperation, @@ -21,7 +21,7 @@ import { IDocumentSession, ServerNode } from "../../src"; import * as rimraf from "rimraf"; -import { ChildProcess } from "child_process"; +import { ChildProcess } from "node:child_process"; import { TypeUtil } from "../../src/Utility/TypeUtil"; import { getLogger } from "../../src/Utility/LogUtil"; import { AdminJsConsoleOperation } from "./AdminJsConsoleOperation"; @@ -124,9 +124,9 @@ class TestSecuredServiceLocator extends RavenServerLocator { return { type: "pem", - certificate: fs.readFileSync(clientCertPath, "utf-8"), + certificate: fs.readFileSync(clientCertPath, "utf8"), password: clientCertPass, - ca: fs.readFileSync(serverCaCertPath, "utf-8"), + ca: fs.readFileSync(serverCaCertPath, "utf8"), }; } } From 8f0b33e512f5f0f72a50b6d1494281ad4f8bc0ac Mon Sep 17 00:00:00 2001 From: Marcin Lewandowski Date: Fri, 5 Apr 2024 23:27:17 +0200 Subject: [PATCH 3/4] enforcing rules --- .../Session/AbstractDocumentQuery.ts | 20 +++++++------- src/Documents/Smuggler/DatabaseSmuggler.ts | 2 +- src/Exceptions/index.ts | 2 +- src/Utility/StringUtil.ts | 4 +-- test/Mapping/JsonTests.ts | 2 +- test/Mapping/ObjectMapperTests.ts | 2 +- test/Ported/CompactTest.ts | 5 ++-- test/Ported/Faceted/FacetPagingTest.ts | 2 +- test/Ported/HiLoTest.ts | 14 +++++----- test/Ported/HttpsTest.ts | 2 +- test/Ported/Indexing/JavaScriptIndexTest.ts | 4 +-- test/Ported/Issues/RavenDB_14164.ts | 20 +++++++------- test/Ported/Issues/RavenDB_14272.ts | 18 ++++++------- test/Ported/Issues/RavenDB_15134.ts | 6 ++--- test/Ported/Issues/RavenDB_9587.ts | 4 +-- test/Ported/RequestExecutor.ts | 2 +- .../RevisionsSubscriptionsTest.ts | 8 +++--- .../SecuredSubscriptionsBasicTest.ts | 8 +++--- .../Subscriptions/SubscriptionsBasicTest.ts | 26 +++++++++---------- test/Utils/AssertExtensions.ts | 14 +++++----- test/Utils/AsyncQueue.ts | 2 +- 21 files changed, 81 insertions(+), 86 deletions(-) diff --git a/src/Documents/Session/AbstractDocumentQuery.ts b/src/Documents/Session/AbstractDocumentQuery.ts index 0b8fac37..1f35b62e 100644 --- a/src/Documents/Session/AbstractDocumentQuery.ts +++ b/src/Documents/Session/AbstractDocumentQuery.ts @@ -340,7 +340,7 @@ export abstract class AbstractDocumentQuery 0) { - const last = tokens[tokens.length - 1]; + const last = tokens.at(-1); if (last instanceof WhereToken || last instanceof CloseSubclauseToken) { this._isIntersect = true; @@ -2340,7 +2340,7 @@ export abstract class AbstractDocumentQuery { it("can skip objects", () => { const transformRules: ReviverTransformRule[] = [ { - contextMatcher: (context) => context.currentPath.indexOf(".") === -1, + contextMatcher: (context) => !context.currentPath.includes("."), reviver: camelCaseReviver } ]; diff --git a/test/Mapping/ObjectMapperTests.ts b/test/Mapping/ObjectMapperTests.ts index a1e50b13..66dca254 100644 --- a/test/Mapping/ObjectMapperTests.ts +++ b/test/Mapping/ObjectMapperTests.ts @@ -459,7 +459,7 @@ describe("ObjectMapper", function () { for (const item of resultSet) { assert.strictEqual(item.constructor, Tree); assert.ok(testObj.treeSpecies - .map(x => x.name).some(x => x === item.name)); + .map(x => x.name).includes(item.name)); } assert.strictEqual(resultSet.size, 2); diff --git a/test/Ported/CompactTest.ts b/test/Ported/CompactTest.ts index 05bcd808..d0a36d6f 100644 --- a/test/Ported/CompactTest.ts +++ b/test/Ported/CompactTest.ts @@ -38,9 +38,8 @@ describe("CompactTest", function () { assert.fail("It should have thrown."); } catch (err) { assert.ok( - err.message.indexOf( - "Unable to cast object of type 'PureMemoryStorageEnvironmentOptions' " - + "to type 'DirectoryStorageEnvironmentOptions'") !== -1, "Actual error: " + err.stack); + err.message.includes("Unable to cast object of type 'PureMemoryStorageEnvironmentOptions' " + + "to type 'DirectoryStorageEnvironmentOptions'"), "Actual error: " + err.stack); } }); }); diff --git a/test/Ported/Faceted/FacetPagingTest.ts b/test/Ported/Faceted/FacetPagingTest.ts index a1cf60ee..980de873 100644 --- a/test/Ported/Faceted/FacetPagingTest.ts +++ b/test/Ported/Faceted/FacetPagingTest.ts @@ -146,7 +146,7 @@ describe("FacetPagingTest", function () { ["desc", "asc"]) .map(x => x.count); - assert.strictEqual(counts[counts.length - 1], facetResults["manufacturer"].remainingHits); + assert.strictEqual(counts.at(-1), facetResults["manufacturer"].remainingHits); } } }); diff --git a/test/Ported/HiLoTest.ts b/test/Ported/HiLoTest.ts index 7ace0e96..38e378ad 100644 --- a/test/Ported/HiLoTest.ts +++ b/test/Ported/HiLoTest.ts @@ -40,12 +40,11 @@ describe("HiLo", function () { const userIds = users.map(x => x.id); assert.strictEqual(new Set(userIds).size, userIds.length, `Ids are not unique: ${userIds}`); - userIds - .map(id => id.split("/")[1]) - .forEach(numericPart => { + for (const numericPart of userIds + .map(id => id.split("/")[1])) { assert.ok(parseInt(numericPart, 10) < 33, "Obtained ids should be less than 33, though they are:" + users.map(x => x.id).toString()); - }); + } }); @@ -208,14 +207,13 @@ describe("HiLo", function () { await Promise.all(tasks); - users + for (const numericPart of users .map(x => x.id) .map(id => id.split("/")[1]) - .map(x => x.split("-")[0]) - .forEach(numericPart => { + .map(x => x.split("-")[0])) { assert.ok(numericPart); assert.ok(parseInt(numericPart, 10) < 33); - }); + } }); it("does get another range when gets over max and leaves no gaps", async () => { diff --git a/test/Ported/HttpsTest.ts b/test/Ported/HttpsTest.ts index 74e51987..af8024c5 100644 --- a/test/Ported/HttpsTest.ts +++ b/test/Ported/HttpsTest.ts @@ -159,7 +159,7 @@ describe("HttpsTest", function () { const names = certificateDefinitions.map(x => x.name); assertThat(names) .contains("cert3-newName"); - assertThat(!!names.find(x => x === "cert3")) + assertThat(names.includes("cert3")) .isFalse(); const certificateMetadata = await store.maintenance.server.send(new GetCertificateMetadataOperation(cert1Thumbprint)); diff --git a/test/Ported/Indexing/JavaScriptIndexTest.ts b/test/Ported/Indexing/JavaScriptIndexTest.ts index c08ced7a..57bbf24f 100644 --- a/test/Ported/Indexing/JavaScriptIndexTest.ts +++ b/test/Ported/Indexing/JavaScriptIndexTest.ts @@ -691,12 +691,12 @@ class FanoutByNumbers extends AbstractJavaScriptIndexCreationTask { this.map(Fanout, f => { const result: FanoutByNumbersResult[] = []; - f.numbers.forEach(item => { + for (const item of f.numbers) { result.push({ foo: f.foo, sum: item }); - }); + } return result; }) } diff --git a/test/Ported/Issues/RavenDB_14164.ts b/test/Ported/Issues/RavenDB_14164.ts index cdc0282b..0fca07b9 100644 --- a/test/Ported/Issues/RavenDB_14164.ts +++ b/test/Ported/Issues/RavenDB_14164.ts @@ -68,7 +68,7 @@ describe("RavenDB_14164Test", function () { .hasSize(121); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // should not go to server @@ -157,7 +157,7 @@ describe("RavenDB_14164Test", function () { .hasSize(121); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // should not go to server @@ -260,7 +260,7 @@ describe("RavenDB_14164Test", function () { .hasSize(61); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(1, "hours").toDate().getTime()); // get [01:15 - 02:00] with includes @@ -277,7 +277,7 @@ describe("RavenDB_14164Test", function () { .hasSize(46); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.clone().add(75, "minutes").toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // should not go to server @@ -376,7 +376,7 @@ describe("RavenDB_14164Test", function () { .hasSize(61); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(1, "hours").toDate().getTime()); // get [01:30 - 02:00] @@ -390,7 +390,7 @@ describe("RavenDB_14164Test", function () { .hasSize(31); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.clone().add(90, "minutes").toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // get [01:00 - 01:15] with includes @@ -407,7 +407,7 @@ describe("RavenDB_14164Test", function () { .hasSize(16); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.clone().add(1, "hours").toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(75, "minutes").toDate().getTime()); // should not go to server @@ -513,7 +513,7 @@ describe("RavenDB_14164Test", function () { .hasSize(16); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.clone().add(45, "minutes").toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(1, "hour").toDate().getTime()); // get range [01:30 - 02:00] @@ -526,7 +526,7 @@ describe("RavenDB_14164Test", function () { .hasSize(31); assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.clone().add(90, "minutes").toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hour").toDate().getTime()); // get multiple ranges with includes @@ -546,7 +546,7 @@ describe("RavenDB_14164Test", function () { assertThat(getResults[0].timestamp.getTime()) .isEqualTo(baseLine.toDate().getTime()); - assertThat(getResults[getResults.length - 1].timestamp.getTime()) + assertThat(getResults.at(-1).timestamp.getTime()) .isEqualTo(baseLine.clone().add(2, "hours").toDate().getTime()); // should not go to server diff --git a/test/Ported/Issues/RavenDB_14272.ts b/test/Ported/Issues/RavenDB_14272.ts index 77da677c..8024e44e 100644 --- a/test/Ported/Issues/RavenDB_14272.ts +++ b/test/Ported/Issues/RavenDB_14272.ts @@ -30,11 +30,10 @@ describe("RavenDB_14272", function () { .hasSize(1); assertThat(result[0].userDefs.size) .isEqualTo(2); - Array.from(userTalk.userDefs.keys()) - .forEach(val => { + for (const val of Array.from(userTalk.userDefs.keys())) { assertThat(Array.from(result[0].userDefs.keys())) .contains(val); - }); + } } }); @@ -54,11 +53,10 @@ describe("RavenDB_14272", function () { .hasSize(1); assertThat(result[0].userDefs.size) .isEqualTo(2); - Array.from(userTalk.userDefs.keys()) - .forEach(val => { - assertThat(Array.from(result[0].userDefs.keys())) - .contains(val); - }); + for (const val of Array.from(userTalk.userDefs.keys())) { + assertThat(Array.from(result[0].userDefs.keys())) + .contains(val); + } } }); @@ -103,10 +101,10 @@ describe("RavenDB_14272", function () { assertThat(projection.userDefs) .hasSize(2); - Array.from(userTalk.userDefs.keys()).forEach(key => { + for (const key of Array.from(userTalk.userDefs.keys())) { assertThat(Array.from(projection.userDefs.keys())) .contains(key); - }); + } }); await StreamUtil.finishedAsync(queryStream); diff --git a/test/Ported/Issues/RavenDB_15134.ts b/test/Ported/Issues/RavenDB_15134.ts index 6ce6921c..902eb3f3 100644 --- a/test/Ported/Issues/RavenDB_15134.ts +++ b/test/Ported/Issues/RavenDB_15134.ts @@ -37,9 +37,9 @@ describe("RavenDB_15134", function () { assertThat(vals.counters.filter(x => !x).length) .isGreaterThan(0); - assertThat(!!vals.counters.find(x => x && x.totalValue === 1)) + assertThat(vals.counters.some(x => x && x.totalValue === 1)) .isTrue(); - assertThat(!!vals.counters.find(x => x && x.totalValue === 2)) + assertThat(vals.counters.some(x => x && x.totalValue === 2)) .isTrue(); assertThat(vals.counters[0].totalValue) @@ -55,7 +55,7 @@ describe("RavenDB_15134", function () { assertThat(vals.counters.filter(x => !x).length) .isGreaterThan(0); - assertThat(!!vals.counters.find(x => x && Object.keys(x.counterValues).length === 1)) + assertThat(vals.counters.some(x => x && Object.keys(x.counterValues).length === 1)) .isTrue(); }); diff --git a/test/Ported/Issues/RavenDB_9587.ts b/test/Ported/Issues/RavenDB_9587.ts index 4c214929..10bb63ba 100644 --- a/test/Ported/Issues/RavenDB_9587.ts +++ b/test/Ported/Issues/RavenDB_9587.ts @@ -40,10 +40,10 @@ describe("RavenDB-9587", function () { .isNotNull(); assertThat(timings instanceof QueryTimings) .isTrue(); - Object.keys(timings.timings).forEach(key => { + for (const key of Object.keys(timings.timings)) { assertThat(timings.timings[key] instanceof QueryTimings) .isTrue(); - }); + } } }); diff --git a/test/Ported/RequestExecutor.ts b/test/Ported/RequestExecutor.ts index 490041b3..d69ee962 100644 --- a/test/Ported/RequestExecutor.ts +++ b/test/Ported/RequestExecutor.ts @@ -98,7 +98,7 @@ async function onBeforeAfterAndFailRequestInternal(failCount: number, clusterSiz const command = new FirstFailCommand("User/1", null, documentJson, failCount); try { await requestExecutor.execute(command); - } catch (e) { + } catch { // ignored } diff --git a/test/Ported/Subscriptions/RevisionsSubscriptionsTest.ts b/test/Ported/Subscriptions/RevisionsSubscriptionsTest.ts index 33c11001..59a036af 100644 --- a/test/Ported/Subscriptions/RevisionsSubscriptionsTest.ts +++ b/test/Ported/Subscriptions/RevisionsSubscriptionsTest.ts @@ -78,7 +78,7 @@ import * as assert from "node:assert"; sub.on("batch", (batch, callback) => { try { - batch.items.forEach(item => { + for (const item of batch.items) { const result = item.result; names.add( (result.current ? result.current.name : null) @@ -87,7 +87,7 @@ import * as assert from "node:assert"; if (names.size === 100) { resolve(); } - }); + } } catch (err) { callback(err); return; @@ -153,7 +153,7 @@ import * as assert from "node:assert"; let maxAge = -1; sub.on("batch", (batch, callback) => { - batch.items.forEach(item => { + for (const item of batch.items) { const x = item.result; if (x.current.age > maxAge && x.current.age > (x.previous ? x.previous.age : -1)) { @@ -166,7 +166,7 @@ import * as assert from "node:assert"; if (names.size === 10) { resolve(); } - }); + } callback(); }); diff --git a/test/Ported/Subscriptions/SecuredSubscriptionsBasicTest.ts b/test/Ported/Subscriptions/SecuredSubscriptionsBasicTest.ts index 7690f8aa..4d788f69 100644 --- a/test/Ported/Subscriptions/SecuredSubscriptionsBasicTest.ts +++ b/test/Ported/Subscriptions/SecuredSubscriptionsBasicTest.ts @@ -54,8 +54,8 @@ describe("SecuredSubscriptionsBasicTest", function () { const ages = new AsyncQueue(); subscription.on("batch", (batch, callback) => { - batch.items.forEach(x => keys.push(x.id)); - batch.items.forEach(x => ages.push(x.result.age)); + for (const x of batch.items) keys.push(x.id); + for (const x of batch.items) ages.push(x.result.age); callback(); }); @@ -109,9 +109,9 @@ describe("SecuredSubscriptionsBasicTest", function () { } subscription.on("batch", (batch, callback) => { - batch.items.forEach(x => { + for (const x of batch.items) { names.push(x.result.name); - }); + } callback(); }); diff --git a/test/Ported/Subscriptions/SubscriptionsBasicTest.ts b/test/Ported/Subscriptions/SubscriptionsBasicTest.ts index c86f09ac..f78526db 100644 --- a/test/Ported/Subscriptions/SubscriptionsBasicTest.ts +++ b/test/Ported/Subscriptions/SubscriptionsBasicTest.ts @@ -182,8 +182,8 @@ describe("SubscriptionsBasicTest", function () { subscription.on("batch", (batch, callback) => { try { - batch.items.forEach(x => keys.push(x.id)); - batch.items.forEach(x => ages.push(x.rawResult.age)); + for (const x of batch.items) keys.push(x.id); + for (const x of batch.items) ages.push(x.rawResult.age); callback(); } catch (err) { callback(err); @@ -229,9 +229,9 @@ describe("SubscriptionsBasicTest", function () { } subscription.on("batch", (batch, callback) => { - batch.items.forEach(x => { + for (const x of batch.items) { orders.push(x.result); - }); + } callback(); }); @@ -271,9 +271,9 @@ describe("SubscriptionsBasicTest", function () { } subscription.on("batch", (batch, callback) => { - batch.items.forEach(x => { + for (const x of batch.items) { names.push(x.result.name); - }); + } callback(); }); @@ -593,7 +593,7 @@ describe("SubscriptionsBasicTest", function () { } subscription.on("batch", (batch, callback) => { - batch.items.forEach(i => docs.push(i.result)); + for (const i of batch.items) docs.push(i.result); callback(); }); @@ -665,7 +665,7 @@ describe("SubscriptionsBasicTest", function () { }); subscription.on("batch", (batch, callback) => { - batch.items.forEach(i => docs.push(i.result)); + for (const i of batch.items) docs.push(i.result); callback(getError("InvalidOperationException", "Fake exception")); }); @@ -700,7 +700,7 @@ describe("SubscriptionsBasicTest", function () { const docs = new AsyncQueue(); subscription.on("batch", (batch, callback) => { - batch.items.forEach(i => docs.push(i.result)); + for (const i of batch.items) docs.push(i.result); callback(); }); @@ -765,7 +765,7 @@ describe("SubscriptionsBasicTest", function () { } subscription.on("batch", (batch, callback) => { - batch.items.forEach(i => users.push(i.result)); + for (const i of batch.items) users.push(i.result); callback(); }); @@ -810,7 +810,7 @@ describe("SubscriptionsBasicTest", function () { }); const items1 = new AsyncQueue(); subscription1.on("batch", (batch, callback) => { - batch.items.forEach(i => items1.push(i.result)); + for (const i of batch.items) items1.push(i.result); callback(); }); @@ -820,7 +820,7 @@ describe("SubscriptionsBasicTest", function () { }); const items2 = new AsyncQueue(); subscription2.on("batch", (batch, callback) => { - batch.items.forEach(i => items2.push(i.result)); + for (const i of batch.items) items2.push(i.result); callback(); }); @@ -1416,7 +1416,7 @@ describe("SubscriptionsBasicTest", function () { try { subscription.on("batch", (batch, callback) => { - batch.items.forEach(x => keys.push(x.result.name)); + for (const x of batch.items) keys.push(x.result.name); callback(); }); diff --git a/test/Utils/AssertExtensions.ts b/test/Utils/AssertExtensions.ts index 504e2929..02c2fb50 100644 --- a/test/Utils/AssertExtensions.ts +++ b/test/Utils/AssertExtensions.ts @@ -133,32 +133,32 @@ export class JavaAssertionBuilder { } public allMatch(matcher: (v: any) => boolean) { - this._value.forEach(v => { + for (const v of this._value) { assert.ok(matcher(v)); - }); + } } public anyMatch(matcher: (v: any) => boolean) { let hasMatch = false; - this._value.forEach(v => { + for (const v of this._value) { if (matcher(v)) { hasMatch = true; } - }); + } assert.ok(hasMatch); } public anySatisfy(matcher: (v: any) => void) { let satisfy = false; - this._value.forEach(v => { + for (const v of this._value) { try { matcher(v); satisfy = true; - } catch (e) { + } catch { // ignore } - }); + } assert.ok(satisfy, "None of items satisfy condition"); return this; diff --git a/test/Utils/AsyncQueue.ts b/test/Utils/AsyncQueue.ts index fd595f16..927f8878 100644 --- a/test/Utils/AsyncQueue.ts +++ b/test/Utils/AsyncQueue.ts @@ -39,7 +39,7 @@ export class AsyncQueue { // we don't want to wait for value if (resolveToDelete) { - const index = this._promises.findIndex(x => x === resolveToDelete); + const index = this._promises.indexOf(resolveToDelete); if (index !== -1) { this._promises.splice(index, 1); } From e4dca0c663224a21c6a1bae466f856a4aa307278 Mon Sep 17 00:00:00 2001 From: Marcin Lewandowski Date: Sat, 6 Apr 2024 13:47:07 +0200 Subject: [PATCH 4/4] unicorn eslint --- .eslintrc.js | 28 ++++++- src/Auth/Certificate.ts | 10 ++- src/Documents/Attachments/index.ts | 1 + src/Documents/BulkInsertOperation.ts | 12 +-- src/Documents/Changes/ChangesObservable.ts | 18 +++-- src/Documents/Changes/DatabaseChanges.ts | 47 +++++++---- .../Batches/SingleNodeBatchCommand.ts | 1 + src/Documents/Commands/GetDocumentsCommand.ts | 4 +- .../Commands/MultiGet/GetResponse.ts | 6 +- src/Documents/Commands/QueryCommand.ts | 4 +- src/Documents/DocumentStore.ts | 8 +- src/Documents/DocumentStoreBase.ts | 6 +- .../Identity/GenerateEntityIdOnTheClient.ts | 2 +- src/Documents/Identity/HiloIdGenerator.ts | 4 +- .../Identity/MultiTypeHiLoIdGenerator.ts | 2 +- .../Indexes/AbstractIndexDefinitionBuilder.ts | 6 +- src/Documents/Indexes/AdditionalAssembly.ts | 2 +- .../AbstractCountersIndexCreationTask.ts | 2 +- src/Documents/Indexes/Spatial.ts | 12 +-- .../AbstractTimeSeriesIndexCreationTask.ts | 1 + .../Attachments/GetAttachmentOperation.ts | 2 +- .../CompareExchangeSessionValue.ts | 24 ++++-- .../Operations/GetOngoingTaskInfoOperation.ts | 27 ++++--- .../Indexes/SetIndexesLockOperation.ts | 2 +- .../Operations/OperationCompletionAwaiter.ts | 6 +- src/Documents/Operations/OperationExecutor.ts | 2 +- .../MoreLikeThisUsingAnyDocument.ts | 2 +- .../Queries/Spatial/SpatialCriteria.ts | 15 ++-- .../Queries/Spatial/SpatialCriteriaFactory.ts | 2 +- .../Session/AbstractDocumentQuery.ts | 19 +++-- src/Documents/Session/DocumentSession.ts | 18 +++-- src/Documents/Session/IDocumentSession.ts | 12 ++- .../InMemoryDocumentSessionOperations.ts | 15 ++-- .../Session/Loaders/IncludeBuilderBase.ts | 20 +++-- .../Session/Loaders/MultiLoaderWithInclude.ts | 2 +- .../Session/Operations/BatchOperation.ts | 57 ++++++++----- .../Lazy/LazyConditionalLoadOperation.ts | 6 +- .../Operations/Lazy/LazyRevisionOperation.ts | 15 ++-- .../Operations/Lazy/LazySessionOperations.ts | 1 + .../Session/Operations/MultiGetOperation.ts | 2 +- src/Documents/Session/SessionEvents.ts | 1 + .../Session/SessionTimeSeriesBase.ts | 10 +-- .../TimeSeries/TimeSeriesValuesHelper.ts | 2 +- .../TimeSeries/TypedTimeSeriesRollupEntry.ts | 2 +- src/Documents/Session/Tokens/FacetToken.ts | 30 ++++--- src/Documents/Session/Tokens/OrderByToken.ts | 9 ++- .../Session/Tokens/TimeSeriesIncludesToken.ts | 12 ++- src/Documents/Session/Tokens/WhereToken.ts | 81 ++++++++++++------- src/Documents/Smuggler/BackupUtils.ts | 1 + .../Subscriptions/DocumentSubscriptions.ts | 2 +- .../Subscriptions/SubscriptionWorker.ts | 63 ++++++++++----- src/Http/ClusterRequestExecutor.ts | 7 +- src/Http/HttpCache.ts | 2 +- src/Http/RavenCommand.ts | 4 +- src/Http/RavenCommandResponsePipeline.ts | 11 +-- src/Http/RequestExecutor.ts | 45 ++++++----- src/Http/ServerNode.ts | 12 +-- src/Mapping/Json/Conventions/index.ts | 6 +- src/Mapping/Json/Replacers.ts | 4 +- src/Mapping/JsonOperation.ts | 6 +- src/Mapping/ObjectMapper.ts | 9 ++- src/Primitives/CaseInsensitiveKeysMap.ts | 2 +- src/Primitives/CaseInsensitiveStringSet.ts | 2 +- src/Primitives/TimeValue.ts | 9 ++- .../Operations/GetDatabaseRecordOperation.ts | 4 +- .../Tcp/TcpConnectionHeaderMessage.ts | 12 ++- src/Types/readable-stream.ts | 2 + src/Utility/LogUtil.ts | 1 + src/Utility/Stopwatch.ts | 2 +- src/Utility/StreamUtil.ts | 2 +- src/Utility/StringUtil.ts | 6 +- src/Utility/TcpUtils.ts | 8 +- src/Utility/TimeUtil.ts | 14 ++-- src/index.ts | 9 +-- .../GetNextOperationIdCommandTests.ts | 2 +- .../Operations/IndexesOperationsTests.ts | 1 + .../IDocumentQueryCustomizationMethodsTest.ts | 3 +- test/Documents/ReadmeSamples.ts | 2 +- test/Executor/RequestExecutorTests.ts | 2 +- test/Issues/RDBC_501.ts | 2 +- test/Mapping/ObjectMapperTests.ts | 6 +- test/Mapping/StreamJsonTests.ts | 2 +- .../Attachments/AttachmentsSessionTest.ts | 2 +- test/Ported/BulkInsert/BulkInsertsTest.ts | 5 +- test/Ported/Cluster/ClusterOperationTest.ts | 10 ++- .../Core/Streaming/DocumentStreaming.ts | 4 +- test/Ported/Core/Streaming/QueryStreaming.ts | 12 +-- .../Ported/Counters/BulkInsertCountersTest.ts | 2 +- .../Ported/Counters/CountersSingleNodeTest.ts | 4 +- test/Ported/Counters/SessionCountersTest.ts | 6 +- test/Ported/CustomEntityName.ts | 2 +- test/Ported/DatabaseSettingsOperationTest.ts | 4 +- test/Ported/Faceted/AggregationTest.ts | 24 +++--- test/Ported/HiLoTest.ts | 14 ++-- test/Ported/HttpsTest.ts | 4 +- test/Ported/Indexing/JavaScriptIndexTest.ts | 10 ++- test/Ported/Issues/RavenDB_15076.ts | 4 +- test/Utils/AsyncQueue.ts | 2 +- 98 files changed, 582 insertions(+), 364 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 00edc862..3830c4dc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,8 +23,25 @@ module.exports = { "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/no-unused-vars": "off", - "unicorn/prefer-node-protocol": "error", + + "unicorn/no-unnecessary-polyfills": "off", + "unicorn/prefer-string-replace-all": "off", + "unicorn/import-style": "off", + "unicorn/prefer-module": "off", + "unicorn/prefer-type-error": "off", + "unicorn/prefer-event-target": "off", + "unicorn/no-array-callback-reference": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-object-from-entries": "off", + "unicorn/prefer-ternary": "off", + "unicorn/prefer-code-point": "off", + "unicorn/prefer-switch": "off", + "unicorn/no-typeof-undefined": "off", + "unicorn/no-new-array": "off", + "unicorn/prefer-string-slice": "off", "unicorn/prevent-abbreviations": "off", + "unicorn/no-negated-condition": "off", + "unicorn/no-for-loop": "off", "unicorn/filename-case": "off", "unicorn/no-null": "off", "unicorn/catch-error-name": "off", @@ -33,6 +50,13 @@ module.exports = { "unicorn/explicit-length-check": "off", "unicorn/numeric-separators-style": "off", "unicorn/no-await-expression-member": "off", - "unicorn/no-zero-fractions": "off" + "unicorn/no-zero-fractions": "off", + "unicorn/prefer-native-coercion-functions": "off", + "unicorn/no-array-method-this-argument": "off", + "unicorn/no-useless-undefined": "off", + "unicorn/no-array-reduce": "off", + "unicorn/better-regex": "off", + "unicorn/prefer-spread": "off", + "unicorn/consistent-function-scoping": "off", } } diff --git a/src/Auth/Certificate.ts b/src/Auth/Certificate.ts index 3a8dd2d9..0ad907c5 100644 --- a/src/Auth/Certificate.ts +++ b/src/Auth/Certificate.ts @@ -32,15 +32,17 @@ export abstract class Certificate implements ICertificate { } switch (options.type) { - case Certificate.PEM: + case Certificate.PEM: { certificate = this.createPem(options.certificate, options.password, options.ca); break; - case Certificate.PFX: - + } + case Certificate.PFX: { certificate = this.createPfx(options.certificate, options.password, options.ca); break; - default: + } + default: { throwError("InvalidArgumentException", "Unsupported authOptions type: " + options.type); + } } return certificate; diff --git a/src/Documents/Attachments/index.ts b/src/Documents/Attachments/index.ts index a6a0fef9..acad8cf5 100644 --- a/src/Documents/Attachments/index.ts +++ b/src/Documents/Attachments/index.ts @@ -29,6 +29,7 @@ export class AttachmentResult { public data: stream.Readable, public details: AttachmentDetails, private _response: HttpResponse) { + // empty } public dispose() { diff --git a/src/Documents/BulkInsertOperation.ts b/src/Documents/BulkInsertOperation.ts index 53fdf69a..d2ad6fc8 100644 --- a/src/Documents/BulkInsertOperation.ts +++ b/src/Documents/BulkInsertOperation.ts @@ -111,7 +111,7 @@ export class BulkInsertOperation { } private async sendHeartBeat(): Promise { - if (new Date().getTime() - this._lastWriteToStream.getTime() < this._heartbeatCheckInterval) { + if (Date.now() - this._lastWriteToStream.getTime() < this._heartbeatCheckInterval) { return; } @@ -133,10 +133,10 @@ export class BulkInsertOperation { private static _checkServerVersion(serverVersion: string): boolean { if (serverVersion) { const versionParsed = serverVersion.split("."); - const major = parseInt(versionParsed[0], 10); - const minor = versionParsed.length > 1 ? parseInt(versionParsed[1]) : 0; - const build = versionParsed.length> 2 ? parseInt(versionParsed[2]) : 0; - if (isNaN(major) || isNaN(minor)) { + const major = Number.parseInt(versionParsed[0], 10); + const minor = versionParsed.length > 1 ? Number.parseInt(versionParsed[1]) : 0; + const build = versionParsed.length> 2 ? Number.parseInt(versionParsed[2]) : 0; + if (Number.isNaN(major) || Number.isNaN(minor)) { return false; } @@ -169,7 +169,7 @@ export class BulkInsertOperation { let errorFromServer: Error; try { errorFromServer = await this._getExceptionFromOperation(); - } catch (ee) { + } catch { // server is probably down, will propagate the original exception } diff --git a/src/Documents/Changes/ChangesObservable.ts b/src/Documents/Changes/ChangesObservable.ts index 39b30347..c7a75e64 100644 --- a/src/Documents/Changes/ChangesObservable.ts +++ b/src/Documents/Changes/ChangesObservable.ts @@ -23,7 +23,7 @@ export class ChangesObservable void): this; public on(event: "data" | "error", handler: ((value: T) => void) | ((error: Error) => void)): this { switch (event) { - case "data": + case "data": { // since allow multiple subscriptions on single object we cant register it multiple times // to avoid duplicates in notification if (!this._sendHandler) { @@ -35,7 +35,8 @@ export class ChangesObservable void); this._connectionState.inc(); break; - case "error": + } + case "error": { if (!this._errorHandler) { // register shared error handler this._errorHandler = (ex: Error) => this.error(ex); @@ -44,6 +45,7 @@ export class ChangesObservable void); break; + } } return this; @@ -60,7 +62,7 @@ export class ChangesObservable void) | ((error: Error) => void)): this { switch (event) { - case "data": + case "data": { if (this._subscribers.delete(handler as (value: T) => void)) { this._connectionState.dec(); } @@ -72,13 +74,15 @@ export class ChangesObservable void); if (!this._errorSubscribers.size) { this._connectionState.removeOnError(this._errorHandler); this._errorHandler = undefined; } break; + } } return this; @@ -94,11 +98,13 @@ export class ChangesObservable x(msg)); + for (const x of this._subscribers) x(msg); } public error(e: Error): void { - this._errorSubscribers.forEach(x => x(e)); + for (const x of this._errorSubscribers) { + x(e); + } } public ensureSubscribedNow(): Promise { diff --git a/src/Documents/Changes/DatabaseChanges.ts b/src/Documents/Changes/DatabaseChanges.ts index c3df0407..b8599a7b 100644 --- a/src/Documents/Changes/DatabaseChanges.ts +++ b/src/Documents/Changes/DatabaseChanges.ts @@ -252,7 +252,7 @@ export class DatabaseChanges implements IDatabaseChanges { if (this.connected) { await this._send(unwatchCommand, value, values); } - } catch (e) { + } catch { // if we are not connected then we unsubscribed already // because connections drops with all subscriptions } @@ -476,24 +476,42 @@ export class DatabaseChanges implements IDatabaseChanges { private _notifySubscribers(type: string, value: any): void { switch (type) { - case "AggressiveCacheChange": - this._counters.forEach(state => state.send("AggressiveCache", AggressiveCacheChange.INSTANCE)); + case "AggressiveCacheChange": { + for (const state of this._counters.values()) { + state.send("AggressiveCache", AggressiveCacheChange.INSTANCE); + } break; - case "DocumentChange": - this._counters.forEach(state => state.send("Document", value)); + } + case "DocumentChange": { + for (const state of this._counters.values()) { + state.send("Document", value); + } break; - case "CounterChange": - this._counters.forEach(state => state.send("Counter", value)); + } + case "CounterChange": { + for (const state of this._counters.values()) { + state.send("Counter", value); + } break; - case "TimeSeriesChange": - this._counters.forEach(state => state.send("TimeSeries", value)); + } + case "TimeSeriesChange": { + for (const state of this._counters.values()) { + state.send("TimeSeries", value); + } break; - case "IndexChange": - this._counters.forEach(state => state.send("Index", value)); + } + case "IndexChange": { + for (const state of this._counters.values()) { + state.send("Index", value); + } break; - case "OperationStatusChange": - this._counters.forEach(state => state.send("Operation", value)); + } + case "OperationStatusChange": { + for (const state of this._counters.values()) { + state.send("Operation", value); + } break; + } case "TopologyChange": { const topologyChange = value as TopologyChange; const requestExecutor = this._requestExecutor; @@ -513,8 +531,9 @@ export class DatabaseChanges implements IDatabaseChanges { } break; } - default: + default: { throwError("NotSupportedException"); + } } } diff --git a/src/Documents/Commands/Batches/SingleNodeBatchCommand.ts b/src/Documents/Commands/Batches/SingleNodeBatchCommand.ts index 8da196e3..7a226574 100644 --- a/src/Documents/Commands/Batches/SingleNodeBatchCommand.ts +++ b/src/Documents/Commands/Batches/SingleNodeBatchCommand.ts @@ -194,5 +194,6 @@ export class SingleNodeBatchCommand extends RavenCommand imp // eslint-disable-next-line @typescript-eslint/no-empty-function public dispose(): void { + // empty } } diff --git a/src/Documents/Commands/GetDocumentsCommand.ts b/src/Documents/Commands/GetDocumentsCommand.ts index 13d9edf4..6d64fb9e 100644 --- a/src/Documents/Commands/GetDocumentsCommand.ts +++ b/src/Documents/Commands/GetDocumentsCommand.ts @@ -283,9 +283,9 @@ export class GetDocumentsCommand extends RavenCommand { let newUri = request.uri; if (isGet) { - uniqueIds.forEach(x => { + for (const x of uniqueIds) { newUri += `&id=${encodeURIComponent(x || "")}`; - }); + } return { method: "GET", uri: newUri }; } else { diff --git a/src/Documents/Commands/MultiGet/GetResponse.ts b/src/Documents/Commands/MultiGet/GetResponse.ts index 6a44ed92..cf87f842 100644 --- a/src/Documents/Commands/MultiGet/GetResponse.ts +++ b/src/Documents/Commands/MultiGet/GetResponse.ts @@ -90,10 +90,12 @@ export class GetResponse { case StatusCodes.NonAuthoritativeInformation: case StatusCodes.NoContent: case StatusCodes.NotModified: - case StatusCodes.NotFound: + case StatusCodes.NotFound: { return false; - default: + } + default: { return true; + } } } } diff --git a/src/Documents/Commands/QueryCommand.ts b/src/Documents/Commands/QueryCommand.ts index f022ce41..a231f51d 100644 --- a/src/Documents/Commands/QueryCommand.ts +++ b/src/Documents/Commands/QueryCommand.ts @@ -145,9 +145,9 @@ export class QueryCommand extends RavenCommand { mapped.durationInMs = timings.DurationInMs; mapped.timings = timings.Timings ? {} : undefined; if (timings.Timings) { - Object.keys(timings.Timings).forEach(time => { + for (const time of Object.keys(timings.Timings)) { mapped.timings[StringUtil.uncapitalize(time)] = QueryCommand._mapTimingsToLocalObject(timings.Timings[time]); - }); + } } return mapped; } diff --git a/src/Documents/DocumentStore.ts b/src/Documents/DocumentStore.ts index 211f5129..ae4a678d 100644 --- a/src/Documents/DocumentStore.ts +++ b/src/Documents/DocumentStore.ts @@ -104,7 +104,9 @@ export class DocumentStore extends DocumentStoreBase { value.Value.Dispose(); }*/ - this._databaseChanges.forEach(change => change.dispose()); + for (const change of this._databaseChanges.values()) { + change.dispose(); + } /* TODO // try to wait until all the async disposables are completed @@ -151,13 +153,13 @@ export class DocumentStore extends DocumentStoreBase { }) .then(() => { this._log.info(`Disposing request executors ${this._requestExecutors.size}`); - this._requestExecutors.forEach((executor, db) => { + for (const [db, executor] of this._requestExecutors.entries()) { try { executor.dispose(); } catch (err) { this._log.warn(err, `Error disposing request executor.`); } - }); + } }) .finally(() => this.emit("executorsDisposed")); } diff --git a/src/Documents/DocumentStoreBase.ts b/src/Documents/DocumentStoreBase.ts index d7c532c0..a79d09d4 100644 --- a/src/Documents/DocumentStoreBase.ts +++ b/src/Documents/DocumentStoreBase.ts @@ -320,7 +320,7 @@ export abstract class DocumentStoreBase ): void; public removeSessionListener(eventName: any, eventHandler: (eventArgs: any) => void): void { const toRemove = this._eventHandlers - .filter(x => x[0] === eventName && x[1] === eventHandler)[0]; + .find(x => x[0] === eventName && x[1] === eventHandler); if (toRemove) { this._eventHandlers.splice(this._eventHandlers.indexOf(toRemove), 1); } @@ -329,7 +329,7 @@ export abstract class DocumentStoreBase public registerEvents(requestExecutor: RequestExecutor): void; public registerEvents(session: DocumentSession): void; public registerEvents(requestExecutorOrSession: RequestExecutor | DocumentSession): void { - this._eventHandlers.forEach(([eventName, eventHandler]) => { + for (const [eventName, eventHandler] of this._eventHandlers) { if (eventName === "failedRequest" || eventName === "topologyUpdated" || eventName === "beforeRequest" @@ -338,7 +338,7 @@ export abstract class DocumentStoreBase } else { (requestExecutorOrSession as DocumentSession).on(eventName, eventHandler); } - }); + } } public abstract maintenance: MaintenanceOperationExecutor; diff --git a/src/Documents/Identity/GenerateEntityIdOnTheClient.ts b/src/Documents/Identity/GenerateEntityIdOnTheClient.ts index adf0b60f..46d08993 100644 --- a/src/Documents/Identity/GenerateEntityIdOnTheClient.ts +++ b/src/Documents/Identity/GenerateEntityIdOnTheClient.ts @@ -43,7 +43,7 @@ export class GenerateEntityIdOnTheClient { } resultCallback(null); return false; - } catch (e) { + } catch { throwError("InvalidOperationException", "Error trying to get ID from instance."); } } diff --git a/src/Documents/Identity/HiloIdGenerator.ts b/src/Documents/Identity/HiloIdGenerator.ts index 919ee973..118920af 100644 --- a/src/Documents/Identity/HiloIdGenerator.ts +++ b/src/Documents/Identity/HiloIdGenerator.ts @@ -71,7 +71,7 @@ export class HiloIdGenerator { if (range !== this._range) { continue; } - } catch (e) { + } catch { // previous task was faulted, we will try to replace it } @@ -91,7 +91,7 @@ export class HiloIdGenerator { try { // failed to replace, let's wait on the previous task await this._nextRangeTask.getValue(); - } catch (e) { + } catch { // previous task was faulted, we will try again } } diff --git a/src/Documents/Identity/MultiTypeHiLoIdGenerator.ts b/src/Documents/Identity/MultiTypeHiLoIdGenerator.ts index e754c843..1d550f6c 100644 --- a/src/Documents/Identity/MultiTypeHiLoIdGenerator.ts +++ b/src/Documents/Identity/MultiTypeHiLoIdGenerator.ts @@ -33,7 +33,7 @@ export class MultiTypeHiLoIdGenerator { : this._conventions.getCollectionNameForEntity(entity); if (!typeTagName) { - return Promise.resolve(null); + return null; } const tag = await this._conventions.transformClassCollectionNameToDocumentIdPrefix(typeTagName); diff --git a/src/Documents/Indexes/AbstractIndexDefinitionBuilder.ts b/src/Documents/Indexes/AbstractIndexDefinitionBuilder.ts index 8b2dfcd0..785ec399 100644 --- a/src/Documents/Indexes/AbstractIndexDefinitionBuilder.ts +++ b/src/Documents/Indexes/AbstractIndexDefinitionBuilder.ts @@ -60,9 +60,9 @@ export abstract class AbstractIndexDefinitionBuilder - Object.assign(result, { [item]: true }), {}); + const suggestions: { [suggestionOption: string]: boolean } = Object.fromEntries(Array.from(this.suggestionsOptions) + .map(( item) => + [item, true])); this._applyValues(indexDefinition, this.indexesStrings, (options, value) => options.indexing = value); diff --git a/src/Documents/Indexes/AdditionalAssembly.ts b/src/Documents/Indexes/AdditionalAssembly.ts index 4bc3fcde..73bb6b1e 100644 --- a/src/Documents/Indexes/AdditionalAssembly.ts +++ b/src/Documents/Indexes/AdditionalAssembly.ts @@ -11,8 +11,8 @@ export class AdditionalAssembly { public packageSourceUrl: string; public usings: string[]; - // eslint-disable-next-line @typescript-eslint/no-empty-function private constructor() { + // empty } public static onlyUsings(usings: string[]) { diff --git a/src/Documents/Indexes/Counters/AbstractCountersIndexCreationTask.ts b/src/Documents/Indexes/Counters/AbstractCountersIndexCreationTask.ts index 7c3af3f8..dc3721a3 100644 --- a/src/Documents/Indexes/Counters/AbstractCountersIndexCreationTask.ts +++ b/src/Documents/Indexes/Counters/AbstractCountersIndexCreationTask.ts @@ -4,5 +4,5 @@ import { AbstractCsharpCountersIndexCreationTask } from "./AbstractCsharpCounter * @deprecated Use AbstractCsharpCountersIndexCreationTask */ export abstract class AbstractCountersIndexCreationTask extends AbstractCsharpCountersIndexCreationTask { - + // empty } diff --git a/src/Documents/Indexes/Spatial.ts b/src/Documents/Indexes/Spatial.ts index b1bb3908..7faedbb1 100644 --- a/src/Documents/Indexes/Spatial.ts +++ b/src/Documents/Indexes/Spatial.ts @@ -98,13 +98,11 @@ export class GeographySpatialOptionsFactory { /** * Defines a Geohash Prefix Tree index using a default Max Tree Level {@link SpatialOptions} */ - public defaultOptions(circleRadiusUnits?: SpatialUnits): SpatialOptions { - circleRadiusUnits = circleRadiusUnits || "Kilometers"; + public defaultOptions(circleRadiusUnits: SpatialUnits = "Kilometers"): SpatialOptions { return this.geohashPrefixTreeIndex(0, circleRadiusUnits); } - public boundingBoxIndex(circleRadiusUnits?: SpatialUnits): SpatialOptions { - circleRadiusUnits = circleRadiusUnits || "Kilometers"; + public boundingBoxIndex(circleRadiusUnits: SpatialUnits = "Kilometers"): SpatialOptions { const ops = new SpatialOptions(); ops.type = "Geography"; ops.strategy = "BoundingBox"; @@ -112,8 +110,7 @@ export class GeographySpatialOptionsFactory { return ops; } - public geohashPrefixTreeIndex(maxTreeLevel: number, circleRadiusUnits?: SpatialUnits): SpatialOptions { - circleRadiusUnits = circleRadiusUnits || "Kilometers"; + public geohashPrefixTreeIndex(maxTreeLevel: number, circleRadiusUnits: SpatialUnits = "Kilometers"): SpatialOptions { if (maxTreeLevel === 0) { maxTreeLevel = DEFAULT_GEOHASH_LEVEL; } @@ -126,8 +123,7 @@ export class GeographySpatialOptionsFactory { return opts; } - public quadPrefixTreeIndex(maxTreeLevel: number, circleRadiusUnits: SpatialUnits): SpatialOptions { - circleRadiusUnits = circleRadiusUnits || "Kilometers"; + public quadPrefixTreeIndex(maxTreeLevel: number, circleRadiusUnits: SpatialUnits = "Kilometers"): SpatialOptions { if (maxTreeLevel === 0) { maxTreeLevel = DEFAULT_QUAD_TREE_LEVEL; } diff --git a/src/Documents/Indexes/TimeSeries/AbstractTimeSeriesIndexCreationTask.ts b/src/Documents/Indexes/TimeSeries/AbstractTimeSeriesIndexCreationTask.ts index 30b4ee47..106d7625 100644 --- a/src/Documents/Indexes/TimeSeries/AbstractTimeSeriesIndexCreationTask.ts +++ b/src/Documents/Indexes/TimeSeries/AbstractTimeSeriesIndexCreationTask.ts @@ -4,4 +4,5 @@ import { AbstractCsharpCountersIndexCreationTask } from "../Counters/AbstractCsh * @deprecated use AbstractCsharpCountersIndexCreationTask */ export abstract class AbstractTimeSeriesIndexCreationTask extends AbstractCsharpCountersIndexCreationTask { + // empty } diff --git a/src/Documents/Operations/Attachments/GetAttachmentOperation.ts b/src/Documents/Operations/Attachments/GetAttachmentOperation.ts index 56b0d03b..03fc7740 100644 --- a/src/Documents/Operations/Attachments/GetAttachmentOperation.ts +++ b/src/Documents/Operations/Attachments/GetAttachmentOperation.ts @@ -92,7 +92,7 @@ export class GetAttachmentCommand extends RavenCommand { let size = 0; const sizeHeader = response.headers.get("attachment-size") as string; if (sizeHeader) { - size = parseInt(sizeHeader, 10); + size = Number.parseInt(sizeHeader, 10); } const details: AttachmentDetails = { diff --git a/src/Documents/Operations/CompareExchange/CompareExchangeSessionValue.ts b/src/Documents/Operations/CompareExchange/CompareExchangeSessionValue.ts index b6a86bf5..ffe2d69e 100644 --- a/src/Documents/Operations/CompareExchange/CompareExchangeSessionValue.ts +++ b/src/Documents/Operations/CompareExchange/CompareExchangeSessionValue.ts @@ -73,10 +73,12 @@ export class CompareExchangeSessionValue { return value; } case "Missing": - case "Deleted": + case "Deleted": { return null; - default: + } + default: { throwError("NotSupportedException", "Not supported state: " + this._state); + } } } @@ -105,13 +107,16 @@ export class CompareExchangeSessionValue { private _assertState() { switch (this._state) { case "None": - case "Missing": + case "Missing": { return; - case "Created": + } + case "Created": { throwError("InvalidOperationException", "The compare exchange value with key '" + this._key + "' was already stored."); break; - case "Deleted": + } + case "Deleted": { throwError("InvalidOperationException", "The compare exchange value with key '" + this._key + "' was already deleted."); + } } } @@ -152,12 +157,15 @@ export class CompareExchangeSessionValue { return new PutCompareExchangeCommandData(newValue.key, entityToInsert, newValue.index); } - case "Deleted": + case "Deleted": { return new DeleteCompareExchangeCommandData(this._key, this._index); - case "Missing": + } + case "Missing": { return null; - default: + } + default: { throwError("InvalidOperationException", "Not supported state: " + this._state); + } } } diff --git a/src/Documents/Operations/GetOngoingTaskInfoOperation.ts b/src/Documents/Operations/GetOngoingTaskInfoOperation.ts index 38bd071b..545d7efc 100644 --- a/src/Documents/Operations/GetOngoingTaskInfoOperation.ts +++ b/src/Documents/Operations/GetOngoingTaskInfoOperation.ts @@ -84,48 +84,56 @@ class GetOngoingTaskInfoCommand extends RavenCommand { let nestedTypes: NestedTypes = {}; switch (this._type) { - case "Replication": + case "Replication": { // nothing to do break; - case "RavenEtl": + } + case "RavenEtl": { nestedTypes = { configuration: "RavenEtlConfiguration", "configuration.transforms": "Transformation" }; break; - case "SqlEtl": + } + case "SqlEtl": { nestedTypes = { configuration: "SqlEtlConfiguration", "configuration.transforms": "Transformation" }; break; - case "Subscription": + } + case "Subscription": { nestedTypes = { lastBatchAckTime: "date", lastClientConnectionTime: "date" } break; - case "OlapEtl": + } + case "OlapEtl": { nestedTypes = { configuration: "OlapEtlConfiguration", "configuration.transforms": "Transformation" } break; - case "ElasticSearchEtl": + } + case "ElasticSearchEtl": { nestedTypes = { configuration: "ElasticSearchEtlConfiguration", "configuration.transforms": "Transformation" } break; - case "QueueEtl": + } + case "QueueEtl": { nestedTypes = { configuration: "QueueEtlConfiguration", "configuration.transforms": "Transformation" } break; - case "PullReplicationAsSink": + } + case "PullReplicationAsSink": { break; - case "Backup": + } + case "Backup": { nestedTypes = { lastFullBackup: "date", delayUntil: "date", @@ -136,6 +144,7 @@ class GetOngoingTaskInfoCommand extends RavenCommand { "nextBackup.originalBackupTime": "date", } break; + } } this.result = this._reviveResultTypes( diff --git a/src/Documents/Operations/Indexes/SetIndexesLockOperation.ts b/src/Documents/Operations/Indexes/SetIndexesLockOperation.ts index 0db20b25..525e864f 100644 --- a/src/Documents/Operations/Indexes/SetIndexesLockOperation.ts +++ b/src/Documents/Operations/Indexes/SetIndexesLockOperation.ts @@ -44,7 +44,7 @@ export class SetIndexesLockOperation implements IMaintenanceOperation { private _filterAutoIndexes() { // Check for auto-indexes - we do not set lock for auto-indexes - if (this._parameters.indexNames.find(x => x.toLocaleLowerCase().startsWith("auto/"))) { + if (this._parameters.indexNames.some(x => x.toLocaleLowerCase().startsWith("auto/"))) { throwError("InvalidArgumentException", "Indexes list contains Auto-Indexes. " + "Lock Mode is not set for Auto-Indexes."); } diff --git a/src/Documents/Operations/OperationCompletionAwaiter.ts b/src/Documents/Operations/OperationCompletionAwaiter.ts index ad7b0328..8b3c7ab8 100644 --- a/src/Documents/Operations/OperationCompletionAwaiter.ts +++ b/src/Documents/Operations/OperationCompletionAwaiter.ts @@ -53,12 +53,14 @@ export class OperationCompletionAwaiter { .then((operationStatusResult) => { const operationStatus = operationStatusResult.status as OperationStatus; switch (operationStatus) { - case "Completed": + case "Completed": { return; - case "Canceled": + } + case "Canceled": { throwError("OperationCanceledException", `Operation of ID ${this._id} has been canceled.`); break; + } case "Faulted": { const faultResult: OperationExceptionResult = operationStatusResult.result; const errorSchema = Object.assign({}, faultResult, {url: this._requestExecutor.getUrl()}); diff --git a/src/Documents/Operations/OperationExecutor.ts b/src/Documents/Operations/OperationExecutor.ts index b8b01807..aebfead4 100644 --- a/src/Documents/Operations/OperationExecutor.ts +++ b/src/Documents/Operations/OperationExecutor.ts @@ -26,7 +26,7 @@ export class OperationExecutor { public constructor(store: IDocumentStore, databaseName?: string); public constructor(store: DocumentStoreBase, databaseName?: string) { this._store = store; - this._databaseName = databaseName ? databaseName : store.database; + this._databaseName = databaseName ?? store.database; if (!StringUtil.isNullOrWhitespace(this._databaseName)) { this._requestExecutor = store.getRequestExecutor(this._databaseName); } else { diff --git a/src/Documents/Queries/MoreLikeThis/MoreLikeThisUsingAnyDocument.ts b/src/Documents/Queries/MoreLikeThis/MoreLikeThisUsingAnyDocument.ts index 55074056..5fdb948b 100644 --- a/src/Documents/Queries/MoreLikeThis/MoreLikeThisUsingAnyDocument.ts +++ b/src/Documents/Queries/MoreLikeThis/MoreLikeThisUsingAnyDocument.ts @@ -1,5 +1,5 @@ import { MoreLikeThisBase } from "./MoreLikeThisBase"; export class MoreLikeThisUsingAnyDocument extends MoreLikeThisBase { - + // empty } diff --git a/src/Documents/Queries/Spatial/SpatialCriteria.ts b/src/Documents/Queries/Spatial/SpatialCriteria.ts index 1cd98ea6..bef7b281 100644 --- a/src/Documents/Queries/Spatial/SpatialCriteria.ts +++ b/src/Documents/Queries/Spatial/SpatialCriteria.ts @@ -23,20 +23,25 @@ export abstract class SpatialCriteria { let whereOperator: WhereOperator; switch (this._relation) { - case "Within": + case "Within": { whereOperator = "SpatialWithin"; break; - case "Contains": + } + case "Contains": { whereOperator = "SpatialContains"; break; - case "Disjoint": + } + case "Disjoint": { whereOperator = "SpatialDisjoint"; break; - case "Intersects": + } + case "Intersects": { whereOperator = "SpatialIntersects"; break; - default: + } + default: { throwError("InvalidArgumentException"); + } } return WhereToken.create(whereOperator, fieldName, null, new WhereOptions({ diff --git a/src/Documents/Queries/Spatial/SpatialCriteriaFactory.ts b/src/Documents/Queries/Spatial/SpatialCriteriaFactory.ts index 2b6750cf..764347ab 100644 --- a/src/Documents/Queries/Spatial/SpatialCriteriaFactory.ts +++ b/src/Documents/Queries/Spatial/SpatialCriteriaFactory.ts @@ -9,8 +9,8 @@ export class SpatialCriteriaFactory { public static INSTANCE = new SpatialCriteriaFactory(); - // eslint-disable-next-line @typescript-eslint/no-empty-function private constructor() { + // empty } public relatesToShape(shapeWkt: string, relation: SpatialRelation): SpatialCriteria; diff --git a/src/Documents/Session/AbstractDocumentQuery.ts b/src/Documents/Session/AbstractDocumentQuery.ts index 1f35b62e..aefebb61 100644 --- a/src/Documents/Session/AbstractDocumentQuery.ts +++ b/src/Documents/Session/AbstractDocumentQuery.ts @@ -567,7 +567,7 @@ export abstract class AbstractDocumentQuery x.alias === possibleAlias)) { + if (!queryData.loadTokens.some(x => x.alias === possibleAlias)) { return; } @@ -608,7 +608,7 @@ export abstract class AbstractDocumentQuery x instanceof FieldsToFetchToken)[0]; + .find(x => x instanceof FieldsToFetchToken); if (fetchToken) { const idx = this._selectTokens.indexOf(fetchToken); @@ -1993,20 +1993,25 @@ export abstract class AbstractDocumentQuery { + for (const key of Object.keys(oldPatch.patch.values)) { newVals[key] = oldPatch.patch.values[key]; - }); + } - Object.keys(patchRequest.values).forEach(key => { + for (const key of Object.keys(patchRequest.values)) { newVals[key] = patchRequest.values[key]; - }); + } const newPatchRequest = new PatchRequest(); newPatchRequest.script = newScript; @@ -856,7 +856,7 @@ export class DocumentSession extends InMemoryDocumentSessionOperations const response = responses[i]; const tempReqTime = response.headers[HEADERS.REQUEST_TIME]; response.elapsed = sw.elapsed; - const totalTime = tempReqTime ? parseInt(tempReqTime, 10) : 0; + const totalTime = tempReqTime ? Number.parseInt(tempReqTime, 10) : 0; const timeItem = { url: requests[i].urlAndQuery, duration: totalTime @@ -1174,17 +1174,19 @@ export class DocumentSession extends InMemoryDocumentSessionOperations await this.advanced.requestExecutor.execute(cmd); switch (cmd.statusCode) { - case StatusCodes.NotModified: + case StatusCodes.NotModified: { return { entity: null, // value not changed changeVector } - case StatusCodes.NotFound: + } + case StatusCodes.NotFound: { this.registerMissing(id); return { entity: null, changeVector: null // value is missing } + } } const documentInfo = DocumentInfo.getNewDocumentInfo(cmd.result.results[0]); diff --git a/src/Documents/Session/IDocumentSession.ts b/src/Documents/Session/IDocumentSession.ts index e78acf05..8e3962c6 100644 --- a/src/Documents/Session/IDocumentSession.ts +++ b/src/Documents/Session/IDocumentSession.ts @@ -100,17 +100,21 @@ export class SessionInfo { } switch (requestExecutor.conventions.readBalanceBehavior) { - case "None": + case "None": { result = await requestExecutor.getPreferredNode(); break; - case "RoundRobin": + } + case "RoundRobin": { result = await requestExecutor.getNodeBySessionId(this.getSessionId()); break; - case "FastestNode": + } + case "FastestNode": { result = await requestExecutor.getFastestNode(); break; - default: + } + default: { throwError("InvalidArgumentException", requestExecutor.conventions.readBalanceBehavior); + } } return result.currentNode; diff --git a/src/Documents/Session/InMemoryDocumentSessionOperations.ts b/src/Documents/Session/InMemoryDocumentSessionOperations.ts index e6c7c69e..752059bd 100644 --- a/src/Documents/Session/InMemoryDocumentSessionOperations.ts +++ b/src/Documents/Session/InMemoryDocumentSessionOperations.ts @@ -1240,13 +1240,13 @@ export abstract class InMemoryDocumentSessionOperations newValues.push(...newRange.entries); - localRange.entries.forEach(item => { + for (const item of localRange.entries) { if (item.timestamp.getTime() <= newRange.to.getTime()) { - return; + continue; } newValues.push(item); - }); + } localRange.entries = newValues; } @@ -1516,7 +1516,7 @@ export abstract class InMemoryDocumentSessionOperations for (const commandData of result.sessionCommands) { switch (commandData.type) { case "PUT": - case "DELETE": + case "DELETE": { if (commandData.changeVector) { throwError( "InvalidOperationException", @@ -1524,13 +1524,16 @@ export abstract class InMemoryDocumentSessionOperations + commandData.id + " is not supported when using a cluster transaction."); } break; + } case "CompareExchangeDELETE": - case "CompareExchangePUT": + case "CompareExchangePUT": { break; - default: + } + default: { throwError( "InvalidOperationException", "The command '" + commandData.type + "' is not supported in a cluster session."); + } } } } diff --git a/src/Documents/Session/Loaders/IncludeBuilderBase.ts b/src/Documents/Session/Loaders/IncludeBuilderBase.ts index 36732d50..a3ca478b 100644 --- a/src/Documents/Session/Loaders/IncludeBuilderBase.ts +++ b/src/Documents/Session/Loaders/IncludeBuilderBase.ts @@ -225,10 +225,11 @@ export class IncludeBuilderBase { private static _assertValidType(type: TimeSeriesRangeType, time: TimeValue): void { switch (type) { - case "None": + case "None": { throwError("InvalidArgumentException", "Time range type cannot be set to 'None' when time is specified."); break; - case "Last": + } + case "Last": { if (time) { if (time.value <= 0) { throwError("InvalidArgumentException", "Time range type cannot be set to 'Last' when time is negative or zero."); @@ -238,8 +239,10 @@ export class IncludeBuilderBase { } throwError("InvalidArgumentException", "Time range type cannot be set to 'Last' when time is not specified."); break; - default: + } + default: { throwError("NotSupportedException", "Not supported time range type: " + type); + } } } @@ -268,16 +271,19 @@ export class IncludeBuilderBase { private static _assertValidTypeAndCount(type: TimeSeriesRangeType, count: number): void { switch (type) { - case "None": + case "None": { throwError("InvalidArgumentException", "Time range type cannot be set to 'None' when count is specified."); break; - case "Last": + } + case "Last": { if (count <= 0) { throwError("InvalidArgumentException", "Count have to be positive."); } break; - default: + } + default: { throwError("NotSupportedException", "Not supported time range type: " + type); + } } } @@ -313,7 +319,7 @@ export class IncludeBuilderBase { throwError("InvalidArgumentException", "IIncludeBuilder: Cannot use 'includeAllTimeSeries' after using 'includeTimeSeries' or 'includeAllTimeSeries'."); } - if (hashSet2.find(x => x.name === TIME_SERIES.ALL)) { + if (hashSet2.some(x => x.name === TIME_SERIES.ALL)) { throwError("InvalidArgumentException", "IIncludeBuilder: Cannot use 'includeTimeSeries' or 'includeAllTimeSeries' after using 'includeAllTimeSeries'."); } } diff --git a/src/Documents/Session/Loaders/MultiLoaderWithInclude.ts b/src/Documents/Session/Loaders/MultiLoaderWithInclude.ts index 105ad8ea..6041b2e2 100644 --- a/src/Documents/Session/Loaders/MultiLoaderWithInclude.ts +++ b/src/Documents/Session/Loaders/MultiLoaderWithInclude.ts @@ -60,7 +60,7 @@ export class MultiLoaderWithInclude implements ILoaderWithInclude { }); return singleResult ? - Object.keys(results).map(x => results[x]).filter(x => x)[0] as TResult : + Object.keys(results).map(x => results[x]).find(x => x) as TResult : results; } diff --git a/src/Documents/Session/Operations/BatchOperation.ts b/src/Documents/Session/Operations/BatchOperation.ts index d7f5c0c0..a7ea45c2 100644 --- a/src/Documents/Session/Operations/BatchOperation.ts +++ b/src/Documents/Session/Operations/BatchOperation.ts @@ -91,23 +91,29 @@ export class BatchOperation { const type = getCommandType(batchResult); switch (type) { - case "PUT": + case "PUT": { this._handlePut(i, batchResult, false); break; - case "ForceRevisionCreation": + } + case "ForceRevisionCreation": { this._handleForceRevisionCreation(batchResult); break; - case "DELETE": + } + case "DELETE": { this._handleDelete(batchResult); break; - case "CompareExchangePUT": + } + case "CompareExchangePUT": { this._handleCompareExchangePut(batchResult); break; - case "CompareExchangeDELETE": + } + case "CompareExchangeDELETE": { this._handleCompareExchangeDelete(batchResult); break; - default: + } + default: { throwError("InvalidOperationException", `Command '${type}' is not supported.`); + } } } @@ -119,44 +125,57 @@ export class BatchOperation { const type = getCommandType(batchResult); switch (type) { - case "PUT": + case "PUT": { this._handlePut(i, batchResult, true); break; - case "DELETE": + } + case "DELETE": { this._handleDelete(batchResult); break; - case "PATCH": + } + case "PATCH": { this._handlePatch(batchResult); break; - case "AttachmentPUT": + } + case "AttachmentPUT": { this._handleAttachmentPut(batchResult); break; - case "AttachmentDELETE": + } + case "AttachmentDELETE": { this._handleAttachmentDelete(batchResult); break; - case "AttachmentMOVE": + } + case "AttachmentMOVE": { this._handleAttachmentMove(batchResult); break; - case "AttachmentCOPY": + } + case "AttachmentCOPY": { this._handleAttachmentCopy(batchResult); break; + } case "CompareExchangePUT": case "CompareExchangeDELETE": - case "ForceRevisionCreation": + case "ForceRevisionCreation": { break; - case "Counters": + } + case "Counters": { this._handleCounters(batchResult); break; + } case "TimeSeries": - case "TimeSeriesWithIncrements": + case "TimeSeriesWithIncrements": { //TODO: RavenDB-13474 add to time series cache break; - case "TimeSeriesCopy": + } + case "TimeSeriesCopy": { break; - case "BatchPATCH": + } + case "BatchPATCH": { break; - default: + } + default: { throwError("InvalidOperationException", `Command '${type}' is not supported.`); + } } } diff --git a/src/Documents/Session/Operations/Lazy/LazyConditionalLoadOperation.ts b/src/Documents/Session/Operations/Lazy/LazyConditionalLoadOperation.ts index 464a0ec1..95edcc4d 100644 --- a/src/Documents/Session/Operations/Lazy/LazyConditionalLoadOperation.ts +++ b/src/Documents/Session/Operations/Lazy/LazyConditionalLoadOperation.ts @@ -59,19 +59,21 @@ export class LazyConditionalLoadOperation implements ILazyOper } switch (response.statusCode) { - case StatusCodes.NotModified: + case StatusCodes.NotModified: { this._result = { entity: null, changeVector: this._changeVector } as ConditionalLoadResult; return; - case StatusCodes.NotFound: + } + case StatusCodes.NotFound: { this._session.registerMissing(this._id); this._result = { entity: null, changeVector: null } as ConditionalLoadResult; return; + } } if (response.result) { diff --git a/src/Documents/Session/Operations/Lazy/LazyRevisionOperation.ts b/src/Documents/Session/Operations/Lazy/LazyRevisionOperation.ts index ef208684..0bd6eec2 100644 --- a/src/Documents/Session/Operations/Lazy/LazyRevisionOperation.ts +++ b/src/Documents/Session/Operations/Lazy/LazyRevisionOperation.ts @@ -74,20 +74,25 @@ export class LazyRevisionOperation implements ILazyOperation { this._getRevisionOperation.result = jsonArrayResult; switch (this._mode) { - case "Single": + case "Single": { this._result = this._getRevisionOperation.getRevision(this._clazz); break; - case "Multi": + } + case "Multi": { this._result = this._getRevisionOperation.getRevisionsFor(this._clazz); break; - case "Map": + } + case "Map": { this._result = this._getRevisionOperation.getRevisions(this._clazz); break; - case "ListOfMetadata": + } + case "ListOfMetadata": { this._result = this._getRevisionOperation.getRevisionsMetadataFor(); break; - default: + } + default: { throwError("InvalidArgumentException", "Invalid mode: " + this._mode); + } } } } diff --git a/src/Documents/Session/Operations/Lazy/LazySessionOperations.ts b/src/Documents/Session/Operations/Lazy/LazySessionOperations.ts index e13136bd..145a0dc7 100644 --- a/src/Documents/Session/Operations/Lazy/LazySessionOperations.ts +++ b/src/Documents/Session/Operations/Lazy/LazySessionOperations.ts @@ -57,6 +57,7 @@ export class LazySessionOperations implements ILazySessionOperations { idPrefix: string, opts?: SessionLoadStartingWithOptions): Lazy> { + // eslint-disable-next-line unicorn/prefer-default-parameters opts = opts || null; opts = Object.assign({}, LoadStartingWithOperation.DEFAULT, opts); const operation = new LazyStartsWithOperation(idPrefix, opts, this._delegate); diff --git a/src/Documents/Session/Operations/MultiGetOperation.ts b/src/Documents/Session/Operations/MultiGetOperation.ts index a5184dd4..c534a62c 100644 --- a/src/Documents/Session/Operations/MultiGetOperation.ts +++ b/src/Documents/Session/Operations/MultiGetOperation.ts @@ -14,7 +14,7 @@ export class MultiGetOperation { this._session.requestExecutor, this._session.conventions, requests, this._session.sessionInfo); } - // eslint-disable-next-line @typescript-eslint/no-empty-function public setResult(result: object): void { + // empty } } diff --git a/src/Documents/Session/SessionEvents.ts b/src/Documents/Session/SessionEvents.ts index 1053692b..bfee2678 100644 --- a/src/Documents/Session/SessionEvents.ts +++ b/src/Documents/Session/SessionEvents.ts @@ -96,6 +96,7 @@ export class SessionBeforeQueryEventArgs { constructor( public session: InMemoryDocumentSessionOperations, public queryCustomization: IDocumentQueryCustomization) { + // empty } } diff --git a/src/Documents/Session/SessionTimeSeriesBase.ts b/src/Documents/Session/SessionTimeSeriesBase.ts index 14fbae2f..495a2205 100644 --- a/src/Documents/Session/SessionTimeSeriesBase.ts +++ b/src/Documents/Session/SessionTimeSeriesBase.ts @@ -172,7 +172,7 @@ export class SessionTimeSeriesBase { const metadataTimeSeries = document.metadata[CONSTANTS.Documents.Metadata.TIME_SERIES] as string[]; if (metadataTimeSeries && TypeUtil.isArray(metadataTimeSeries)) { - if (!metadataTimeSeries.find(x => StringUtil.equalsIgnoreCase(x, this.name))) { + if (!metadataTimeSeries.some(x => StringUtil.equalsIgnoreCase(x, this.name))) { // the document is loaded in the session, but the metadata says that there is no such timeseries return []; } @@ -352,11 +352,11 @@ export class SessionTimeSeriesBase { if (fromDates.length) { from = fromDates[0].date; - fromDates.forEach(d => { + for (const d of fromDates) { if (DatesComparator.compare(d, leftDate(from)) < 0) { from = d.date; } - }); + } } else { from = null; } @@ -366,11 +366,11 @@ export class SessionTimeSeriesBase { if (toDates.length) { to = toDates[0].date; - toDates.forEach(d => { + for (const d of toDates) { if (DatesComparator.compare(d, rightDate(to)) > 0) { to = d.date; } - }) + } } else { to = null; } diff --git a/src/Documents/Session/TimeSeries/TimeSeriesValuesHelper.ts b/src/Documents/Session/TimeSeries/TimeSeriesValuesHelper.ts index 778ab575..4cd3247f 100644 --- a/src/Documents/Session/TimeSeries/TimeSeriesValuesHelper.ts +++ b/src/Documents/Session/TimeSeries/TimeSeriesValuesHelper.ts @@ -33,7 +33,7 @@ export class TimeSeriesValuesHelper { throwError("InvalidOperationException", "Invalid field mapping. Expected string or { field: string, name: string } object. Got: " + value); } - const nameAlreadyUsed = !!mapping.find(x => x.field === field || x.name === name); + const nameAlreadyUsed = mapping.some(x => x.field === field || x.name === name); if (nameAlreadyUsed) { throwError("InvalidOperationException", "All fields and names must be unique."); } diff --git a/src/Documents/Session/TimeSeries/TypedTimeSeriesRollupEntry.ts b/src/Documents/Session/TimeSeries/TypedTimeSeriesRollupEntry.ts index b8aebf4d..4973e8bc 100644 --- a/src/Documents/Session/TimeSeries/TypedTimeSeriesRollupEntry.ts +++ b/src/Documents/Session/TimeSeries/TypedTimeSeriesRollupEntry.ts @@ -90,7 +90,7 @@ export class TypedTimeSeriesRollupEntry { for (let i = 0; i < valuesCount; i++) { if (!counts[i]) { - averages[i] = NaN; + averages[i] = Number.NaN; } else { averages[i] = sums[i] / counts[i]; } diff --git a/src/Documents/Session/Tokens/FacetToken.ts b/src/Documents/Session/Tokens/FacetToken.ts index a66dc4da..78b12196 100644 --- a/src/Documents/Session/Tokens/FacetToken.ts +++ b/src/Documents/Session/Tokens/FacetToken.ts @@ -173,20 +173,25 @@ export class FacetToken extends QueryToken { for (const value of aggregationValue) { let aggregationToken: FacetAggregationToken; switch (aggregationKey) { - case "Max": + case "Max": { aggregationToken = FacetAggregationToken.max(value.name, value.displayName); break; - case "Min": + } + case "Min": { aggregationToken = FacetAggregationToken.min(value.name, value.displayName); break; - case "Average": + } + case "Average": { aggregationToken = FacetAggregationToken.average(value.name, value.displayName); break; - case "Sum": + } + case "Sum": { aggregationToken = FacetAggregationToken.sum(value.name, value.displayName); break; - default : + } + default : { throwError("NotImplementedException", "Unsupported aggregation method: " + aggregationKey); + } } token._aggregations.push(aggregationToken); @@ -218,32 +223,37 @@ export class FacetAggregationToken extends QueryToken { public writeTo(writer: StringBuilder): void { switch (this._aggregation) { - case "Max": + case "Max": { writer .append("max(") .append(this._fieldName) .append(")"); break; - case "Min": + } + case "Min": { writer .append("min(") .append(this._fieldName) .append(")"); break; - case "Average": + } + case "Average": { writer .append("avg(") .append(this._fieldName) .append(")"); break; - case "Sum": + } + case "Sum": { writer .append("sum(") .append(this._fieldName) .append(")"); break; - default: + } + default: { throwError("InvalidArgumentException", "Invalid aggregation mode: " + this._aggregation); + } } if (StringUtil.isNullOrWhitespace(this._fieldDisplayName)) { diff --git a/src/Documents/Session/Tokens/OrderByToken.ts b/src/Documents/Session/Tokens/OrderByToken.ts index 8cc99b1f..ddff9920 100644 --- a/src/Documents/Session/Tokens/OrderByToken.ts +++ b/src/Documents/Session/Tokens/OrderByToken.ts @@ -115,15 +115,18 @@ export class OrderByToken extends QueryToken { .append("')"); } else { switch (this._ordering) { - case "Long": + case "Long": { writer.append(" as long"); break; - case "Double": + } + case "Double": { writer.append(" as double"); break; - case "AlphaNumeric": + } + case "AlphaNumeric": { writer.append(" as alphaNumeric"); break; + } } } diff --git a/src/Documents/Session/Tokens/TimeSeriesIncludesToken.ts b/src/Documents/Session/Tokens/TimeSeriesIncludesToken.ts index 9e6382a7..4e48f0d7 100644 --- a/src/Documents/Session/Tokens/TimeSeriesIncludesToken.ts +++ b/src/Documents/Session/Tokens/TimeSeriesIncludesToken.ts @@ -63,12 +63,14 @@ export class TimeSeriesIncludesToken extends QueryToken { private static _writeTimeRangeTo(writer: StringBuilder, range: TimeSeriesTimeRange) { switch (range.type) { - case "Last": + case "Last": { writer .append("last("); break; - default: + } + default: { throwError("InvalidArgumentException", "Not supported time range type: " + range.type); + } } writer @@ -80,12 +82,14 @@ export class TimeSeriesIncludesToken extends QueryToken { private static _writeCountRangeTo(writer: StringBuilder, range: TimeSeriesCountRange) { switch (range.type) { - case "Last": + case "Last": { writer .append("last("); break; - default: + } + default: { throwError("InvalidArgumentException", "Not supported time range type: " + range.type); + } } writer diff --git a/src/Documents/Session/Tokens/WhereToken.ts b/src/Documents/Session/Tokens/WhereToken.ts index 0b65b37c..026c8058 100644 --- a/src/Documents/Session/Tokens/WhereToken.ts +++ b/src/Documents/Session/Tokens/WhereToken.ts @@ -131,12 +131,14 @@ export class WhereToken extends QueryToken { private _writeMethod(writer): boolean { if (this.options.method) { switch (this.options.method.methodType) { - case "CmpXchg": + case "CmpXchg": { writer.append("cmpxchg("); break; - default: + } + default: { throwError("InvalidArgumentException", "Unsupported method: " + this.options.method.methodType); + } } let first: boolean = true; @@ -178,36 +180,46 @@ export class WhereToken extends QueryToken { } switch (this.whereOperator) { - case "Search": + case "Search": { writer.append("search("); break; - case "Lucene": + } + case "Lucene": { writer.append("lucene("); break; - case "StartsWith": + } + case "StartsWith": { writer.append("startsWith("); break; - case "EndsWith": + } + case "EndsWith": { writer.append("endsWith("); break; - case "Exists": + } + case "Exists": { writer.append("exists("); break; - case "SpatialWithin": + } + case "SpatialWithin": { writer.append("spatial.within("); break; - case "SpatialContains": + } + case "SpatialContains": { writer.append("spatial.contains("); break; - case "SpatialDisjoint": + } + case "SpatialDisjoint": { writer.append("spatial.disjoint("); break; - case "SpatialIntersects": + } + case "SpatialIntersects": { writer.append("spatial.intersects("); break; - case "Regex": + } + case "Regex": { writer.append("regex("); break; + } } this._writeInnerWhere(writer); @@ -242,32 +254,39 @@ export class WhereToken extends QueryToken { QueryToken.writeField(writer, this.fieldName); switch (this.whereOperator) { - case "Equals": + case "Equals": { writer.append(" = "); break; + } - case "NotEquals": + case "NotEquals": { writer.append(" != "); break; - case "GreaterThan": + } + case "GreaterThan": { writer .append(" > "); break; - case "GreaterThanOrEqual": + } + case "GreaterThanOrEqual": { writer .append(" >= "); break; - case "LessThan": + } + case "LessThan": { writer .append(" < "); break; - case "LessThanOrEqual": + } + case "LessThanOrEqual": { writer .append(" <= "); break; - default: + } + default: { this._specialOperator(writer); return; + } } if (!this._writeMethod(writer)) { @@ -277,27 +296,30 @@ export class WhereToken extends QueryToken { private _specialOperator(writer): void { switch (this.whereOperator) { - case "In": + case "In": { writer .append(" in ($") .append(this.parameterName) .append(")"); break; - case "AllIn": + } + case "AllIn": { writer .append(" all in ($") .append(this.parameterName) .append(")"); break; - case "Between": + } + case "Between": { writer .append(" between $") .append(this.options.fromParameterName) .append(" and $") .append(this.options.toParameterName); break; + } - case "Search": + case "Search": { writer .append(", $") .append(this.parameterName); @@ -306,23 +328,26 @@ export class WhereToken extends QueryToken { } writer.append(")"); break; + } case "Lucene": case "StartsWith": case "EndsWith": - case "Regex": + case "Regex": { writer .append(", $") .append(this.parameterName) .append(")"); break; - case "Exists": + } + case "Exists": { writer .append(")"); break; + } case "SpatialWithin": case "SpatialContains": case "SpatialDisjoint": - case "SpatialIntersects": + case "SpatialIntersects": { writer .append(", "); this.options.whereShape.writeTo(writer); @@ -334,8 +359,10 @@ export class WhereToken extends QueryToken { writer .append(")"); break; - default: + } + default: { throwError("InvalidArgumentException"); + } } } } diff --git a/src/Documents/Smuggler/BackupUtils.ts b/src/Documents/Smuggler/BackupUtils.ts index 199ea5f1..f23c3524 100644 --- a/src/Documents/Smuggler/BackupUtils.ts +++ b/src/Documents/Smuggler/BackupUtils.ts @@ -6,6 +6,7 @@ import * as fs from "node:fs"; export class BackupUtils { // eslint-disable-next-line @typescript-eslint/no-empty-function private constructor() { + // empty } private static readonly LEGACY_INCREMENTAL_BACKUP_EXTENSION = ".ravendb-incremental-dump"; diff --git a/src/Documents/Subscriptions/DocumentSubscriptions.ts b/src/Documents/Subscriptions/DocumentSubscriptions.ts index d0ddcdcd..136d9a74 100644 --- a/src/Documents/Subscriptions/DocumentSubscriptions.ts +++ b/src/Documents/Subscriptions/DocumentSubscriptions.ts @@ -412,7 +412,7 @@ export class DocumentSubscriptions implements IDisposable { return; } - this._subscriptions.forEach(((value, key) => key.dispose())); + for (const [key, value] of this._subscriptions.entries()) key.dispose(); } public async dropSubscriptionWorker(worker: SubscriptionWorker, database: string = null) { diff --git a/src/Documents/Subscriptions/SubscriptionWorker.ts b/src/Documents/Subscriptions/SubscriptionWorker.ts index c8f8d04c..d4bec1e0 100644 --- a/src/Documents/Subscriptions/SubscriptionWorker.ts +++ b/src/Documents/Subscriptions/SubscriptionWorker.ts @@ -297,16 +297,18 @@ export class SubscriptionWorker implements IDisposable { this._ensureParser(socket); const x: any = await this._readNextObject(); switch (x.status) { - case "Ok": + case "Ok": { return { version: x.version, licensedFeatures: x.licensedFeatures } - case "AuthorizationFailed": + } + case "AuthorizationFailed": { throwError("AuthorizationException", "Cannot access database " + this._dbName + " because " + x.message); return; - case "TcpVersionMismatch": + } + case "TcpVersionMismatch": { if (x.version !== OUT_OF_RANGE_STATUS) { return { version: x.version, @@ -319,8 +321,10 @@ export class SubscriptionWorker implements IDisposable { throwError("InvalidOperationException", "Can't connect to database " + this._dbName + " because: " + x.message); break; - case "InvalidNetworkTopology": + } + case "InvalidNetworkTopology": { throwError("InvalidNetworkTopologyException", "Failed to connect to url " + url + " because " + x.message); + } } return { @@ -366,14 +370,16 @@ export class SubscriptionWorker implements IDisposable { // noinspection FallThroughInSwitchStatementJS switch (connectionStatus.status) { - case "Accepted": + case "Accepted": { break; - case "InUse": + } + case "InUse": { throwError("SubscriptionInUseException", "Subscription with id '" + this._options.subscriptionName + "' cannot be opened, because it's in use and the connection strategy is " + this._options.strategy); break; + } case "Closed": { const canReconnect = connectionStatus.data.CanReconnect || false; const subscriptionClosedError = getError("SubscriptionClosedException", @@ -382,16 +388,18 @@ export class SubscriptionWorker implements IDisposable { (subscriptionClosedError as any).canReconnect = canReconnect; throw subscriptionClosedError; } - case "Invalid": + case "Invalid": { throwError("SubscriptionInvalidStateException", "Subscription with id '" + this._options.subscriptionName + "' cannot be opened, because it is in invalid state. " + connectionStatus.exception); break; - case "NotFound": + } + case "NotFound": { throwError("SubscriptionDoesNotExistException", "Subscription with id '" + this._options.subscriptionName + "' cannot be opened, because it does not exist. " + connectionStatus.exception); break; + } case "Redirect": { if (this._options.strategy === "WaitForFree") { if (connectionStatus.data) { @@ -414,13 +422,15 @@ export class SubscriptionWorker implements IDisposable { (error as any).appropriateNode = appropriateNode; throw error; } - case "ConcurrencyReconnect": + case "ConcurrencyReconnect": { throwError("SubscriptionChangeVectorUpdateConcurrencyException", connectionStatus.message); break; - default: + } + default: { throwError("InvalidOperationException", "Subscription '" + this._options.subscriptionName + "' could not be opened, reason: " + connectionStatus.status); + } } } @@ -528,7 +538,7 @@ export class SubscriptionWorker implements IDisposable { } finally { try { await wrapWithTimeout(notifiedSubscriber, 15_000); - } catch (e) { + } catch { // ignore } } @@ -566,36 +576,45 @@ export class SubscriptionWorker implements IDisposable { } switch (receivedMessage.type) { - case "Data": + case "Data": { incomingBatch.push(receivedMessage); break; - case "Includes": + } + case "Includes": { includes.push(receivedMessage.includes); break; - case "CounterIncludes": + } + case "CounterIncludes": { counterIncludes.push({ counterIncludes: receivedMessage.includedCounterNames, includes: receivedMessage.counterIncludes }); break; - case "TimeSeriesIncludes": + } + case "TimeSeriesIncludes": { timeSeriesIncludes.push(receivedMessage.timeSeriesIncludes); break; - case "EndOfBatch": + } + case "EndOfBatch": { endOfBatch = true; break; - case "Confirm": + } + case "Confirm": { this._emitter.emit("afterAcknowledgment", batch); incomingBatch.length = 0; batch.items.length = 0; break; - case "ConnectionStatus": + } + case "ConnectionStatus": { this._assertConnectionState(receivedMessage); break; - case "Error": + } + case "Error": { this._throwSubscriptionError(receivedMessage); break; - default: + } + default: { this._throwInvalidServerResponse(receivedMessage); break; + } } } @@ -703,7 +722,7 @@ export class SubscriptionWorker implements IDisposable { this._redirectNode = indexAndNode.currentNode; this._logger.info("Subscription " + this._options.subscriptionName + ". Will modify redirect node from null to " + this._redirectNode.clusterTag); - } catch (e) { + } catch { // will let topology to decide this._logger.info("Subscription '" + this._options.subscriptionName + "'. Could not select the redirect node will keep it null."); } @@ -730,7 +749,7 @@ export class SubscriptionWorker implements IDisposable { } const maxErroneousPeriod = this._options.maxErroneousPeriod; - const erroneousPeriodDuration = new Date().getTime() - this._lastConnectionFailure.getTime(); + const erroneousPeriodDuration = Date.now() - this._lastConnectionFailure.getTime(); if (erroneousPeriodDuration > maxErroneousPeriod) { throwError("SubscriptionInvalidStateException", "Subscription connection was in invalid state for more than " diff --git a/src/Http/ClusterRequestExecutor.ts b/src/Http/ClusterRequestExecutor.ts index 6ea693c7..281f9eaf 100644 --- a/src/Http/ClusterRequestExecutor.ts +++ b/src/Http/ClusterRequestExecutor.ts @@ -86,7 +86,7 @@ export class ClusterRequestExecutor extends RequestExecutor { const executor = new ClusterRequestExecutor( authOptions, - documentConventions ? documentConventions : DocumentConventions.defaultConventions); + documentConventions ?? DocumentConventions.defaultConventions); executor._disableClientConfigurationUpdates = true; executor.firstTopologyUpdatePromise = executor._firstTopologyUpdate(initialUrls, null); @@ -104,11 +104,11 @@ export class ClusterRequestExecutor extends RequestExecutor { public async updateTopology(parameters: UpdateTopologyParameters): Promise { if (this._disposed) { - return Promise.resolve(false); + return false; } if (this._disableTopologyUpdates) { - return Promise.resolve(false); + return false; } const acquiredSemContext = acquireSemaphore(this._clusterTopologySemaphore, { timeout: parameters.timeoutInMs }); @@ -159,6 +159,7 @@ export class ClusterRequestExecutor extends RequestExecutor { public dispose(): void { // eslint-disable-next-line @typescript-eslint/no-empty-function this._clusterTopologySemaphore.take(() => { + // empty }); super.dispose(); } diff --git a/src/Http/HttpCache.ts b/src/Http/HttpCache.ts index 98eb7435..d0debadb 100644 --- a/src/Http/HttpCache.ts +++ b/src/Http/HttpCache.ts @@ -100,7 +100,7 @@ export class ReleaseCacheItem { return Number.MAX_VALUE; } - return new Date().valueOf() - this.item.lastServerUpdate.valueOf(); + return Date.now() - this.item.lastServerUpdate.valueOf(); } public get mightHaveBeenModified() { diff --git a/src/Http/RavenCommand.ts b/src/Http/RavenCommand.ts index 9b3c7675..be0d7af5 100644 --- a/src/Http/RavenCommand.ts +++ b/src/Http/RavenCommand.ts @@ -203,7 +203,7 @@ export abstract class RavenCommand { try { if (this._responseType === "Object") { - const contentLength: number = parseInt(response.headers.get("content-length"), 10); + const contentLength: number = Number.parseInt(response.headers.get("content-length"), 10); if (contentLength === 0) { closeHttpResponse(response); return "Automatic"; @@ -284,8 +284,8 @@ export abstract class RavenCommand { throwError("InvalidOperationException", "Response is invalid: " + cause.message, cause); } - // eslint-disable-next-line @typescript-eslint/no-empty-function public onResponseFailure(response: HttpResponse): void { + // empty } protected _pipeline() { diff --git a/src/Http/RavenCommandResponsePipeline.ts b/src/Http/RavenCommandResponsePipeline.ts index c5f5f7e6..0b45100d 100644 --- a/src/Http/RavenCommandResponsePipeline.ts +++ b/src/Http/RavenCommandResponsePipeline.ts @@ -104,12 +104,9 @@ export class RavenCommandResponsePipeline extends EventEmitter { "Cannot use key case transform without doing parseJson() or parseJsonAsync() first."); } - if (!optsOrTransform || typeof optsOrTransform === "string") { - this._opts.streamKeyCaseTransform = - getObjectKeyCaseTransformProfile(optsOrTransform as CasingConvention, profile); - } else { - this._opts.streamKeyCaseTransform = optsOrTransform; - } + this._opts.streamKeyCaseTransform = !optsOrTransform || typeof optsOrTransform === "string" + ? getObjectKeyCaseTransformProfile(optsOrTransform as CasingConvention, profile) + : optsOrTransform; if (this._opts.jsonAsync) { this._opts.streamKeyCaseTransform.handleKeyValue = true; @@ -185,7 +182,7 @@ export class RavenCommandResponsePipeline extends EventEmitter { flush(callback) { let str = null; try { - str = Buffer.concat(bytesChunks).toString('utf-8'); + str = Buffer.concat(bytesChunks).toString("utf8"); } catch(err){ callback( getError("InvalidDataException", `Failed to concat / decode server response`, err)); diff --git a/src/Http/RequestExecutor.ts b/src/Http/RequestExecutor.ts index 130e83a7..af0cb5dc 100644 --- a/src/Http/RequestExecutor.ts +++ b/src/Http/RequestExecutor.ts @@ -664,14 +664,18 @@ export class RequestExecutor implements IDisposable { } switch (this.conventions.readBalanceBehavior) { - case "None": + case "None": { return this._nodeSelector.getPreferredNode(); - case "RoundRobin": + } + case "RoundRobin": { return this._nodeSelector.getNodeBySessionId(sessionInfo ? sessionInfo.getSessionId() : 0); - case "FastestNode": + } + case "FastestNode": { return this._nodeSelector.getFastestNode(); - default: + } + default: { throwError("NotSupportedException", `Invalid read balance behavior: ${this.conventions.readBalanceBehavior}`); + } } } @@ -884,7 +888,7 @@ export class RequestExecutor implements IDisposable { } public static validateUrls(initialUrls: string[], authOptions: IAuthOptions) { - const cleanUrls = [...Array(initialUrls.length)]; + const cleanUrls = new Array(initialUrls.length); let requireHttps = !!authOptions?.certificate; for (let index = 0; index < initialUrls.length; index++) { const url = initialUrls[index]; @@ -923,12 +927,8 @@ export class RequestExecutor implements IDisposable { this._log.info("Initialize update topology timer."); const minInMs = 60 * 1000; - // eslint-disable-next-line @typescript-eslint/no-this-alias - const that = this; this._updateTopologyTimer = - new Timer(function timerActionUpdateTopology() { - return that._updateTopologyCallback(); - }, minInMs, minInMs); + new Timer(() => this._updateTopologyCallback(), minInMs, minInMs); } private async _executeOnSpecificNode( // this method is called `execute` in c# and java code @@ -1327,7 +1327,7 @@ export class RequestExecutor implements IDisposable { .then(commandResult => new IndexAndResponse(taskNumber, commandResult.response, commandResult.bodyStream)) .catch(err => { tasks[taskNumber] = null; - return Promise.reject(err); + throw err; }); if (nodes[i].clusterTag === chosenNode.clusterTag) { @@ -1437,19 +1437,23 @@ export class RequestExecutor implements IDisposable { responseBodyStream.resume(); const readBody = () => StreamUtil.readToEnd(responseBodyStream); switch (response.status) { - case StatusCodes.NotFound: + case StatusCodes.NotFound: { this._cache.setNotFound(url); switch (command.responseType) { - case "Empty": - return Promise.resolve(true); - case "Object": + case "Empty": { + return true; + } + case "Object": { return command.setResponseAsync(null, false) .then(() => true); - default: + } + default: { command.setResponseRaw(response, null); break; + } } return true; + } case StatusCodes.Forbidden: { const msg = await readBody(); @@ -1510,12 +1514,14 @@ export class RequestExecutor implements IDisposable { case StatusCodes.GatewayTimeout: case StatusCodes.RequestTimeout: case StatusCodes.BadGateway: - case StatusCodes.ServiceUnavailable: + case StatusCodes.ServiceUnavailable: { return this._handleServerDown( url, chosenNode, nodeIndex, command, req, response, await readBody(), null, sessionInfo, shouldRetry); - case StatusCodes.Conflict: + } + case StatusCodes.Conflict: { RequestExecutor._handleConflict(response, await readBody()); break; + } case StatusCodes.TooEarly: { if (!shouldRetry) { return false; @@ -1543,9 +1549,10 @@ export class RequestExecutor implements IDisposable { return true; } - default: + default: { command.onResponseFailure(response); ExceptionDispatcher.throwException(response, await readBody()); + } } } diff --git a/src/Http/ServerNode.ts b/src/Http/ServerNode.ts index 469d94a2..46ef7850 100644 --- a/src/Http/ServerNode.ts +++ b/src/Http/ServerNode.ts @@ -40,8 +40,8 @@ export class ServerNode { if (serverVersion) { const tokens = serverVersion.split("."); try { - const major = parseInt(tokens[0], 10); - const minor = parseInt(tokens[1], 10); + const major = Number.parseInt(tokens[0], 10); + const minor = Number.parseInt(tokens[1], 10); if (major > 5 || (major === 5 && minor >= 2)) { this.supportsAtomicClusterWrites = true; @@ -64,7 +64,7 @@ export class ServerNode { return nodes; } - Object.keys(topology.members).forEach(node => { + for (const node of Object.keys(topology.members)) { const member = topology.members[node]; nodes.push(new ServerNode({ @@ -72,9 +72,9 @@ export class ServerNode { clusterTag: node, serverRole: "Member" })); - }); + } - Object.keys(topology.watchers).forEach(node => { + for (const node of Object.keys(topology.watchers)) { const watcher = topology.watchers[node]; nodes.push(new ServerNode({ @@ -82,7 +82,7 @@ export class ServerNode { clusterTag: node, serverRole: "Member" })); - }); + } return nodes; } diff --git a/src/Mapping/Json/Conventions/index.ts b/src/Mapping/Json/Conventions/index.ts index 6beccad0..ca24e31a 100644 --- a/src/Mapping/Json/Conventions/index.ts +++ b/src/Mapping/Json/Conventions/index.ts @@ -28,9 +28,11 @@ export function getObjectKeyCaseTransformProfile( defaultTransform: CasingConvention, profile?: ObjectKeyCaseTransformProfile): ObjectKeyCaseTransformStreamOptions { switch (profile) { case "DOCUMENT_LOAD": - case "DOCUMENT_QUERY": + case "DOCUMENT_QUERY": { return Object.assign({ defaultTransform }, DOCUMENT_LOAD_KEY_CASE_TRANSFORM_PROFILE); - default: + } + default: { return { defaultTransform }; + } } } diff --git a/src/Mapping/Json/Replacers.ts b/src/Mapping/Json/Replacers.ts index 8136bfed..f81ab94c 100644 --- a/src/Mapping/Json/Replacers.ts +++ b/src/Mapping/Json/Replacers.ts @@ -3,7 +3,7 @@ export function pascalCaseReplacer(key, value) { const replacement = {}; for (const k in value) { if (Object.hasOwnProperty.call(value, k)) { - replacement[k && k.charAt(0).toUpperCase() + k.substring(1)] = value[k]; + replacement[k && k.charAt(0).toUpperCase() + k.slice(1)] = value[k]; } } return replacement; @@ -17,7 +17,7 @@ export function camelCaseReplacer(key, value) { const replacement = {}; for (const k in value) { if (Object.hasOwnProperty.call(value, k)) { - replacement[k && k.charAt(0).toLowerCase() + k.substring(1)] = value[k]; + replacement[k && k.charAt(0).toLowerCase() + k.slice(1)] = value[k]; } } diff --git a/src/Mapping/JsonOperation.ts b/src/Mapping/JsonOperation.ts index 1f4191d5..d80b2b09 100644 --- a/src/Mapping/JsonOperation.ts +++ b/src/Mapping/JsonOperation.ts @@ -40,8 +40,8 @@ export class JsonOperation { const newJsonProps: string[] = Object.keys(newJson); const oldJsonProps: string[] = Object.keys(originalJson); - const newFields = newJsonProps.filter(x => !oldJsonProps.find(y => y === x)); - const removedFields = oldJsonProps.filter(x => !newJsonProps.find(y => y === x)); + const newFields = new Set(newJsonProps.filter(x => !oldJsonProps.includes(x))); + const removedFields = oldJsonProps.filter(x => !newJsonProps.includes(x)); for (const field of removedFields) { if (!changes) { @@ -61,7 +61,7 @@ export class JsonOperation { continue; } - if (newFields.find(x => x === prop)) { + if (newFields.has(prop)) { if (!changes) { return true; } diff --git a/src/Mapping/ObjectMapper.ts b/src/Mapping/ObjectMapper.ts index 97234317..d79afa5e 100644 --- a/src/Mapping/ObjectMapper.ts +++ b/src/Mapping/ObjectMapper.ts @@ -85,8 +85,9 @@ export class TypesAwareObjectMapper implements ITypesAwareObjectMapper { .split(/[!.]/g); const fieldContext = this._getFieldContext(obj, objPathSegments); const fieldContexts = Array.isArray(fieldContext) ? fieldContext : [fieldContext]; - fieldContexts.forEach( - (c, i) => this._applyTypeToNestedProperty(typeName, c, knownTypes)); + for (const [i, c] of fieldContexts.entries()) { + this._applyTypeToNestedProperty(typeName, c, knownTypes); + } } return obj; @@ -315,14 +316,14 @@ export class TypesAwareObjectMapper implements ITypesAwareObjectMapper { } if (Array.isArray(fieldVal)) { - fieldVal.forEach((item, i) => { + for (const [i, item] of fieldVal.entries()) { this._applyTypeToNestedProperty(fieldTypeName, { field: i.toString(), parent: fieldVal, getValue: () => fieldVal[i], setValue: (val) => fieldVal[i] = val }, knownTypes); - }); + } return; } diff --git a/src/Primitives/CaseInsensitiveKeysMap.ts b/src/Primitives/CaseInsensitiveKeysMap.ts index bc5cdab9..7f154897 100644 --- a/src/Primitives/CaseInsensitiveKeysMap.ts +++ b/src/Primitives/CaseInsensitiveKeysMap.ts @@ -7,7 +7,7 @@ function validateKey(key) { return; } - throw Error("Key must be a string."); + throw new Error("Key must be a string."); } export class CaseInsensitiveKeysMap { diff --git a/src/Primitives/CaseInsensitiveStringSet.ts b/src/Primitives/CaseInsensitiveStringSet.ts index e8a81fb7..683792c8 100644 --- a/src/Primitives/CaseInsensitiveStringSet.ts +++ b/src/Primitives/CaseInsensitiveStringSet.ts @@ -2,7 +2,7 @@ import { CaseInsensitiveKeysStore } from "./CaseInsensitiveKeysStore"; function validateKey(key) { if (!(key && key.toLowerCase)) { - throw Error("Key must be a string."); + throw new Error("Key must be a string."); } } diff --git a/src/Primitives/TimeValue.ts b/src/Primitives/TimeValue.ts index 70ce19cd..f0fd3a65 100644 --- a/src/Primitives/TimeValue.ts +++ b/src/Primitives/TimeValue.ts @@ -131,8 +131,9 @@ export class TimeValue { } break; } - default: + default: { throwError("InvalidArgumentException", "Not supported unit: " + this._unit); + } } return str.toString().trim(); @@ -188,8 +189,9 @@ export class TimeValue { private static _getBoundsInSeconds(time: TimeValue): [number, number] { switch (time._unit) { - case "Second": + case "Second": { return [time._value, time._value]; + } case "Month": { const years = Math.floor(time._value / 12); let upperBound = years * TimeValue.SECONDS_IN_366_DAYS; @@ -202,8 +204,9 @@ export class TimeValue { return [lowerBound, upperBound]; } - default: + default: { throwError("InvalidArgumentException", "Not supported time value unit: " + time._unit); + } } } diff --git a/src/ServerWide/Operations/GetDatabaseRecordOperation.ts b/src/ServerWide/Operations/GetDatabaseRecordOperation.ts index 42d91a91..6a934f37 100644 --- a/src/ServerWide/Operations/GetDatabaseRecordOperation.ts +++ b/src/ServerWide/Operations/GetDatabaseRecordOperation.ts @@ -71,11 +71,11 @@ export class GetDatabaseRecordCommand extends RavenCommand { + for (const index of Object.values(this.result.rollingIndexes)) { if (index.activeDeployments) { index.activeDeployments = GetDatabaseRecordCommand.mapRollingDeployment(dateUtil, index.activeDeployments as any); } - }); + } } const history = this.result.indexesHistory; diff --git a/src/ServerWide/Tcp/TcpConnectionHeaderMessage.ts b/src/ServerWide/Tcp/TcpConnectionHeaderMessage.ts index 7eed0564..2293d62d 100644 --- a/src/ServerWide/Tcp/TcpConnectionHeaderMessage.ts +++ b/src/ServerWide/Tcp/TcpConnectionHeaderMessage.ts @@ -238,18 +238,22 @@ export function getOperationTcpVersion(operationType: OperationTypes, index: num // we don't check the if the index go out of range, since this is expected and means that we don't have switch (operationType) { case "Ping": - case "None": + case "None": { return -1; - case "Drop": + } + case "Drop": { return -2; + } case "Subscription": case "Replication": case "Cluster": case "Heartbeats": - case "TestConnection": + case "TestConnection": { return operationsToSupportedProtocolVersions.get(operationType)[index]; - default: + } + default: { throwError("InvalidArgumentException", "Invalid operation type: " + operationType); + } } } diff --git a/src/Types/readable-stream.ts b/src/Types/readable-stream.ts index 8c8f1c71..545d283e 100644 --- a/src/Types/readable-stream.ts +++ b/src/Types/readable-stream.ts @@ -11,6 +11,7 @@ declare module "readable-stream" { // eslint-disable-next-line @typescript-eslint/no-namespace namespace pipeable { export class Stream extends pipeable { + // empty } export interface ReadableOptions { @@ -272,6 +273,7 @@ declare module "readable-stream" { } export class PassThrough extends Transform { + // empty } export function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException) => void): T; diff --git a/src/Utility/LogUtil.ts b/src/Utility/LogUtil.ts index 5e0ec026..c737377e 100644 --- a/src/Utility/LogUtil.ts +++ b/src/Utility/LogUtil.ts @@ -16,6 +16,7 @@ export function getLogger({ name = "ravendb", module = "" }): ILogger { if (!isDebug) { // eslint-disable-next-line @typescript-eslint/no-empty-function const noop = (msg: string) => { + // empty }; return { error: noop, diff --git a/src/Utility/Stopwatch.ts b/src/Utility/Stopwatch.ts index 66d02205..df3ab93e 100644 --- a/src/Utility/Stopwatch.ts +++ b/src/Utility/Stopwatch.ts @@ -17,7 +17,7 @@ export class Stopwatch { } if (!this._endDate) { - return new Date().valueOf() - this._startDate.valueOf(); + return Date.now() - this._startDate.valueOf(); } return this._endDate.valueOf() - this._startDate.valueOf(); diff --git a/src/Utility/StreamUtil.ts b/src/Utility/StreamUtil.ts index fa0a3a5a..2234f4ad 100644 --- a/src/Utility/StreamUtil.ts +++ b/src/Utility/StreamUtil.ts @@ -22,7 +22,7 @@ export async function readToEnd(readable: stream.Readable | stream.Stream): Prom readable.on("data", chunk => chunks.push(chunk)); await finishedAsync(readable); - return Buffer.concat(chunks).toString('utf-8'); + return Buffer.concat(chunks).toString("utf8"); } export function bufferToReadable(b: Buffer) { diff --git a/src/Utility/StringUtil.ts b/src/Utility/StringUtil.ts index 0ef0114e..3bd37fee 100644 --- a/src/Utility/StringUtil.ts +++ b/src/Utility/StringUtil.ts @@ -42,7 +42,7 @@ export class StringUtil { return s.replace( /\{([\d]+)\}/g, (match: string, placeholder: string): string => { - const value: any = inputVars[parseInt(placeholder, 10)]; + const value: any = inputVars[Number.parseInt(placeholder, 10)]; return (TypeUtil.isNullOrUndefined(value) ? "" : value).toString(); }); @@ -91,11 +91,11 @@ export class StringUtil { } public static capitalize(s: string): string { - return s.charAt(0).toUpperCase() + s.substring(1); + return s.charAt(0).toUpperCase() + s.slice(1); } public static uncapitalize(s: string): string { - return s.charAt(0).toLowerCase() + s.substring(1); + return s.charAt(0).toLowerCase() + s.slice(1); } public static isCharacter(character: string): boolean { diff --git a/src/Utility/TcpUtils.ts b/src/Utility/TcpUtils.ts index 83c59680..85151a46 100644 --- a/src/Utility/TcpUtils.ts +++ b/src/Utility/TcpUtils.ts @@ -16,7 +16,7 @@ export class TcpUtils { clientCertificate: IAuthOptions): Promise { const url = new URL(urlString); const host = url.hostname; - const port = parseInt(url.port, 10); + const port = Number.parseInt(url.port, 10); if (serverCertificate && clientCertificate) { return new Promise((resolve, reject) => { @@ -85,10 +85,12 @@ export class TcpUtils { private static _invokeNegotiation(info: TcpConnectionInfo, operationType: OperationTypes, negotiationCallback: NegotiationCallback, url: string, socket: Socket) { switch (operationType) { - case "Subscription": + case "Subscription": { return negotiationCallback(url, info, socket); - default: + } + default: { throwError("NotSupportedException", "Operation type '" + operationType + "' not supported"); + } } } } diff --git a/src/Utility/TimeUtil.ts b/src/Utility/TimeUtil.ts index c6caaa46..3a18f0d1 100644 --- a/src/Utility/TimeUtil.ts +++ b/src/Utility/TimeUtil.ts @@ -6,9 +6,9 @@ export class TimeUtil { private static _parseMiddlePart(input: string) { const tokens = input.split(":"); - const hours = parseInt(tokens[0], 10); - const minutes = parseInt(tokens[1], 10); - const seconds = parseInt(tokens[2], 10); + const hours = Number.parseInt(tokens[0], 10); + const minutes = Number.parseInt(tokens[1], 10); + const seconds = Number.parseInt(tokens[2], 10); if (tokens.length !== 3) { throwError("InvalidArgumentException", "Unexpected duration format: " + input); @@ -60,18 +60,18 @@ export class TimeUtil { if (hasDays && hasMillis) { const tokens = text.split("."); - const days = parseInt(tokens[0], 10); - const millis = tokens[2] ? parseInt(tokens[2], 10) : 0; + const days = Number.parseInt(tokens[0], 10); + const millis = tokens[2] ? Number.parseInt(tokens[2], 10) : 0; return this._parseMiddlePart(tokens[1]) + millis + days * TimeUtil.MILLIS_IN_DAY; } else if (hasDays) { const tokens = text.split("."); - const days = parseInt(tokens[0], 10); + const days = Number.parseInt(tokens[0], 10); return this._parseMiddlePart(tokens[1]) + days * TimeUtil.MILLIS_IN_DAY; } else if (hasMillis) { const tokens = text.split("."); let fractionString = tokens[1]; fractionString = fractionString.padEnd(7, "0"); - const value = parseInt(fractionString, 10) / 10_000; + const value = Number.parseInt(fractionString, 10) / 10_000; return this._parseMiddlePart(tokens[0]) + value; } else { return this._parseMiddlePart(text); diff --git a/src/index.ts b/src/index.ts index 422f9cd1..aa5b035f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -745,13 +745,10 @@ export * from "./ServerWide/Operations/ModifyDatabaseTopologyResult"; // MAPPING export { TypesAwareObjectMapper } from "./Mapping/ObjectMapper"; export { Mapping } from "./Mapping"; -import * as Json from "./Mapping/Json"; + // CONSTANTS export { CONSTANTS } from "./Constants"; -export { Json }; - -import { DocumentStore } from "./Documents/DocumentStore"; - -export default DocumentStore; +export * as Json from "./Mapping/Json"; +export { DocumentStore as default } from "./Documents/DocumentStore"; \ No newline at end of file diff --git a/test/Documents/Commands/GetNextOperationIdCommandTests.ts b/test/Documents/Commands/GetNextOperationIdCommandTests.ts index 5d98183f..41e71ec2 100644 --- a/test/Documents/Commands/GetNextOperationIdCommandTests.ts +++ b/test/Documents/Commands/GetNextOperationIdCommandTests.ts @@ -22,6 +22,6 @@ describe("GetNextOperationIdCommand", function () { await store.getRequestExecutor().execute(command); assert.ok(command.result); assert.ok(typeof command.result === "number"); - assert.ok(!isNaN(command.result)); + assert.ok(!Number.isNaN(command.result)); }); }); diff --git a/test/Documents/Operations/IndexesOperationsTests.ts b/test/Documents/Operations/IndexesOperationsTests.ts index 2c5181dd..3b2ad3c9 100644 --- a/test/Documents/Operations/IndexesOperationsTests.ts +++ b/test/Documents/Operations/IndexesOperationsTests.ts @@ -40,6 +40,7 @@ describe("Index operations", function () { class User { constructor(public name: string, public age?: number) { + // empty } } diff --git a/test/Documents/Queries/IDocumentQueryCustomizationMethodsTest.ts b/test/Documents/Queries/IDocumentQueryCustomizationMethodsTest.ts index b1c7d884..0c3c36dd 100644 --- a/test/Documents/Queries/IDocumentQueryCustomizationMethodsTest.ts +++ b/test/Documents/Queries/IDocumentQueryCustomizationMethodsTest.ts @@ -22,11 +22,12 @@ describe("IDocumentQueryCustomizationMethodsTest", function () { this.map(BlogPost, b => { const result: TagResult[] = []; + // eslint-disable-next-line unicorn/no-array-for-each b.tags.forEach(item => { result.push({ tag: item }); - }); + }) return result; }) diff --git a/test/Documents/ReadmeSamples.ts b/test/Documents/ReadmeSamples.ts index dd0887a1..b65444ca 100644 --- a/test/Documents/ReadmeSamples.ts +++ b/test/Documents/ReadmeSamples.ts @@ -333,7 +333,7 @@ describe("Readme samples", function () { print("// RQL"); print("// " + query.getIndexQuery().query); print("// ", query.getIndexQuery().queryParameters); - results.forEach(x => delete x["@metadata"]); + for (const x of results) delete x["@metadata"]; print("// " + util.inspect(results)); } }); diff --git a/test/Executor/RequestExecutorTests.ts b/test/Executor/RequestExecutorTests.ts index 8e4ca14c..44406c19 100644 --- a/test/Executor/RequestExecutorTests.ts +++ b/test/Executor/RequestExecutorTests.ts @@ -41,7 +41,7 @@ describe("Request executor", function () { try { const cmd = new GetNextOperationIdCommand(); await executor.execute(cmd); - } catch (err) { + } catch { errorsCount++; } } diff --git a/test/Issues/RDBC_501.ts b/test/Issues/RDBC_501.ts index 32bee6fd..94d55d6e 100644 --- a/test/Issues/RDBC_501.ts +++ b/test/Issues/RDBC_501.ts @@ -19,7 +19,7 @@ class SymbolPrice { } class MarketSymbol { - + // empty } describe("RDBC-501", function () { diff --git a/test/Mapping/ObjectMapperTests.ts b/test/Mapping/ObjectMapperTests.ts index 66dca254..1f609460 100644 --- a/test/Mapping/ObjectMapperTests.ts +++ b/test/Mapping/ObjectMapperTests.ts @@ -26,6 +26,7 @@ describe("ObjectMapper", function () { class Person { constructor(public name: string) { + // empty } public sayHello() { @@ -38,16 +39,19 @@ describe("ObjectMapper", function () { public name: string, public releasedAt: Date ) { + // empty } } class Tree { constructor(public name: string) { + // empty } } class Order { constructor(public orderId: number, public isSent: false) { + // empty } } @@ -503,7 +507,7 @@ describe("ObjectMapper", function () { // eslint-disable-next-line @typescript-eslint/no-empty-function it.skip("can handle map having objects for keys", () => { - + // empty }); }); diff --git a/test/Mapping/StreamJsonTests.ts b/test/Mapping/StreamJsonTests.ts index 71d1910b..e1ce13f7 100644 --- a/test/Mapping/StreamJsonTests.ts +++ b/test/Mapping/StreamJsonTests.ts @@ -60,7 +60,7 @@ describe("stream-json parser and stringer", function () { }); it("stringer for query result response with negative result etag", (done) => { - const content = fs.readFileSync(path.join(__dirname, "../Assets/queryResult.json"), "utf-8"); + const content = fs.readFileSync(path.join(__dirname, "../Assets/queryResult.json"), "utf8"); const readable = new stream.Readable(); readable.push(content); readable.push(null); diff --git a/test/Ported/Attachments/AttachmentsSessionTest.ts b/test/Ported/Attachments/AttachmentsSessionTest.ts index aa0b636a..c22cd298 100644 --- a/test/Ported/Attachments/AttachmentsSessionTest.ts +++ b/test/Ported/Attachments/AttachmentsSessionTest.ts @@ -33,7 +33,7 @@ describe("Attachments Session", function () { const profileStream = Buffer.from([1, 2, 3]); const backgroundStream = Buffer.from([10, 20, 30, 40, 50]); const fileStream = new stream.Readable(); - [1, 2, 3, 4, 5].forEach(x => fileStream.push(Buffer.from(x.toString()))); + for (const x of [1, 2, 3, 4, 5]) fileStream.push(Buffer.from(x.toString())); fileStream.push(null); { diff --git a/test/Ported/BulkInsert/BulkInsertsTest.ts b/test/Ported/BulkInsert/BulkInsertsTest.ts index 778577d5..98b077df 100644 --- a/test/Ported/BulkInsert/BulkInsertsTest.ts +++ b/test/Ported/BulkInsert/BulkInsertsTest.ts @@ -92,7 +92,7 @@ describe("bulk insert", function () { } finally { try { await bulkInsert.finish(); - } catch (e) { + } catch { // ignore } } @@ -128,7 +128,7 @@ describe("bulk insert", function () { } finally { try { await bulkInsert.finish(); - } catch (e) { + } catch { //ignore } } @@ -287,6 +287,7 @@ describe("BulkInsertOperation._typeCheckStoreArgs() properly parses arguments", const typeCheckStoreArgs = BulkInsertOperation["_typeCheckStoreArgs"]; // eslint-disable-next-line @typescript-eslint/no-empty-function const expectedCallback = () => { + // empty }; const expectedId = "id"; const expectedMetadata = {} as IMetadataDictionary; diff --git a/test/Ported/Cluster/ClusterOperationTest.ts b/test/Ported/Cluster/ClusterOperationTest.ts index fce22c70..c8ab9618 100644 --- a/test/Ported/Cluster/ClusterOperationTest.ts +++ b/test/Ported/Cluster/ClusterOperationTest.ts @@ -294,16 +294,18 @@ async function waitForTopologyStabilization(context: ClusterTestContext, s: stri let rehab = 0; let members = 0; - topo.nodes.forEach(n => { + for (const n of topo.nodes) { switch (n.serverRole) { - case "Rehab": + case "Rehab": { rehab++; break; - case "Member": + } + case "Member": { members++; break; + } } - }); + } return [rehab, members]; }, [rehabCount, memberCount], { diff --git a/test/Ported/Core/Streaming/DocumentStreaming.ts b/test/Ported/Core/Streaming/DocumentStreaming.ts index 5b3ca718..b1bd5ec2 100644 --- a/test/Ported/Core/Streaming/DocumentStreaming.ts +++ b/test/Ported/Core/Streaming/DocumentStreaming.ts @@ -67,13 +67,13 @@ describe("document streaming", function () { await StreamUtil.finishedAsync(queryStream); assert.strictEqual(items.length, 200); - items.forEach(item => { + for (const item of items) { assertStreamResultEntry(item, (doc: any) => { assert.ok(doc); assert.ok(doc.name); assert.ok(doc.lastName); }); - }); + } } } finally { newStore.dispose(); diff --git a/test/Ported/Core/Streaming/QueryStreaming.ts b/test/Ported/Core/Streaming/QueryStreaming.ts index 3122c75c..f34c83bf 100644 --- a/test/Ported/Core/Streaming/QueryStreaming.ts +++ b/test/Ported/Core/Streaming/QueryStreaming.ts @@ -142,7 +142,7 @@ describe("query streaming", function () { it("can stream query results with query statistics", async () => { await Promise.all([ prepareData(store, 100), - await usersByNameIndex.execute(store) + usersByNameIndex.execute(store) ]); await testContext.waitForIndexing(store); @@ -183,18 +183,18 @@ describe("query streaming", function () { assertStats(statsFromCallback); assert.equal(statsFromCallback, statsFromEvent); - items.forEach(x => assertStreamResultEntry(x, doc => { + for (const x of items) assertStreamResultEntry(x, doc => { assert.ok(doc instanceof User); assert.ok(doc.name); assert.ok(doc.lastName); - })); + }); } }); it("can stream raw query results", async () => { await Promise.all([ prepareData(store, 200), - await usersByNameIndex.execute(store) + usersByNameIndex.execute(store) ]); await testContext.waitForIndexing(store); @@ -240,7 +240,7 @@ describe("query streaming", function () { try { await Promise.all([ prepareData(newStore, 100), - await indexToUse.execute(store) + indexToUse.execute(store) ]); await testContext.waitForIndexing(store); @@ -295,7 +295,7 @@ describe("query streaming", function () { it("can stream raw query into stream", async () => { await Promise.all([ prepareData(store, 10), - await usersByNameIndex.execute(store) + usersByNameIndex.execute(store) ]); await testContext.waitForIndexing(store); diff --git a/test/Ported/Counters/BulkInsertCountersTest.ts b/test/Ported/Counters/BulkInsertCountersTest.ts index f277d898..be307fd0 100644 --- a/test/Ported/Counters/BulkInsertCountersTest.ts +++ b/test/Ported/Counters/BulkInsertCountersTest.ts @@ -206,7 +206,7 @@ describe("BulkInsertCountersTest", function () { for (const counter of counters) { assertThat(counter.totalValue) - .isEqualTo(parseInt(counter.counterName, 10)); + .isEqualTo(Number.parseInt(counter.counterName, 10)); } }); }); diff --git a/test/Ported/Counters/CountersSingleNodeTest.ts b/test/Ported/Counters/CountersSingleNodeTest.ts index b1b55029..36db830a 100644 --- a/test/Ported/Counters/CountersSingleNodeTest.ts +++ b/test/Ported/Counters/CountersSingleNodeTest.ts @@ -197,8 +197,8 @@ describe("CountersSingleNodeTest", function () { const { counters } = await store.operations.send(new GetCountersOperation("users/1-A", ["likes", "dislikes"])); assert.strictEqual(counters.length, 2); assert.strictEqual( - counters.filter(x => x.counterName === "likes")[0].totalValue, 5); - assert.strictEqual(counters.filter(x => x.counterName === "dislikes")[0].totalValue, 10); + counters.find(x => x.counterName === "likes").totalValue, 5); + assert.strictEqual(counters.find(x => x.counterName === "dislikes").totalValue, 10); }); it("multiSetAndGetViaBatch", async function() { diff --git a/test/Ported/Counters/SessionCountersTest.ts b/test/Ported/Counters/SessionCountersTest.ts index a582f4c7..80bf51e8 100644 --- a/test/Ported/Counters/SessionCountersTest.ts +++ b/test/Ported/Counters/SessionCountersTest.ts @@ -46,14 +46,14 @@ describe("SessionCountersTest", function () { new GetCountersOperation("users/1-A", ["likes", "downloads"]))).counters; assert.strictEqual(counters.length, 2); assert.strictEqual( - counters.filter(x => x.counterName === "likes")[0].totalValue, 100); + counters.find(x => x.counterName === "likes").totalValue, 100); assert.strictEqual( - counters.filter(x => x.counterName === "downloads")[0].totalValue, 500); + counters.find(x => x.counterName === "downloads").totalValue, 500); counters = (await store.operations.send(new GetCountersOperation("users/2-A", ["votes"]))).counters; assert.strictEqual(counters.length, 1); assert.strictEqual( - counters.filter(x => x.counterName === "votes")[0].totalValue, 1000); + counters.find(x => x.counterName === "votes").totalValue, 1000); } }); diff --git a/test/Ported/CustomEntityName.ts b/test/Ported/CustomEntityName.ts index fc4f8796..a03fd3e4 100644 --- a/test/Ported/CustomEntityName.ts +++ b/test/Ported/CustomEntityName.ts @@ -5,7 +5,7 @@ import { assertThat } from "../Utils/AssertExtensions"; describe("CustomEntityName", function () { const getChars = () => { - const basicChars = [...Array(31).keys()].map(x => { + const basicChars = [...new Array(31).keys()].map(x => { return String.fromCodePoint(x + 1); }); diff --git a/test/Ported/DatabaseSettingsOperationTest.ts b/test/Ported/DatabaseSettingsOperationTest.ts index 0b09711b..c93cb944 100644 --- a/test/Ported/DatabaseSettingsOperationTest.ts +++ b/test/Ported/DatabaseSettingsOperationTest.ts @@ -60,13 +60,13 @@ describe("DatabaseSettingsOperationTest", function () { async function checkIfOurValuesGotSaved(store: IDocumentStore, data: Record) { const settings = await getConfigurationSettings(store); - Object.keys(data).forEach(key => { + for (const key of Object.keys(data)) { const configurationValue = settings.settings[key]; assertThat(configurationValue) .isNotNull(); assertThat(configurationValue) .isEqualTo(data[key]); - }) + } } }); diff --git a/test/Ported/Faceted/AggregationTest.ts b/test/Ported/Faceted/AggregationTest.ts index 87b87be2..914cc3ce 100644 --- a/test/Ported/Faceted/AggregationTest.ts +++ b/test/Ported/Faceted/AggregationTest.ts @@ -149,13 +149,13 @@ describe("AggregationTest", function () { let facetResult = r["product"]; assert.strictEqual(facetResult.values.length, 2); - assert.strictEqual(facetResult.values.filter(x => x.range === "milk")[0].sum, 12); - assert.strictEqual(facetResult.values.filter(x => x.range === "iphone")[0].sum, 3333); + assert.strictEqual(facetResult.values.find(x => x.range === "milk").sum, 12); + assert.strictEqual(facetResult.values.find(x => x.range === "iphone").sum, 3333); facetResult = r["currency"]; assert.strictEqual(facetResult.values.length, 2); - assert.strictEqual(facetResult.values.filter(x => x.range === "eur")[0].sum, 3336); - assert.strictEqual(facetResult.values.filter(x => x.range === "nis")[0].sum, 9); + assert.strictEqual(facetResult.values.find(x => x.range === "eur").sum, 3336); + assert.strictEqual(facetResult.values.find(x => x.range === "nis").sum, 9); } }); @@ -193,10 +193,10 @@ describe("AggregationTest", function () { const facetResult = r["product"]; assert.strictEqual(facetResult.values.length, 2); - assert.strictEqual(facetResult.values.filter(x => x.range === "milk")[0].max, 9); - assert.strictEqual(facetResult.values.filter(x => x.range === "milk")[0].min, 3); - assert.strictEqual(facetResult.values.filter(x => x.range === "iphone")[0].max, 3333); - assert.strictEqual(facetResult.values.filter(x => x.range === "iphone")[0].min, 3333); + assert.strictEqual(facetResult.values.find(x => x.range === "milk").max, 9); + assert.strictEqual(facetResult.values.find(x => x.range === "milk").min, 3); + assert.strictEqual(facetResult.values.find(x => x.range === "iphone").max, 3333); + assert.strictEqual(facetResult.values.find(x => x.range === "iphone").min, 3333); } }); @@ -286,16 +286,16 @@ describe("AggregationTest", function () { let facetResult = r["product"]; assert.strictEqual(Object.keys(r).length, 2); - assert.strictEqual(facetResult.values.filter(x => x.range === "milk")[0].sum, 12); - assert.strictEqual(facetResult.values.filter(x => x.range === "iphone")[0].sum, 3333); + assert.strictEqual(facetResult.values.find(x => x.range === "milk").sum, 12); + assert.strictEqual(facetResult.values.find(x => x.range === "iphone").sum, 3333); facetResult = r["total"]; assert.strictEqual(facetResult.values.length, 4); assert.strictEqual( - facetResult.values.filter(x => x.range === "total < 100")[0].sum, 12); + facetResult.values.find(x => x.range === "total < 100").sum, 12); assert.strictEqual( - facetResult.values.filter(x => x.range === "total >= 1500")[0].sum, 3333); + facetResult.values.find(x => x.range === "total >= 1500").sum, 3333); } }); diff --git a/test/Ported/HiLoTest.ts b/test/Ported/HiLoTest.ts index 38e378ad..bc286162 100644 --- a/test/Ported/HiLoTest.ts +++ b/test/Ported/HiLoTest.ts @@ -42,7 +42,7 @@ describe("HiLo", function () { for (const numericPart of userIds .map(id => id.split("/")[1])) { - assert.ok(parseInt(numericPart, 10) < 33, + assert.ok(Number.parseInt(numericPart, 10) < 33, "Obtained ids should be less than 33, though they are:" + users.map(x => x.id).toString()); } @@ -196,9 +196,9 @@ describe("HiLo", function () { it("does not get another range when doing parallel requests", async () => { const parallelLevel = 32; - const users = Array.from(Array(parallelLevel).keys()).map(x => new User()); + const users = Array.from(new Array(parallelLevel).keys()).map(x => new User()); - const tasks = Array.from(Array(parallelLevel).keys()).map(async i => { + const tasks = Array.from(new Array(parallelLevel).keys()).map(async i => { const user = users[i]; const session = store.openSession(); await session.store(user); @@ -212,15 +212,15 @@ describe("HiLo", function () { .map(id => id.split("/")[1]) .map(x => x.split("-")[0])) { assert.ok(numericPart); - assert.ok(parseInt(numericPart, 10) < 33); + assert.ok(Number.parseInt(numericPart, 10) < 33); } }); it("does get another range when gets over max and leaves no gaps", async () => { const parallelLevel = 40; - const users = Array.from(Array(parallelLevel).keys()).map(x => new User()); + const users = Array.from(new Array(parallelLevel).keys()).map(x => new User()); - const tasks = Array.from(Array(parallelLevel).keys()).map(async i => { + const tasks = Array.from(new Array(parallelLevel).keys()).map(async i => { const user = users[i]; const session = store.openSession(); await session.store(user); @@ -232,7 +232,7 @@ describe("HiLo", function () { const idNumbers = users .map(x => x.id) .map(id => id.split("/")[1]) - .map(x => parseInt(x.split("-")[0], 10)); + .map(x => Number.parseInt(x.split("-")[0], 10)); assert.strictEqual(idNumbers.length, 40); diff --git a/test/Ported/HttpsTest.ts b/test/Ported/HttpsTest.ts index af8024c5..5dd7b8d8 100644 --- a/test/Ported/HttpsTest.ts +++ b/test/Ported/HttpsTest.ts @@ -224,7 +224,7 @@ describe("HttpsTest", function () { it("canUseServerGeneratedCertificate", async () => { const certificateRawData = await store.maintenance.server.send( - new CreateClientCertificateOperation("users-auth-test", { }, "Operator")); + new CreateClientCertificateOperation("users-auth-test", { /* empty */ }, "Operator")); const pfx = await extractPfx(certificateRawData); @@ -277,7 +277,7 @@ async function extractCertificate(certificateRawData: CertificateRawData) { if (entry.path.endsWith(".crt")) { const entryText = await readToEnd(entry); const lines = entryText.split(/\r?\n/); - cert = lines.slice(1, lines.length - 2).join("\r\n"); + cert = lines.slice(1, - 2).join("\r\n"); break; } else { entry.autodrain(); diff --git a/test/Ported/Indexing/JavaScriptIndexTest.ts b/test/Ported/Indexing/JavaScriptIndexTest.ts index 57bbf24f..6e13d1e0 100644 --- a/test/Ported/Indexing/JavaScriptIndexTest.ts +++ b/test/Ported/Indexing/JavaScriptIndexTest.ts @@ -591,7 +591,7 @@ class FanoutByPaymentsWithReduce extends AbstractJavaScriptIndexCreationTask { this.map(Fanout, f => { const result: FanoutByNumbersResult[] = []; - for (const item of f.numbers) { + // eslint-disable-next-line unicorn/no-array-for-each + f.numbers.forEach(item => { result.push({ foo: f.foo, sum: item }); - } + }) return result; }) } @@ -858,8 +859,9 @@ class ProductsWarrenty extends AbstractJavaScriptIndexCreationTask { // keep reference to resolve function - if timeout finishes first, we don't want to wait for value! // eslint-disable-next-line @typescript-eslint/ban-types - let resolveToDelete: Function; + let resolveToDelete: valueResolver; let timeoutHandle: ReturnType; const timeoutErr = getError(