From d561f2e4710b666fa531bc0d3a86d685f37a1f61 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 11:15:50 -0700 Subject: [PATCH 01/16] Run `npm init @eslint/config` --- .eslintrc.json | 33 + package-lock.json | 1518 ++++++++++++++++++++++++++++++++++++++------- package.json | 3 + 3 files changed, 1338 insertions(+), 216 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000000..3096dbdc66 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "overrides": [], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "indent": [ + "error", + 4 + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ] + } +} diff --git a/package-lock.json b/package-lock.json index de1d3205ae..1281daa1f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "powershell-preview", - "version": "2022.10.0", + "version": "2022.10.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "powershell-preview", - "version": "2022.10.0", + "version": "2022.10.1", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@vscode/extension-telemetry": "^0.6.2", @@ -27,8 +27,11 @@ "@types/sinon": "~10.0.13", "@types/uuid": "~8.3.4", "@types/vscode": "~1.65.0", + "@typescript-eslint/eslint-plugin": "^5.40.1", + "@typescript-eslint/parser": "^5.40.1", "@vscode/test-electron": "~2.1.5", "esbuild": "^0.15.11", + "eslint": "^8.25.0", "glob": "^8.0.3", "mocha": "~10.1.0", "mocha-multi-reporters": "~1.5.1", @@ -179,32 +182,26 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", "dev": true, "dependencies": { "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.15.0", + "ignore": "^5.2.0", "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@eslint/eslintrc/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { @@ -217,19 +214,6 @@ "concat-map": "0.0.1" } }, - "node_modules/@eslint/eslintrc/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -243,12 +227,12 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "version": "0.10.7", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.7.tgz", + "integrity": "sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^1.2.0", + "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", "minimatch": "^3.0.4" }, @@ -278,6 +262,19 @@ "node": "*" } }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -326,6 +323,41 @@ "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.6.tgz", "integrity": "sha512-D1Oivw1A4bIXhzBIy3/BBPn3p2On+kpO2NiYt9shICDK7L/w+cR6FFBUsBZ05l6iqzTeL+Jm8lAYn0g6G7DmDg==" }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -380,6 +412,12 @@ "@types/node": "*" } }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, "node_modules/@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -456,6 +494,237 @@ "integrity": "sha512-wQhExnh2nEzpjDMSKhUvnNmz3ucpd3E+R7wJkOhBNK3No6fG3VUdmVmMOKD0A8NDZDDDiQcLNxe3oGmX5SjJ5w==", "dev": true }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.1.tgz", + "integrity": "sha512-FsWboKkWdytGiXT5O1/R9j37YgcjO8MKHSUmWnIEjVaz0krHkplPnYi7mwdb+5+cs0toFNQb0HIrN7zONdIEWg==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/type-utils": "5.40.1", + "@typescript-eslint/utils": "5.40.1", + "debug": "^4.3.4", + "ignore": "^5.2.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.40.1.tgz", + "integrity": "sha512-IK6x55va5w4YvXd4b3VrXQPldV9vQTxi5ov+g4pMANsXPTXOcfjx08CRR1Dfrcc51syPtXHF5bgLlMHYFrvQtg==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/typescript-estree": "5.40.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz", + "integrity": "sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.1.tgz", + "integrity": "sha512-DLAs+AHQOe6n5LRraXiv27IYPhleF0ldEmx6yBqBgBLaNRKTkffhV1RPsjoJBhVup2zHxfaRtan8/YRBgYhU9Q==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "5.40.1", + "@typescript-eslint/utils": "5.40.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz", + "integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz", + "integrity": "sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.1.tgz", + "integrity": "sha512-a2TAVScoX9fjryNrW6BZRnreDUszxqm9eQ9Esv8n5nXApMW0zeANUYlwh/DED04SC/ifuBvXgZpIK5xeJHQ3aw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/typescript-estree": "5.40.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz", + "integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.40.1", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@vscode/extension-telemetry": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.6.2.tgz", @@ -484,9 +753,9 @@ } }, "node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", + "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -584,6 +853,15 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -1120,6 +1398,18 @@ "node": ">=0.3.1" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -1614,57 +1904,55 @@ } }, "node_modules/eslint": { - "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", + "version": "8.25.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz", + "integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==", "dev": true, "dependencies": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.10.5", + "@humanwhocodes/module-importer": "^1.0.1", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", - "debug": "^4.0.1", + "debug": "^4.3.2", "doctrine": "^3.0.0", - "enquirer": "^2.3.5", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", + "find-up": "^5.0.0", + "glob-parent": "^6.0.1", + "globals": "^13.15.0", + "globby": "^11.1.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -1684,30 +1972,24 @@ } }, "node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, "dependencies": { - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^2.0.0" }, "engines": { - "node": ">=6" + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" }, "funding": { "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" } }, "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-visitor-keys": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", @@ -1716,13 +1998,13 @@ "node": ">=10" } }, - "node_modules/eslint/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/eslint/node_modules/brace-expansion": { @@ -1735,17 +2017,38 @@ "concat-map": "0.0.1" } }, - "node_modules/eslint/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", "dev": true, "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" } }, "node_modules/eslint/node_modules/minimatch": { @@ -1761,26 +2064,20 @@ } }, "node_modules/espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", + "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", "dev": true, "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/esprima": { @@ -1871,6 +2168,22 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -1883,6 +2196,15 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -2156,12 +2478,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -2283,9 +2631,9 @@ ] }, "node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" @@ -2434,6 +2782,12 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/js-sdsl": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", + "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", + "dev": true + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -2615,6 +2969,28 @@ "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -3078,6 +3454,15 @@ "isarray": "0.0.1" } }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -3180,6 +3565,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -3314,6 +3719,16 @@ "node": ">=4" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rewire": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/rewire/-/rewire-6.0.0.tgz", @@ -3323,6 +3738,218 @@ "eslint": "^7.32.0" } }, + "node_modules/rewire/node_modules/@eslint/eslintrc": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", + "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/rewire/node_modules/@humanwhocodes/config-array": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", + "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/rewire/node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/rewire/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/rewire/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/rewire/node_modules/eslint": { + "version": "7.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", + "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", + "dev": true, + "dependencies": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/rewire/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/rewire/node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/rewire/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/rewire/node_modules/espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "dependencies": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/rewire/node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/rewire/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/rewire/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/rewire/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -3380,6 +4007,29 @@ "node": "*" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -3531,6 +4181,15 @@ "node": ">=8" } }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/slice-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", @@ -4593,31 +5252,22 @@ "optional": true }, "@eslint/eslintrc": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", "dev": true, "requires": { "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.15.0", + "ignore": "^5.2.0", "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" }, "dependencies": { - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4628,16 +5278,6 @@ "concat-map": "0.0.1" } }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -4650,12 +5290,12 @@ } }, "@humanwhocodes/config-array": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "version": "0.10.7", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.7.tgz", + "integrity": "sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==", "dev": true, "requires": { - "@humanwhocodes/object-schema": "^1.2.0", + "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", "minimatch": "^3.0.4" }, @@ -4681,6 +5321,12 @@ } } }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, "@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -4726,6 +5372,32 @@ "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.6.tgz", "integrity": "sha512-D1Oivw1A4bIXhzBIy3/BBPn3p2On+kpO2NiYt9shICDK7L/w+cR6FFBUsBZ05l6iqzTeL+Jm8lAYn0g6G7DmDg==" }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -4777,6 +5449,12 @@ "@types/node": "*" } }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, "@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -4853,6 +5531,136 @@ "integrity": "sha512-wQhExnh2nEzpjDMSKhUvnNmz3ucpd3E+R7wJkOhBNK3No6fG3VUdmVmMOKD0A8NDZDDDiQcLNxe3oGmX5SjJ5w==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.1.tgz", + "integrity": "sha512-FsWboKkWdytGiXT5O1/R9j37YgcjO8MKHSUmWnIEjVaz0krHkplPnYi7mwdb+5+cs0toFNQb0HIrN7zONdIEWg==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/type-utils": "5.40.1", + "@typescript-eslint/utils": "5.40.1", + "debug": "^4.3.4", + "ignore": "^5.2.0", + "regexpp": "^3.2.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "dependencies": { + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/parser": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.40.1.tgz", + "integrity": "sha512-IK6x55va5w4YvXd4b3VrXQPldV9vQTxi5ov+g4pMANsXPTXOcfjx08CRR1Dfrcc51syPtXHF5bgLlMHYFrvQtg==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/typescript-estree": "5.40.1", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.1.tgz", + "integrity": "sha512-jkn4xsJiUQucI16OLCXrLRXDZ3afKhOIqXs4R3O+M00hdQLKR58WuyXPZZjhKLFCEP2g+TXdBRtLQ33UfAdRUg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.40.1.tgz", + "integrity": "sha512-DLAs+AHQOe6n5LRraXiv27IYPhleF0ldEmx6yBqBgBLaNRKTkffhV1RPsjoJBhVup2zHxfaRtan8/YRBgYhU9Q==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "5.40.1", + "@typescript-eslint/utils": "5.40.1", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "dependencies": { + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/types": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.1.tgz", + "integrity": "sha512-Icg9kiuVJSwdzSQvtdGspOlWNjVDnF3qVIKXdJ103o36yRprdl3Ge5cABQx+csx960nuMF21v8qvO31v9t3OHw==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.1.tgz", + "integrity": "sha512-5QTP/nW5+60jBcEPfXy/EZL01qrl9GZtbgDZtDPlfW5zj/zjNrdI2B5zMUHmOsfvOr2cWqwVdWjobCiHcedmQA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/visitor-keys": "5.40.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "dependencies": { + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/utils": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.40.1.tgz", + "integrity": "sha512-a2TAVScoX9fjryNrW6BZRnreDUszxqm9eQ9Esv8n5nXApMW0zeANUYlwh/DED04SC/ifuBvXgZpIK5xeJHQ3aw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.40.1", + "@typescript-eslint/types": "5.40.1", + "@typescript-eslint/typescript-estree": "5.40.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0", + "semver": "^7.3.7" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.40.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.1.tgz", + "integrity": "sha512-A2DGmeZ+FMja0geX5rww+DpvILpwo1OsiQs0M+joPWJYsiEFBLsH0y1oFymPNul6Z5okSmHpP4ivkc2N0Cgfkw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.40.1", + "eslint-visitor-keys": "^3.3.0" + } + }, "@vscode/extension-telemetry": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.6.2.tgz", @@ -4875,9 +5683,9 @@ } }, "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", + "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", "dev": true }, "acorn-jsx": { @@ -4945,6 +5753,12 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -5333,6 +6147,15 @@ "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -5601,62 +6424,51 @@ "dev": true }, "eslint": { - "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", + "version": "8.25.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz", + "integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==", "dev": true, "requires": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.10.5", + "@humanwhocodes/module-importer": "^1.0.1", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", - "debug": "^4.0.1", + "debug": "^4.3.2", "doctrine": "^3.0.0", - "enquirer": "^2.3.5", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", + "find-up": "^5.0.0", + "glob-parent": "^6.0.1", + "globals": "^13.15.0", + "globby": "^11.1.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "text-table": "^0.2.0" }, "dependencies": { - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -5667,14 +6479,29 @@ "concat-map": "0.0.1" } }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" } }, "minimatch": { @@ -5699,45 +6526,37 @@ } }, "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, "requires": { - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^2.0.0" }, "dependencies": { "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true } } }, "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", "dev": true }, "espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", + "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", "dev": true, "requires": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" } }, "esprima": { @@ -5804,6 +6623,19 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -5816,6 +6648,15 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -6027,12 +6868,32 @@ "type-fest": "^0.20.2" } }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -6109,9 +6970,9 @@ "dev": true }, "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "import-fresh": { @@ -6221,6 +7082,12 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "js-sdsl": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", + "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -6373,6 +7240,22 @@ "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "dev": true }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -6724,6 +7607,12 @@ "isarray": "0.0.1" } }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -6799,6 +7688,12 @@ "side-channel": "^1.0.4" } }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -6904,6 +7799,12 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rewire": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/rewire/-/rewire-6.0.0.tgz", @@ -6911,6 +7812,176 @@ "dev": true, "requires": { "eslint": "^7.32.0" + }, + "dependencies": { + "@eslint/eslintrc": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", + "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + } + }, + "@humanwhocodes/config-array": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", + "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "eslint": { + "version": "7.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", + "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "rimraf": { @@ -6957,6 +8028,15 @@ } } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -7060,6 +8140,12 @@ } } }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, "slice-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", diff --git a/package.json b/package.json index d4af349a9d..493f3952b3 100644 --- a/package.json +++ b/package.json @@ -66,8 +66,11 @@ "@types/sinon": "~10.0.13", "@types/uuid": "~8.3.4", "@types/vscode": "~1.65.0", + "@typescript-eslint/eslint-plugin": "^5.40.1", + "@typescript-eslint/parser": "^5.40.1", "@vscode/test-electron": "~2.1.5", "esbuild": "^0.15.11", + "eslint": "^8.25.0", "glob": "^8.0.3", "mocha": "~10.1.0", "mocha-multi-reporters": "~1.5.1", From fcbfdecd451cd0f7795e5e367c8eb61a191b50d6 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 11:14:06 -0700 Subject: [PATCH 02/16] Remove TSLint --- package-lock.json | 455 ---------------------------------------------- package.json | 3 +- tslint.json | 21 --- 3 files changed, 1 insertion(+), 478 deletions(-) delete mode 100644 tslint.json diff --git a/package-lock.json b/package-lock.json index 1281daa1f6..93ba9c94c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,6 @@ "mock-fs": "~5.1.4", "rewire": "~6.0.0", "sinon": "~14.0.1", - "tslint": "~6.1.3", "typescript": "~4.8.4", "vsce": "~2.11.0" }, @@ -1058,15 +1057,6 @@ "node": ">=0.2.0" } }, - "node_modules/builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1253,12 +1243,6 @@ "node": ">= 0.8" } }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2698,18 +2682,6 @@ "node": ">=8" } }, - "node_modules/is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -3439,12 +3411,6 @@ "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-to-regexp": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", @@ -3693,23 +3659,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.9.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", @@ -4275,18 +4224,6 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "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/table": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", @@ -4416,202 +4353,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, - "node_modules/tslint": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", - "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", - "deprecated": "TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.3", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.13.0", - "tsutils": "^2.29.0" - }, - "bin": { - "tslint": "bin/tslint" - }, - "engines": { - "node": ">=4.8.0" - }, - "peerDependencies": { - "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 4.0.0-dev" - } - }, - "node_modules/tslint/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/tslint/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/tslint/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/tslint/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/tslint/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/tslint/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/tslint/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/tslint/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/tslint/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/tslint/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/tslint/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/tslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tslint/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/tslint/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "peerDependencies": { - "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" - } - }, "node_modules/tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", @@ -5902,12 +5643,6 @@ "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==", "dev": true }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==", - "dev": true - }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -6046,12 +5781,6 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -7022,15 +6751,6 @@ "binary-extensions": "^2.0.0" } }, - "is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -7592,12 +7312,6 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, - "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 - }, "path-to-regexp": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", @@ -7782,17 +7496,6 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, - "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -8207,12 +7910,6 @@ "has-flag": "^4.0.0" } }, - "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 - }, "table": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", @@ -8324,158 +8021,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, - "tslint": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", - "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.3", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.13.0", - "tsutils": "^2.29.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "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 - }, - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, "tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", diff --git a/package.json b/package.json index 493f3952b3..e5fa1384ad 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,6 @@ "mock-fs": "~5.1.4", "rewire": "~6.0.0", "sinon": "~14.0.1", - "tslint": "~6.1.3", "typescript": "~4.8.4", "vsce": "~2.11.0" }, @@ -86,7 +85,7 @@ ], "main": "./out/main.js", "scripts": { - "lint": "tslint --project tsconfig.json", + "lint": "eslint . --ext .ts", "build": "tsc --project tsconfig.json && esbuild ./src/main.ts --outdir=out --bundle --external:vscode --platform=node", "test": "node ./out/test/runTests.js", "package": "vsce package --no-gitHubIssueLinking", diff --git a/tslint.json b/tslint.json deleted file mode 100644 index b1a5fad007..0000000000 --- a/tslint.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": [ - "tslint:recommended" - ], - "jsRules": {}, - "rules": { - "indent": [true, "spaces", 4], - "max-classes-per-file": false, - "object-literal-sort-keys": false, - "only-arrow-functions": false, - "file-header": [ - true, - { - "allow-single-line-comments": true, - "match": "Copyright \\(c\\) Microsoft Corporation." - } - ] - }, - "rulesDirectory": [] -} From e5b0bb824aa19ff49f5e919d247df874dfcd5799 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 11:22:00 -0700 Subject: [PATCH 03/16] Run `eslint . --ext .ts --fix` --- src/controls/checkboxQuickPick.ts | 8 +- src/features/Console.ts | 4 +- src/features/CustomViews.ts | 4 +- src/features/DebugSession.ts | 6 +- src/features/ExtensionCommands.ts | 128 +++++++++++++++--------------- src/features/ExternalApi.ts | 12 +-- src/features/GenerateBugReport.ts | 10 +-- src/features/HelpCompletion.ts | 38 ++++----- src/features/ISECompatibility.ts | 2 +- src/features/NewFileOrProject.ts | 4 +- src/features/UpdatePowerShell.ts | 116 +++++++++++++-------------- src/logging.ts | 20 ++--- src/main.ts | 10 +-- src/platform.ts | 94 +++++++++++----------- src/session.ts | 106 ++++++++++++------------- src/settings.ts | 4 +- test/core/paths.test.ts | 2 +- test/core/platform.test.ts | 96 +++++++++++----------- test/features/ExternalApi.test.ts | 4 +- test/features/RunCode.test.ts | 4 +- test/utils.ts | 2 +- 21 files changed, 337 insertions(+), 337 deletions(-) diff --git a/src/controls/checkboxQuickPick.ts b/src/controls/checkboxQuickPick.ts index 15ca300262..dc43a86407 100644 --- a/src/controls/checkboxQuickPick.ts +++ b/src/controls/checkboxQuickPick.ts @@ -3,10 +3,10 @@ import vscode = require("vscode"); -const confirmItemLabel: string = "$(checklist) Confirm"; -const checkedPrefix: string = "[ $(check) ]"; -const uncheckedPrefix: string = "[ ]"; -const defaultPlaceHolder: string = "Select 'Confirm' to confirm or press 'Esc' key to cancel"; +const confirmItemLabel = "$(checklist) Confirm"; +const checkedPrefix = "[ $(check) ]"; +const uncheckedPrefix = "[ ]"; +const defaultPlaceHolder = "Select 'Confirm' to confirm or press 'Esc' key to cancel"; export interface ICheckboxQuickPickItem { label: string; diff --git a/src/features/Console.ts b/src/features/Console.ts index b7eacc9d50..5074c2ffcf 100644 --- a/src/features/Console.ts +++ b/src/features/Console.ts @@ -105,7 +105,7 @@ function showChoicePrompt(promptDetails: IShowChoicePromptRequestArgs): Thenable // Select the defaults for (const choice of promptDetails.defaultChoices) { checkboxQuickPickItems[choice].isSelected = true; - }; + } resultThenable = showCheckboxQuickPick( @@ -232,6 +232,6 @@ export class ConsoleFeature extends LanguageClientConsumer { this.languageClient.onRequest( ShowInputPromptRequestType, (promptDetails) => showInputPrompt(promptDetails)), - ] + ]; } } diff --git a/src/features/CustomViews.ts b/src/features/CustomViews.ts index 3f482cdd6f..ea1fa23116 100644 --- a/src/features/CustomViews.ts +++ b/src/features/CustomViews.ts @@ -85,8 +85,8 @@ class PowerShellContentProvider implements vscode.TextDocumentContentProvider { public createView(id: string, title: string, viewType: CustomViewType) { let view; switch (viewType) { - case CustomViewType.HtmlContent: - view = new HtmlContentView(id, title); + case CustomViewType.HtmlContent: + view = new HtmlContentView(id, title); } this.viewIndex[this.getUri(view.id)] = view; diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index b84caa1e0a..9bef786a96 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -27,12 +27,12 @@ enum DebugConfig { LaunchScript, InteractiveSession, AttachHostProcess, -}; +} export class DebugSessionFeature extends LanguageClientConsumer implements DebugConfigurationProvider, vscode.DebugAdapterDescriptorFactory { - private sessionCount: number = 1; + private sessionCount = 1; private tempDebugProcess: PowerShellProcess | undefined; private tempSessionDetails: IEditorServicesSessionDetails | undefined; private handlers: vscode.Disposable[] = []; @@ -262,7 +262,7 @@ export class DebugSessionFeature extends LanguageClientConsumer const platformDetails = getPlatformDetails(); const versionDetails = this.sessionManager.getPowerShellVersionDetails(); if (versionDetails === undefined) { - vscode.window.showErrorMessage(`Session version details were not found for ${config.name}`) + vscode.window.showErrorMessage(`Session version details were not found for ${config.name}`); return null; } diff --git a/src/features/ExtensionCommands.ts b/src/features/ExtensionCommands.ts index 94242c6187..c9c514ba71 100644 --- a/src/features/ExtensionCommands.ts +++ b/src/features/ExtensionCommands.ts @@ -191,16 +191,16 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { } }), - vscode.commands.registerCommand('PowerShell.ClosePanel', - async () => { await vscode.commands.executeCommand('workbench.action.closePanel'); }), + vscode.commands.registerCommand("PowerShell.ClosePanel", + async () => { await vscode.commands.executeCommand("workbench.action.closePanel"); }), - vscode.commands.registerCommand('PowerShell.PositionPanelLeft', - async () => { await vscode.commands.executeCommand('workbench.action.positionPanelLeft'); }), + vscode.commands.registerCommand("PowerShell.PositionPanelLeft", + async () => { await vscode.commands.executeCommand("workbench.action.positionPanelLeft"); }), - vscode.commands.registerCommand('PowerShell.PositionPanelBottom', - async () => { await vscode.commands.executeCommand('workbench.action.positionPanelBottom'); }), + vscode.commands.registerCommand("PowerShell.PositionPanelBottom", + async () => { await vscode.commands.executeCommand("workbench.action.positionPanelBottom"); }), - vscode.commands.registerCommand('PowerShell.Debug.Start', + vscode.commands.registerCommand("PowerShell.Debug.Start", async () => { // TODO: Use a named debug configuration. await vscode.debug.startDebugging(undefined, { @@ -208,9 +208,9 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { type: "PowerShell", request: "launch", script: "${file}", - }) + }); }) - ] + ]; } public override setLanguageClient(languageclient: LanguageClient) { @@ -431,72 +431,72 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { let newFileAbsolutePath: string; switch (currentFileUri.scheme) { - case "file": - // If the file to save can't be found, just complete the request - if (!this.findTextDocument(this.normalizeFilePath(currentFileUri.fsPath))) { - await this.log.writeAndShowError(`File to save not found: ${currentFileUri.fsPath}.`); - return EditorOperationResponse.Completed; - } + case "file": + // If the file to save can't be found, just complete the request + if (!this.findTextDocument(this.normalizeFilePath(currentFileUri.fsPath))) { + await this.log.writeAndShowError(`File to save not found: ${currentFileUri.fsPath}.`); + return EditorOperationResponse.Completed; + } - // If no newFile is given, just save the current file - if (!saveFileDetails.newPath) { - const doc = await vscode.workspace.openTextDocument(currentFileUri.fsPath); - if (doc.isDirty) { - await doc.save(); - } - return EditorOperationResponse.Completed; + // If no newFile is given, just save the current file + if (!saveFileDetails.newPath) { + const doc = await vscode.workspace.openTextDocument(currentFileUri.fsPath); + if (doc.isDirty) { + await doc.save(); } + return EditorOperationResponse.Completed; + } - // Make sure we have an absolute path - if (path.isAbsolute(saveFileDetails.newPath)) { - newFileAbsolutePath = saveFileDetails.newPath; - } else { - // If not, interpret the path as relative to the current file - newFileAbsolutePath = path.join(path.dirname(currentFileUri.fsPath), saveFileDetails.newPath); - } - break; + // Make sure we have an absolute path + if (path.isAbsolute(saveFileDetails.newPath)) { + newFileAbsolutePath = saveFileDetails.newPath; + } else { + // If not, interpret the path as relative to the current file + newFileAbsolutePath = path.join(path.dirname(currentFileUri.fsPath), saveFileDetails.newPath); + } + break; + + case "untitled": + // We need a new name to save an untitled file + if (!saveFileDetails.newPath) { + // TODO: Create a class handle vscode warnings and errors so we can warn easily + // without logging + this.log.writeAndShowWarning( + "Cannot save untitled file. Try SaveAs(\"path/to/file.ps1\") instead."); + return EditorOperationResponse.Completed; + } - case "untitled": - // We need a new name to save an untitled file - if (!saveFileDetails.newPath) { - // TODO: Create a class handle vscode warnings and errors so we can warn easily - // without logging - this.log.writeAndShowWarning( - "Cannot save untitled file. Try SaveAs(\"path/to/file.ps1\") instead."); + // Make sure we have an absolute path + if (path.isAbsolute(saveFileDetails.newPath)) { + newFileAbsolutePath = saveFileDetails.newPath; + } else { + // In fresh contexts, workspaceFolders is not defined... + if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) { + this.log.writeAndShowWarning("Cannot save file to relative path: no workspaces are open. " + + "Try saving to an absolute path, or open a workspace."); return EditorOperationResponse.Completed; } - // Make sure we have an absolute path - if (path.isAbsolute(saveFileDetails.newPath)) { - newFileAbsolutePath = saveFileDetails.newPath; - } else { - // In fresh contexts, workspaceFolders is not defined... - if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) { - this.log.writeAndShowWarning("Cannot save file to relative path: no workspaces are open. " + - "Try saving to an absolute path, or open a workspace."); - return EditorOperationResponse.Completed; - } - - // If not, interpret the path as relative to the workspace root - const workspaceRootUri = vscode.workspace.workspaceFolders[0].uri; - // We don't support saving to a non-file URI-schemed workspace - if (workspaceRootUri.scheme !== "file") { - this.log.writeAndShowWarning( - "Cannot save untitled file to a relative path in an untitled workspace. " + + // If not, interpret the path as relative to the workspace root + const workspaceRootUri = vscode.workspace.workspaceFolders[0].uri; + // We don't support saving to a non-file URI-schemed workspace + if (workspaceRootUri.scheme !== "file") { + this.log.writeAndShowWarning( + "Cannot save untitled file to a relative path in an untitled workspace. " + "Try saving to an absolute path or opening a workspace folder."); - return EditorOperationResponse.Completed; - } - newFileAbsolutePath = path.join(workspaceRootUri.fsPath, saveFileDetails.newPath); + return EditorOperationResponse.Completed; } - break; + newFileAbsolutePath = path.join(workspaceRootUri.fsPath, saveFileDetails.newPath); + } + break; - default: - // Other URI schemes are not supported - const msg = JSON.stringify(saveFileDetails); - this.log.writeVerbose( - `<${ExtensionCommandsFeature.name}>: Saving a document with scheme '${currentFileUri.scheme}' ` + + default: + // Other URI schemes are not supported + const msg = JSON.stringify(saveFileDetails); + this.log.writeVerbose( + `<${ExtensionCommandsFeature.name}>: Saving a document with scheme '${currentFileUri.scheme}' ` + `is currently unsupported. Message: '${msg}'`); - return EditorOperationResponse.Completed; + return EditorOperationResponse.Completed; } await this.saveDocumentContentToAbsolutePath(currentFileUri, newFileAbsolutePath); diff --git a/src/features/ExternalApi.ts b/src/features/ExternalApi.ts index c70d5ae040..57beeefe4e 100644 --- a/src/features/ExternalApi.ts +++ b/src/features/ExternalApi.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import * as vscode from "vscode"; -import { v4 as uuidv4 } from 'uuid'; +import { v4 as uuidv4 } from "uuid"; import { LanguageClientConsumer } from "../languageClientConsumer"; import { Logger } from "../logging"; import { SessionManager } from "../session"; @@ -56,7 +56,7 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower RETURNS: string session uuid */ - public registerExternalExtension(id: string, apiVersion: string = 'v1'): string { + public registerExternalExtension(id: string, apiVersion = "v1"): string { this.log.writeDiagnostic(`Registering extension '${id}' for use with API version '${apiVersion}'.`); for (const [_, externalExtension] of ExternalApiFeature.registeredExternalExtension) { @@ -97,7 +97,7 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower RETURNS: true if it worked, otherwise throws an error. */ - public unregisterExternalExtension(uuid: string = ""): boolean { + public unregisterExternalExtension(uuid = ""): boolean { this.log.writeDiagnostic(`Unregistering extension with session UUID: ${uuid}`); if (!ExternalApiFeature.registeredExternalExtension.delete(uuid)) { throw new Error(`No extension registered with session UUID: ${uuid}`); @@ -105,7 +105,7 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower return true; } - private getRegisteredExtension(uuid: string = ""): IExternalExtension { + private getRegisteredExtension(uuid = ""): IExternalExtension { if (!ExternalApiFeature.registeredExternalExtension.has(uuid)) { throw new Error( "UUID provided was invalid, make sure you ran the 'powershellExtensionClient.registerExternalExtension(extensionId)' method and pass in the UUID that it returns to subsequent methods."); @@ -133,7 +133,7 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower architecture: string; } */ - public async getPowerShellVersionDetails(uuid: string = ""): Promise { + public async getPowerShellVersionDetails(uuid = ""): Promise { const extension = this.getRegisteredExtension(uuid); this.log.writeDiagnostic(`Extension '${extension.id}' called 'getPowerShellVersionDetails'`); @@ -161,7 +161,7 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower If the extension is not started by some mechanism then this will wait indefinitely. */ - public async waitUntilStarted(uuid: string = ""): Promise { + public async waitUntilStarted(uuid = ""): Promise { const extension = this.getRegisteredExtension(uuid); this.log.writeDiagnostic(`Extension '${extension.id}' called 'waitUntilStarted'`); await this.sessionManager.waitUntilStarted(); diff --git a/src/features/GenerateBugReport.ts b/src/features/GenerateBugReport.ts index e819324c34..cced889def 100644 --- a/src/features/GenerateBugReport.ts +++ b/src/features/GenerateBugReport.ts @@ -6,11 +6,11 @@ import vscode = require("vscode"); import { SessionManager } from "../session"; import Settings = require("../settings"); -const queryStringPrefix: string = "?"; +const queryStringPrefix = "?"; const settings = Settings.load(); const project = settings.bugReporting.project; -const issuesUrl: string = `${project}/issues/new`; +const issuesUrl = `${project}/issues/new`; const extensions = vscode.extensions.all.filter((element) => element.packageJSON.isBuiltin === false) @@ -84,7 +84,7 @@ ${this.generateExtensionTable(extensions)} return "none"; } - const tableHeader = `|Extension|Author|Version|\n|---|---|---|`; + const tableHeader = "|Extension|Author|Version|\n|---|---|---|"; const table = installedExtensions.map((e) => { if (e.packageJSON.isBuiltin === false) { return `|${e.packageJSON.name}|${e.packageJSON.publisher}|${e.packageJSON.version}|`; @@ -109,8 +109,8 @@ ${tableHeader}\n${table}; const powerShellArgs = [ "-NoProfile", "-Command", - '$PSVersionString = "|Name|Value|\n"; $PSVersionString += "|---|---|\n"; $PSVersionTable.keys | ' + - 'ForEach-Object { $PSVersionString += "|$_|$($PSVersionTable.Item($_))|\n" }; $PSVersionString', + "$PSVersionString = \"|Name|Value|\n\"; $PSVersionString += \"|---|---|\n\"; $PSVersionTable.keys | " + + "ForEach-Object { $PSVersionString += \"|$_|$($PSVersionTable.Item($_))|\n\" }; $PSVersionString", ]; const spawn = require("child_process").spawnSync; diff --git a/src/features/HelpCompletion.ts b/src/features/HelpCompletion.ts index b0c544dbe1..9a29af0c1e 100644 --- a/src/features/HelpCompletion.ts +++ b/src/features/HelpCompletion.ts @@ -87,30 +87,30 @@ class TriggerFinder { public updateState(document: TextDocument, changeText: string): void { switch (this.state) { - case SearchState.Searching: - if (changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) { - this.state = SearchState.Locked; - this.document = document; - this.count++; - } - break; + case SearchState.Searching: + if (changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) { + this.state = SearchState.Locked; + this.document = document; + this.count++; + } + break; - case SearchState.Locked: - if (document === this.document && + case SearchState.Locked: + if (document === this.document && changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) { - this.count++; - if (this.count === this.triggerCharacters.length) { - this.state = SearchState.Found; - } - } else { - this.reset(); + this.count++; + if (this.count === this.triggerCharacters.length) { + this.state = SearchState.Found; } - break; - - default: + } else { this.reset(); - break; + } + break; + + default: + this.reset(); + break; } } diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index eb377a7c0c..2dc052cc6e 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -37,7 +37,7 @@ export class ISECompatibilityFeature implements vscode.Disposable { vscode.commands.registerCommand("PowerShell.EnableISEMode", async () => { await this.EnableISEMode(); }), vscode.commands.registerCommand("PowerShell.DisableISEMode", async () => { await this.DisableISEMode(); }), vscode.commands.registerCommand("PowerShell.ToggleISEMode", async () => { await this.ToggleISEMode(); }) - ] + ]; } public dispose() { diff --git a/src/features/NewFileOrProject.ts b/src/features/NewFileOrProject.ts index 1f8245160a..3fecc0ad4d 100644 --- a/src/features/NewFileOrProject.ts +++ b/src/features/NewFileOrProject.ts @@ -61,7 +61,7 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { } } - private async showProjectTemplates(includeInstalledModules: boolean = false): Promise { + private async showProjectTemplates(includeInstalledModules = false): Promise { const template = await vscode.window.showQuickPick( this.getProjectTemplates(includeInstalledModules), { @@ -80,7 +80,7 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { private async getProjectTemplates(includeInstalledModules: boolean): Promise { if (this.languageClient === undefined) { - return Promise.reject("Language client not defined!") + return Promise.reject("Language client not defined!"); } const response = await this.languageClient.sendRequest( diff --git a/src/features/UpdatePowerShell.ts b/src/features/UpdatePowerShell.ts index f183a6d099..9e8c6bd2aa 100644 --- a/src/features/UpdatePowerShell.ts +++ b/src/features/UpdatePowerShell.ts @@ -58,7 +58,7 @@ export class GitHubReleaseInformation { } public version: semver.SemVer; - public isPreview: boolean = false; + public isPreview = false; public assets: any[]; public constructor(version: string | semver.SemVer, assets: any[] = []) { @@ -102,9 +102,9 @@ export async function InvokePowerShellUpdateCheck( return; } - const commonText: string = `You have an old version of PowerShell (${localVersion.raw - }). The current latest release is ${release.version.raw - }.`; + const commonText = `You have an old version of PowerShell (${localVersion.raw + }). The current latest release is ${release.version.raw + }.`; if (process.platform === "linux") { await window.showInformationMessage( @@ -122,68 +122,68 @@ export async function InvokePowerShellUpdateCheck( // Yes choice. switch (result.id) { - // Yes choice. - case 0: - if (isWindows) { - const msiMatcher = arch === "x86" ? - "win-x86.msi" : "win-x64.msi"; - - const asset = release.assets.filter((a: any) => a.name.indexOf(msiMatcher) >= 0)[0]; - const msiDownloadPath = path.join(os.tmpdir(), asset.name); - - const res = await fetch(asset.browser_download_url); - if (!res.ok) { - throw new Error("unable to fetch MSI"); - } + // Yes choice. + case 0: + if (isWindows) { + const msiMatcher = arch === "x86" ? + "win-x86.msi" : "win-x64.msi"; + + const asset = release.assets.filter((a: any) => a.name.indexOf(msiMatcher) >= 0)[0]; + const msiDownloadPath = path.join(os.tmpdir(), asset.name); + + const res = await fetch(asset.browser_download_url); + if (!res.ok) { + throw new Error("unable to fetch MSI"); + } - await window.withProgress({ - title: "Downloading PowerShell Installer...", - location: ProgressLocation.Notification, - cancellable: false, - }, - async () => { - // Streams the body of the request to a file. - await streamPipeline(res.body, fs.createWriteStream(msiDownloadPath)); - }); - - // Stop the session because Windows likes to hold on to files. - sessionManager.stop(); - - // Close all terminals with the name "pwsh" in the current VS Code session. - // This will encourage folks to not close the instance of VS Code that spawned - // the MSI process. - for (const terminal of window.terminals) { - if (terminal.name === "pwsh") { - terminal.dispose(); - } + await window.withProgress({ + title: "Downloading PowerShell Installer...", + location: ProgressLocation.Notification, + cancellable: false, + }, + async () => { + // Streams the body of the request to a file. + await streamPipeline(res.body, fs.createWriteStream(msiDownloadPath)); + }); + + // Stop the session because Windows likes to hold on to files. + sessionManager.stop(); + + // Close all terminals with the name "pwsh" in the current VS Code session. + // This will encourage folks to not close the instance of VS Code that spawned + // the MSI process. + for (const terminal of window.terminals) { + if (terminal.name === "pwsh") { + terminal.dispose(); } + } - // Invoke the MSI via cmd. - const msi = spawn("msiexec", ["/i", msiDownloadPath]); + // Invoke the MSI via cmd. + const msi = spawn("msiexec", ["/i", msiDownloadPath]); - msi.on("close", async () => { - // Now that the MSI is finished, restart the session. - await sessionManager.start(); - fs.unlinkSync(msiDownloadPath); - }); + msi.on("close", async () => { + // Now that the MSI is finished, restart the session. + await sessionManager.start(); + fs.unlinkSync(msiDownloadPath); + }); - } else if (isMacOS) { - const script = release.isPreview - ? "brew upgrade --cask powershell-preview" - : "brew upgrade --cask powershell"; + } else if (isMacOS) { + const script = release.isPreview + ? "brew upgrade --cask powershell-preview" + : "brew upgrade --cask powershell"; - await languageServerClient.sendRequest(EvaluateRequestType, { - expression: script, - }); - } + await languageServerClient.sendRequest(EvaluateRequestType, { + expression: script, + }); + } - break; + break; // Never choice. - case 2: - await Settings.change("promptToUpdatePowerShell", false, true); - break; - default: - break; + case 2: + await Settings.change("promptToUpdatePowerShell", false, true); + break; + default: + break; } } diff --git a/src/logging.ts b/src/logging.ts index 57955f4b76..f606e535e5 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -66,7 +66,7 @@ export class Logger implements ILogger { for (const additionalMessage of additionalMessages) { this.writeLine(additionalMessage, logLevel); - }; + } } } @@ -132,7 +132,7 @@ export class Logger implements ILogger { } } - public async startNewLog(minimumLogLevel: string = "Normal"): Promise { + public async startNewLog(minimumLogLevel = "Normal"): Promise { this.MinimumLogLevel = Logger.logLevelNameToValue(minimumLogLevel); this.logSessionPath = @@ -147,13 +147,13 @@ export class Logger implements ILogger { // TODO: Make the enum smarter about strings so this goes away. public static logLevelNameToValue(logLevelName: string): LogLevel { switch (logLevelName.trim().toLowerCase()) { - case "diagnostic": return LogLevel.Diagnostic; - case "verbose": return LogLevel.Verbose; - case "normal": return LogLevel.Normal; - case "warning": return LogLevel.Warning; - case "error": return LogLevel.Error; - case "none": return LogLevel.None; - default: return LogLevel.Normal; + case "diagnostic": return LogLevel.Diagnostic; + case "verbose": return LogLevel.Verbose; + case "normal": return LogLevel.Normal; + case "warning": return LogLevel.Warning; + case "error": return LogLevel.Error; + case "none": return LogLevel.None; + default: return LogLevel.Normal; } } @@ -187,7 +187,7 @@ export class Logger implements ILogger { Buffer.concat([log, Buffer.from(timestampedMessage)])); } catch (e) { // tslint:disable-next-line:no-console - console.log(`Error writing to vscode-powershell log file: ${e}`) + console.log(`Error writing to vscode-powershell log file: ${e}`); } } } diff --git a/src/main.ts b/src/main.ts index 531717fec4..6f1f02422f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -36,7 +36,7 @@ import { LanguageClientConsumer } from "./languageClientConsumer"; const PackageJSON: any = require("../package.json"); // the application insights key (also known as instrumentation key) used for telemetry. -const AI_KEY: string = "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217"; +const AI_KEY = "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217"; let logger: Logger; let sessionManager: SessionManager; @@ -141,7 +141,7 @@ export async function activate(context: vscode.ExtensionContext): Promise externalApi.registerExternalExtension(id, apiVersion), + registerExternalExtension: (id: string, apiVersion = "v1") => externalApi.registerExternalExtension(id, apiVersion), unregisterExternalExtension: uuid => externalApi.unregisterExternalExtension(uuid), getPowerShellVersionDetails: uuid => externalApi.getPowerShellVersionDetails(uuid), waitUntilStarted: uuid => externalApi.waitUntilStarted(uuid), @@ -182,11 +182,11 @@ export async function deactivate(): Promise { // Clean up all extension features for (const languageClientConsumer of languageClientConsumers) { languageClientConsumer.dispose(); - }; + } for (const commandRegistration of commandRegistrations) { commandRegistration.dispose(); - }; + } // Dispose of the current session await sessionManager.dispose(); diff --git a/src/platform.ts b/src/platform.ts index 53fb8f732c..bc74554e3e 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -8,7 +8,7 @@ import { IPowerShellAdditionalExePathSettings } from "./settings"; // This uses require so we can rewire it in unit tests! // tslint:disable-next-line:no-var-requires -const utils = require("./utils") +const utils = require("./utils"); const WindowsPowerShell64BitLabel = "Windows PowerShell (x64)"; const WindowsPowerShell32BitLabel = "Windows PowerShell (x86)"; @@ -68,11 +68,11 @@ export function getPlatformDetails(): IPlatformDetails { */ export class PowerShellExeFinder { // This is required, since parseInt("7-preview") will return 7. - private static IntRegex: RegExp = /^\d+$/; + private static IntRegex = /^\d+$/; - private static PwshMsixRegex: RegExp = /^Microsoft.PowerShell_.*/; + private static PwshMsixRegex = /^Microsoft.PowerShell_.*/; - private static PwshPreviewMsixRegex: RegExp = /^Microsoft.PowerShellPreview_.*/; + private static PwshPreviewMsixRegex = /^Microsoft.PowerShellPreview_.*/; // The platform details descriptor for the platform we're on private readonly platformDetails: IPlatformDetails; @@ -172,19 +172,19 @@ export class PowerShellExeFinder { yield this.findPSCoreStable(); switch (this.platformDetails.operatingSystem) { - case OperatingSystem.Linux: - // On Linux, find the snap - yield this.findPSCoreStableSnap(); - break; + case OperatingSystem.Linux: + // On Linux, find the snap + yield this.findPSCoreStableSnap(); + break; - case OperatingSystem.Windows: - // Windows may have a 32-bit pwsh.exe - yield this.findPSCoreWindowsInstallation({ useAlternateBitness: true }); + case OperatingSystem.Windows: + // Windows may have a 32-bit pwsh.exe + yield this.findPSCoreWindowsInstallation({ useAlternateBitness: true }); - // Also look for the MSIX/UWP installation - yield await this.findPSCoreMsix(); + // Also look for the MSIX/UWP installation + yield await this.findPSCoreMsix(); - break; + break; } // Look for the .NET global tool @@ -196,27 +196,27 @@ export class PowerShellExeFinder { yield this.findPSCorePreview(); switch (this.platformDetails.operatingSystem) { - // On Linux, there might be a preview snap - case OperatingSystem.Linux: - yield this.findPSCorePreviewSnap(); - break; + // On Linux, there might be a preview snap + case OperatingSystem.Linux: + yield this.findPSCorePreviewSnap(); + break; - case OperatingSystem.Windows: - // Find a preview MSIX - yield this.findPSCoreMsix({ findPreview: true }); + case OperatingSystem.Windows: + // Find a preview MSIX + yield this.findPSCoreMsix({ findPreview: true }); - // Look for pwsh-preview with the opposite bitness - yield this.findPSCoreWindowsInstallation({ useAlternateBitness: true, findPreview: true }); + // Look for pwsh-preview with the opposite bitness + yield this.findPSCoreWindowsInstallation({ useAlternateBitness: true, findPreview: true }); - // Finally, get Windows PowerShell + // Finally, get Windows PowerShell - // Get the natural Windows PowerShell for the process bitness - yield this.findWinPS(); + // Get the natural Windows PowerShell for the process bitness + yield this.findWinPS(); - // Get the alternate bitness Windows PowerShell - yield this.findWinPS({ useAlternateBitness: true }); + // Get the alternate bitness Windows PowerShell + yield this.findWinPS({ useAlternateBitness: true }); - break; + break; } } @@ -237,33 +237,33 @@ export class PowerShellExeFinder { private async findPSCoreStable(): Promise { switch (this.platformDetails.operatingSystem) { - case OperatingSystem.Linux: - return new PossiblePowerShellExe(LinuxExePath, "PowerShell"); + case OperatingSystem.Linux: + return new PossiblePowerShellExe(LinuxExePath, "PowerShell"); - case OperatingSystem.MacOS: - return new PossiblePowerShellExe(MacOSExePath, "PowerShell"); + case OperatingSystem.MacOS: + return new PossiblePowerShellExe(MacOSExePath, "PowerShell"); - case OperatingSystem.Windows: - return await this.findPSCoreWindowsInstallation(); + case OperatingSystem.Windows: + return await this.findPSCoreWindowsInstallation(); - case OperatingSystem.Unknown: - return undefined; + case OperatingSystem.Unknown: + return undefined; } } private async findPSCorePreview(): Promise { switch (this.platformDetails.operatingSystem) { - case OperatingSystem.Linux: - return new PossiblePowerShellExe(LinuxPreviewExePath, "PowerShell Preview"); + case OperatingSystem.Linux: + return new PossiblePowerShellExe(LinuxPreviewExePath, "PowerShell Preview"); - case OperatingSystem.MacOS: - return new PossiblePowerShellExe(MacOSPreviewExePath, "PowerShell Preview"); + case OperatingSystem.MacOS: + return new PossiblePowerShellExe(MacOSPreviewExePath, "PowerShell Preview"); - case OperatingSystem.Windows: - return await this.findPSCoreWindowsInstallation({ findPreview: true }); + case OperatingSystem.Windows: + return await this.findPSCoreWindowsInstallation({ findPreview: true }); - case OperatingSystem.Unknown: - return undefined; + case OperatingSystem.Unknown: + return undefined; } } @@ -332,10 +332,10 @@ export class PowerShellExeFinder { return undefined; } - let highestSeenVersion: number = -1; + let highestSeenVersion = -1; let pwshExePath: string | undefined; for (const item of await utils.readDirectory(powerShellInstallBaseDir)) { - let currentVersion: number = -1; + let currentVersion = -1; if (findPreview) { // We are looking for something like "7-preview" diff --git a/src/session.ts b/src/session.ts index cabae7415e..4b70515457 100644 --- a/src/session.ts +++ b/src/session.ts @@ -84,7 +84,7 @@ export class SessionManager implements Middleware { public PowerShellExeDetails: IPowerShellExeDetails | undefined; private ShowSessionMenuCommandName = "PowerShell.ShowSessionMenu"; private sessionStatus: SessionStatus = SessionStatus.NeverStarted; - private suppressRestartPrompt: boolean = false; + private suppressRestartPrompt = false; private platformDetails: IPlatformDetails; private languageClientConsumers: LanguageClientConsumer[] = []; private languageStatusItem: vscode.LanguageStatusItem; @@ -97,8 +97,8 @@ export class SessionManager implements Middleware { private languageClient: LanguageClient | undefined; private sessionDetails: IEditorServicesSessionDetails | undefined; private sessionsFolder: vscode.Uri; - private starting: boolean = false; - private started: boolean = false; + private starting = false; + private started = false; constructor( private extensionContext: vscode.ExtensionContext, @@ -243,11 +243,11 @@ export class SessionManager implements Middleware { // support more, we need to track each separately, and tie the session // for the event handler to the right process (and dispose of the event // handler when the process is disposed). - this.debugSessionProcess?.dispose() + this.debugSessionProcess?.dispose(); this.debugEventHandler?.dispose(); if (this.PowerShellExeDetails === undefined) { - return Promise.reject("Required PowerShellExeDetails undefined!") + return Promise.reject("Required PowerShellExeDetails undefined!"); } // TODO: It might not be totally necessary to update the session @@ -342,12 +342,12 @@ export class SessionManager implements Middleware { // Move old setting codeFormatting.whitespaceAroundPipe to new setting codeFormatting.addWhitespaceAroundPipe private async migrateWhitespaceAroundPipeSetting() { const configuration = vscode.workspace.getConfiguration(utils.PowerShellLanguageId); - const deprecatedSetting = 'codeFormatting.whitespaceAroundPipe' - const newSetting = 'codeFormatting.addWhitespaceAroundPipe' + const deprecatedSetting = "codeFormatting.whitespaceAroundPipe"; + const newSetting = "codeFormatting.addWhitespaceAroundPipe"; const configurationTargetOfNewSetting = await Settings.getEffectiveConfigurationTarget(newSetting); const configurationTargetOfOldSetting = await Settings.getEffectiveConfigurationTarget(deprecatedSetting); if (configurationTargetOfOldSetting !== undefined && configurationTargetOfNewSetting === undefined) { - const value = configuration.get(deprecatedSetting, configurationTargetOfOldSetting) + const value = configuration.get(deprecatedSetting, configurationTargetOfOldSetting); await Settings.change(newSetting, value, configurationTargetOfOldSetting); await Settings.change(deprecatedSetting, undefined, configurationTargetOfOldSetting); } @@ -544,12 +544,12 @@ export class SessionManager implements Middleware { private buildEditorServicesArgs(bundledModulesPath: string, powerShellExeDetails: IPowerShellExeDetails): string { let editorServicesArgs = - `-HostName 'Visual Studio Code Host' ` + - `-HostProfileId 'Microsoft.VSCode' ` + + "-HostName 'Visual Studio Code Host' " + + "-HostProfileId 'Microsoft.VSCode' " + `-HostVersion '${this.HostVersion}' ` + - `-AdditionalModules @('PowerShellEditorServices.VSCode') ` + + "-AdditionalModules @('PowerShellEditorServices.VSCode') " + `-BundledModulesPath '${PowerShellProcess.escapeSingleQuotes(bundledModulesPath)}' ` + - `-EnableConsoleRepl `; + "-EnableConsoleRepl "; if (this.sessionSettings.integratedConsole.suppressStartupBanner) { editorServicesArgs += "-StartupBanner '' "; @@ -653,7 +653,7 @@ Type 'help' to get help. this.languageClient.onTelemetry((event) => { const eventName: string = event.eventName ? event.eventName : "PSESEvent"; - const data: any = event.data ? event.data : event + const data: any = event.data ? event.data : event; this.sendTelemetryEvent(eventName, data); }); @@ -680,7 +680,7 @@ Type 'help' to get help. else { this.setSessionRunningStatus(); } } ), - ] + ]; try { await this.languageClient.start(); @@ -731,7 +731,7 @@ Type 'help' to get help. } private createStatusBarItem(): vscode.LanguageStatusItem { - const statusTitle: string = "Show PowerShell Session Menu"; + const statusTitle = "Show PowerShell Session Menu"; const languageStatusItem = vscode.languages.createLanguageStatusItem("powershell", this.documentSelector); languageStatusItem.command = { title: statusTitle, command: this.ShowSessionMenuCommandName }; languageStatusItem.text = "$(terminal-powershell)"; @@ -757,25 +757,25 @@ Type 'help' to get help. } switch (status) { - case SessionStatus.Running: - case SessionStatus.NeverStarted: - case SessionStatus.NotStarted: - this.languageStatusItem.busy = false; - this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Information; - break; - case SessionStatus.Busy: - this.languageStatusItem.busy = true; - this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Information; - break; - case SessionStatus.Initializing: - case SessionStatus.Stopping: - this.languageStatusItem.busy = true; - this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Warning; - break; - case SessionStatus.Failed: - this.languageStatusItem.busy = false; - this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Error; - break; + case SessionStatus.Running: + case SessionStatus.NeverStarted: + case SessionStatus.NotStarted: + this.languageStatusItem.busy = false; + this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Information; + break; + case SessionStatus.Busy: + this.languageStatusItem.busy = true; + this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Information; + break; + case SessionStatus.Initializing: + case SessionStatus.Stopping: + this.languageStatusItem.busy = true; + this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Warning; + break; + case SessionStatus.Failed: + this.languageStatusItem.busy = false; + this.languageStatusItem.severity = vscode.LanguageStatusSeverity.Error; + break; } } @@ -813,7 +813,7 @@ Type 'help' to get help. if (this.debugSessionProcess) { this.debugSessionProcess.showTerminal(isExecute && !this.sessionSettings.integratedConsole.focusConsoleOnExecute); } else { - this.languageServerProcess?.showTerminal(isExecute && !this.sessionSettings.integratedConsole.focusConsoleOnExecute) + this.languageServerProcess?.showTerminal(isExecute && !this.sessionSettings.integratedConsole.focusConsoleOnExecute); } } @@ -831,35 +831,35 @@ Type 'help' to get help. let sessionText: string; switch (this.sessionStatus) { - case SessionStatus.Running: - case SessionStatus.Initializing: - case SessionStatus.NotStarted: - case SessionStatus.NeverStarted: - case SessionStatus.Stopping: - if (this.PowerShellExeDetails && this.versionDetails) { - const currentPowerShellExe = + case SessionStatus.Running: + case SessionStatus.Initializing: + case SessionStatus.NotStarted: + case SessionStatus.NeverStarted: + case SessionStatus.Stopping: + if (this.PowerShellExeDetails && this.versionDetails) { + const currentPowerShellExe = availablePowerShellExes .find((item) => item.displayName.toLowerCase() === this.PowerShellExeDetails!.displayName.toLowerCase()); - const powerShellSessionName = + const powerShellSessionName = currentPowerShellExe ? currentPowerShellExe.displayName : `PowerShell ${this.versionDetails.displayVersion} ` + `(${this.versionDetails.architecture}) ${this.versionDetails.edition} Edition ` + `[${this.versionDetails.version}]`; - sessionText = `Current session: ${powerShellSessionName}`; - } else { - sessionText = "Current session: Unknown"; - } - break; + sessionText = `Current session: ${powerShellSessionName}`; + } else { + sessionText = "Current session: Unknown"; + } + break; - case SessionStatus.Failed: - sessionText = "Session initialization failed, click here to show PowerShell extension logs"; - break; + case SessionStatus.Failed: + sessionText = "Session initialization failed, click here to show PowerShell extension logs"; + break; - default: - throw new TypeError("Not a valid value for the enum 'SessionStatus'"); + default: + throw new TypeError("Not a valid value for the enum 'SessionStatus'"); } const powerShellItems = diff --git a/src/settings.ts b/src/settings.ts index b79b8fafa5..eeb624ad15 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -324,7 +324,7 @@ function getWorkspaceSettingsWithDefaults( } // We don't want to query the user more than once, so this is idempotent. -let hasPrompted: boolean = false; +let hasPrompted = false; export async function validateCwdSetting(): Promise { let cwd = vscode.workspace.getConfiguration(utils.PowerShellLanguageId).get("cwd"); @@ -346,7 +346,7 @@ export async function validateCwdSetting(): Promise { hasPrompted = true; const options: vscode.WorkspaceFolderPickOptions = { placeHolder: "Select a folder to use as the PowerShell extension's working directory.", - } + }; cwd = (await vscode.window.showWorkspaceFolderPick(options))?.uri.fsPath; // Save the picked 'cwd' to the workspace settings. // We have to check again because the user may not have picked. diff --git a/test/core/paths.test.ts b/test/core/paths.test.ts index b2ebf21d6d..880ffe5c03 100644 --- a/test/core/paths.test.ts +++ b/test/core/paths.test.ts @@ -5,7 +5,7 @@ import * as assert from "assert"; import * as vscode from "vscode"; import { IPowerShellExtensionClient } from "../../src/features/ExternalApi"; import utils = require("../utils"); -import { checkIfDirectoryExists } from "../../src/utils" +import { checkIfDirectoryExists } from "../../src/utils"; describe("Path assumptions", function () { let globalStorageUri: vscode.Uri; diff --git a/test/core/platform.test.ts b/test/core/platform.test.ts index 8ea72d9b21..61de501296 100644 --- a/test/core/platform.test.ts +++ b/test/core/platform.test.ts @@ -32,7 +32,7 @@ const utilsMock = { checkIfFileExists: fakeCheckIfFileOrDirectoryExists, checkIfDirectoryExists: fakeCheckIfFileOrDirectoryExists, readDirectory: fakeReadDirectory -} +}; platformMock.__set__("utils", utilsMock); @@ -652,53 +652,53 @@ describe("Platform module", function () { it("Gets the correct platform details", function () { const platformDetails: platform.IPlatformDetails = platformMock.getPlatformDetails(); switch (process.platform) { - case "darwin": - assert.strictEqual( - platformDetails.operatingSystem, - platform.OperatingSystem.MacOS, - "Platform details operating system should be MacOS"); - assert.strictEqual( - platformDetails.isProcess64Bit, - true, - "VSCode on darwin should be 64-bit"); - assert.strictEqual( - platformDetails.isOS64Bit, - true, - "Darwin is 64-bit only"); - break; - - case "linux": - assert.strictEqual( - platformDetails.operatingSystem, - platform.OperatingSystem.Linux, - "Platform details operating system should be Linux"); - assert.strictEqual( - platformDetails.isProcess64Bit, - true, - "Only 64-bit VSCode supported on Linux"); - assert.strictEqual( - platformDetails.isOS64Bit, - true, - "Only 64-bit Linux supported by PowerShell"); - return; - - case "win32": - assert.strictEqual( - platformDetails.operatingSystem, - platform.OperatingSystem.Windows, - "Platform details operating system should be Windows"); - assert.strictEqual( - platformDetails.isProcess64Bit, - process.arch === "x64", - "Windows process bitness should match process arch"); - assert.strictEqual( - platformDetails.isOS64Bit, - !!(platformDetails.isProcess64Bit || process.env.ProgramW6432), - "Windows OS arch should match process bitness unless 64-bit env var set"); - return; - - default: - assert.fail("This platform is unsupported"); + case "darwin": + assert.strictEqual( + platformDetails.operatingSystem, + platform.OperatingSystem.MacOS, + "Platform details operating system should be MacOS"); + assert.strictEqual( + platformDetails.isProcess64Bit, + true, + "VSCode on darwin should be 64-bit"); + assert.strictEqual( + platformDetails.isOS64Bit, + true, + "Darwin is 64-bit only"); + break; + + case "linux": + assert.strictEqual( + platformDetails.operatingSystem, + platform.OperatingSystem.Linux, + "Platform details operating system should be Linux"); + assert.strictEqual( + platformDetails.isProcess64Bit, + true, + "Only 64-bit VSCode supported on Linux"); + assert.strictEqual( + platformDetails.isOS64Bit, + true, + "Only 64-bit Linux supported by PowerShell"); + return; + + case "win32": + assert.strictEqual( + platformDetails.operatingSystem, + platform.OperatingSystem.Windows, + "Platform details operating system should be Windows"); + assert.strictEqual( + platformDetails.isProcess64Bit, + process.arch === "x64", + "Windows process bitness should match process arch"); + assert.strictEqual( + platformDetails.isOS64Bit, + !!(platformDetails.isProcess64Bit || process.env.ProgramW6432), + "Windows OS arch should match process bitness unless 64-bit env var set"); + return; + + default: + assert.fail("This platform is unsupported"); } }); diff --git a/test/features/ExternalApi.test.ts b/test/features/ExternalApi.test.ts index 4c946096d9..8a769dcd17 100644 --- a/test/features/ExternalApi.test.ts +++ b/test/features/ExternalApi.test.ts @@ -32,7 +32,7 @@ describe("ExternalApi feature", function () { it("Rejects if not registered", async function () { assert.rejects( - async () => await extension.getPowerShellVersionDetails("")) + async () => await extension.getPowerShellVersionDetails("")); }); it("Throws if attempting to register an extension more than once", async function () { @@ -52,7 +52,7 @@ describe("ExternalApi feature", function () { assert.throws( () => extension.unregisterExternalExtension("not-real"), { - message: `No extension registered with session UUID: not-real` + message: "No extension registered with session UUID: not-real" }); }); }); diff --git a/test/features/RunCode.test.ts b/test/features/RunCode.test.ts index bed61c09a0..e47e223285 100644 --- a/test/features/RunCode.test.ts +++ b/test/features/RunCode.test.ts @@ -6,7 +6,7 @@ import * as path from "path"; import rewire = require("rewire"); import vscode = require("vscode"); import utils = require("../utils"); -import { checkIfFileExists } from "../../src/utils" +import { checkIfFileExists } from "../../src/utils"; // Setup function that is not exported. const customViews = rewire("../../src/features/RunCode"); @@ -21,7 +21,7 @@ describe("RunCode feature", function () { before(utils.ensureEditorServicesIsConnected); it("Creates the launch config", function () { - const commandToRun: string = "Invoke-Build"; + const commandToRun = "Invoke-Build"; const args: string[] = ["Clean"]; const expected: object = { diff --git a/test/utils.ts b/test/utils.ts index d31212a7b2..0d625b96d1 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -7,7 +7,7 @@ import { IPowerShellExtensionClient } from "../src/features/ExternalApi"; // This lets us test the rest of our path assumptions against the baseline of // this test file existing at `/out/test/utils.js`. -export const rootPath = path.resolve(__dirname, "../../") +export const rootPath = path.resolve(__dirname, "../../"); // tslint:disable-next-line: no-var-requires const packageJSON: any = require(path.resolve(rootPath, "package.json")); export const extensionId = `${packageJSON.publisher}.${packageJSON.name}`; From 98e4470af23e4fd4392d00829c8b5c5978494587 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 11:24:16 -0700 Subject: [PATCH 04/16] Disable 'no-non-null-assertion' Since we use it intentionally, and now only at 99 problems! --- .eslintrc.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 3096dbdc66..e508c334cf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,6 +28,9 @@ "semi": [ "error", "always" + ], + "@typescript-eslint/no-non-null-assertion": [ + "off" ] } } From b93fea04d471f13aa572bb7fba6eafdc611d0f4b Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 14:08:55 -0700 Subject: [PATCH 05/16] Convert TSLint to ESLint comments Ignoring bitwise and console as they're not warnings. --- src/controls/checkboxQuickPick.ts | 1 - src/features/CustomViews.ts | 1 - src/features/ExtensionCommands.ts | 2 +- src/logging.ts | 1 - src/main.ts | 2 +- src/platform.ts | 3 +-- src/session.ts | 2 +- src/settings.ts | 1 - src/utils.ts | 1 - test/index.ts | 1 - test/runTests.ts | 1 - test/utils.ts | 2 +- 12 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/controls/checkboxQuickPick.ts b/src/controls/checkboxQuickPick.ts index dc43a86407..1ec18b5b3e 100644 --- a/src/controls/checkboxQuickPick.ts +++ b/src/controls/checkboxQuickPick.ts @@ -66,7 +66,6 @@ async function showInner( if (index >= 0) { toggleSelection(items[index]); } else { - // tslint:disable-next-line:no-console console.log(`Couldn't find CheckboxQuickPickItem for label '${selection.label}'`); } diff --git a/src/features/CustomViews.ts b/src/features/CustomViews.ts index ea1fa23116..dcbb548e04 100644 --- a/src/features/CustomViews.ts +++ b/src/features/CustomViews.ts @@ -75,7 +75,6 @@ class PowerShellContentProvider implements vscode.TextDocumentContentProvider { private viewIndex: { [id: string]: CustomView } = {}; private didChangeEvent: vscode.EventEmitter = new vscode.EventEmitter(); - // tslint:disable-next-line:member-ordering public onDidChange: vscode.Event = this.didChangeEvent.event; public provideTextDocumentContent(uri: vscode.Uri): string { diff --git a/src/features/ExtensionCommands.ts b/src/features/ExtensionCommands.ts index c9c514ba71..7deeb50d1c 100644 --- a/src/features/ExtensionCommands.ts +++ b/src/features/ExtensionCommands.ts @@ -79,7 +79,7 @@ export const GetEditorContextRequestType = new RequestType( "editor/getEditorContext"); -// tslint:disable-next-line:no-empty-interface +// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface IGetEditorContextRequestArguments { } diff --git a/src/logging.ts b/src/logging.ts index f606e535e5..81c535ab84 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -186,7 +186,6 @@ export class Logger implements ILogger { this.logFilePath, Buffer.concat([log, Buffer.from(timestampedMessage)])); } catch (e) { - // tslint:disable-next-line:no-console console.log(`Error writing to vscode-powershell log file: ${e}`); } } diff --git a/src/main.ts b/src/main.ts index 6f1f02422f..59b4009b58 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,7 +32,7 @@ import { PowerShellLanguageId } from "./utils"; import { LanguageClientConsumer } from "./languageClientConsumer"; // The most reliable way to get the name and version of the current extension. -// tslint:disable-next-line: no-var-requires +// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-var-requires const PackageJSON: any = require("../package.json"); // the application insights key (also known as instrumentation key) used for telemetry. diff --git a/src/platform.ts b/src/platform.ts index bc74554e3e..e6be6cb2ed 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -7,7 +7,7 @@ import * as process from "process"; import { IPowerShellAdditionalExePathSettings } from "./settings"; // This uses require so we can rewire it in unit tests! -// tslint:disable-next-line:no-var-requires +// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-var-requires const utils = require("./utils"); const WindowsPowerShell64BitLabel = "Windows PowerShell (x64)"; @@ -298,7 +298,6 @@ export class PowerShellExeFinder { // We should find only one such application, so return on the first one for (const name of await utils.readDirectory(msixAppDir)) { - // tslint:disable-next-line:no-bitwise if (pwshMsixDirRegex.test(name)) { return new PossiblePowerShellExe(path.join(msixAppDir, name, "pwsh.exe"), pwshMsixName); } diff --git a/src/session.ts b/src/session.ts index 4b70515457..1fc222015e 100644 --- a/src/session.ts +++ b/src/session.ts @@ -912,7 +912,7 @@ class SessionMenuItem implements vscode.QuickPickItem { constructor( public readonly label: string, - // tslint:disable-next-line:no-empty + // eslint-disable-next-line @typescript-eslint/no-empty-function public readonly callback: () => void = () => { }) { } } diff --git a/src/settings.ts b/src/settings.ts index eeb624ad15..5d1b39ed32 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -265,7 +265,6 @@ export function load(): ISettings { notebooks: configuration.get("notebooks", defaultNotebooksSettings), startAsLoginShell: - // tslint:disable-next-line // We follow the same convention as VS Code - https://github.com/microsoft/vscode/blob/ff00badd955d6cfcb8eab5f25f3edc86b762f49f/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts#L105-L107 // "Unlike on Linux, ~/.profile is not sourced when logging into a macOS session. This // is the reason terminals on macOS typically run login shells by default which set up diff --git a/src/utils.ts b/src/utils.ts index 279a41e1e1..3ca7035ea6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -25,7 +25,6 @@ async function checkIfFileOrDirectoryExists(targetPath: string | vscode.Uri, typ targetPath instanceof vscode.Uri ? targetPath : vscode.Uri.file(targetPath)); - // tslint:disable-next-line:no-bitwise return (stat.type & type) !== 0; } catch { // TODO: Maybe throw if it's not a FileNotFound exception. diff --git a/test/index.ts b/test/index.ts index 0164cc7459..4a65285b1a 100644 --- a/test/index.ts +++ b/test/index.ts @@ -45,7 +45,6 @@ export function run(): Promise { } }); } catch (err) { - // tslint:disable-next-line:no-console console.error(err); e(err); } diff --git a/test/runTests.ts b/test/runTests.ts index b449ae7cc4..7a98901020 100644 --- a/test/runTests.ts +++ b/test/runTests.ts @@ -28,7 +28,6 @@ async function main() { version: "insiders" }); } catch (err) { - // tslint:disable-next-line:no-console console.error(`Failed to run tests: ${err}`); process.exit(1); } diff --git a/test/utils.ts b/test/utils.ts index 0d625b96d1..528973c862 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -8,7 +8,7 @@ import { IPowerShellExtensionClient } from "../src/features/ExternalApi"; // This lets us test the rest of our path assumptions against the baseline of // this test file existing at `/out/test/utils.js`. export const rootPath = path.resolve(__dirname, "../../"); -// tslint:disable-next-line: no-var-requires +// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-var-requires const packageJSON: any = require(path.resolve(rootPath, "package.json")); export const extensionId = `${packageJSON.publisher}.${packageJSON.name}`; From b072a46bfa405cbb831cefdd8f82b58e5ef9684e Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 14:29:18 -0700 Subject: [PATCH 06/16] Disable 'no-unused-vars' when they start with an underscore --- .eslintrc.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index e508c334cf..ed556f037b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -31,6 +31,12 @@ ], "@typescript-eslint/no-non-null-assertion": [ "off" + ], + "@typescript-eslint/no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_" + } ] } } From 98af0b88ced1262d802845ccb147b7fab4524f36 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 16:38:07 -0700 Subject: [PATCH 07/16] Fix remaining ESLint warnings and errors --- src/features/CodeActions.ts | 4 +++- src/features/DebugSession.ts | 12 ++++++++++-- src/features/ExpandAlias.ts | 13 +++++++++++-- src/features/ExtensionCommands.ts | 14 +++++++------- src/features/ExternalApi.ts | 3 ++- src/features/FindModule.ts | 22 +++++++++++++++------- src/features/GenerateBugReport.ts | 13 +++++++++---- src/features/GetCommands.ts | 1 + src/features/HelpCompletion.ts | 13 +++++++++++-- src/features/NewFileOrProject.ts | 6 +++++- src/features/OpenInISE.ts | 2 +- src/features/PesterTests.ts | 6 +++++- src/features/ShowHelp.ts | 6 +++++- src/features/UpdatePowerShell.ts | 5 +++++ src/main.ts | 8 ++++++++ src/platform.ts | 2 +- src/session.ts | 3 ++- src/settings.ts | 1 + 18 files changed, 102 insertions(+), 32 deletions(-) diff --git a/src/features/CodeActions.ts b/src/features/CodeActions.ts index 1d1f7907aa..470d01f7c5 100644 --- a/src/features/CodeActions.ts +++ b/src/features/CodeActions.ts @@ -10,6 +10,8 @@ export class CodeActionsFeature implements vscode.Disposable { private showDocumentationCommand: vscode.Disposable; constructor(private log: ILogger) { + // TODO: What type is `edit`, what uses this, and is it working? + // eslint-disable-next-line @typescript-eslint/no-explicit-any this.applyEditsCommand = vscode.commands.registerCommand("PowerShell.ApplyCodeActionEdits", (edit: any) => { Window.activeTextEditor?.edit((editBuilder) => { editBuilder.replace( @@ -23,7 +25,7 @@ export class CodeActionsFeature implements vscode.Disposable { }); this.showDocumentationCommand = - vscode.commands.registerCommand("PowerShell.ShowCodeActionDocumentation", (ruleName: any) => { + vscode.commands.registerCommand("PowerShell.ShowCodeActionDocumentation", (ruleName: string) => { this.showRuleDocumentation(ruleName); }); } diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index 9bef786a96..6e0adfc82a 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -338,6 +338,10 @@ interface IProcessItem extends vscode.QuickPickItem { pid: string; // payload for the QuickPick UI } +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface IGetPSHostProcessesArguments { +} + interface IPSHostProcessInfo { processName: string; processId: string; @@ -346,7 +350,7 @@ interface IPSHostProcessInfo { } export const GetPSHostProcessesRequestType = - new RequestType("powerShell/getPSHostProcesses"); + new RequestType("powerShell/getPSHostProcesses"); export class PickPSHostProcessFeature extends LanguageClientConsumer { @@ -462,6 +466,10 @@ interface IRunspaceItem extends vscode.QuickPickItem { id: string; // payload for the QuickPick UI } +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface IGetRunspaceRequestArguments { +} + interface IRunspace { id: number; name: string; @@ -469,7 +477,7 @@ interface IRunspace { } export const GetRunspaceRequestType = - new RequestType("powerShell/getRunspace"); + new RequestType("powerShell/getRunspace"); export class PickRunspaceFeature extends LanguageClientConsumer { diff --git a/src/features/ExpandAlias.ts b/src/features/ExpandAlias.ts index 62520ff3dd..94434b7722 100644 --- a/src/features/ExpandAlias.ts +++ b/src/features/ExpandAlias.ts @@ -6,7 +6,16 @@ import Window = vscode.window; import { RequestType } from "vscode-languageclient"; import { LanguageClientConsumer } from "../languageClientConsumer"; -export const ExpandAliasRequestType = new RequestType("powerShell/expandAlias"); +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface IExpandAliasRequestArguments { +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface IExpandAliasRequestResponse { + text: string +} + +export const ExpandAliasRequestType = new RequestType("powerShell/expandAlias"); export class ExpandAliasFeature extends LanguageClientConsumer { private command: vscode.Disposable; @@ -24,7 +33,7 @@ export class ExpandAliasFeature extends LanguageClientConsumer { const sls = selection.start; const sle = selection.end; - let text: string | any[]; + let text: string; let range: vscode.Range | vscode.Position; if ((sls.character === sle.character) && (sls.line === sle.line)) { diff --git a/src/features/ExtensionCommands.ts b/src/features/ExtensionCommands.ts index 7deeb50d1c..58f009480d 100644 --- a/src/features/ExtensionCommands.ts +++ b/src/features/ExtensionCommands.ts @@ -431,7 +431,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { let newFileAbsolutePath: string; switch (currentFileUri.scheme) { - case "file": + case "file": { // If the file to save can't be found, just complete the request if (!this.findTextDocument(this.normalizeFilePath(currentFileUri.fsPath))) { await this.log.writeAndShowError(`File to save not found: ${currentFileUri.fsPath}.`); @@ -454,9 +454,9 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { // If not, interpret the path as relative to the current file newFileAbsolutePath = path.join(path.dirname(currentFileUri.fsPath), saveFileDetails.newPath); } - break; + break; } - case "untitled": + case "untitled": { // We need a new name to save an untitled file if (!saveFileDetails.newPath) { // TODO: Create a class handle vscode warnings and errors so we can warn easily @@ -488,15 +488,15 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { } newFileAbsolutePath = path.join(workspaceRootUri.fsPath, saveFileDetails.newPath); } - break; + break; } - default: + default: { // Other URI schemes are not supported const msg = JSON.stringify(saveFileDetails); this.log.writeVerbose( `<${ExtensionCommandsFeature.name}>: Saving a document with scheme '${currentFileUri.scheme}' ` + - `is currently unsupported. Message: '${msg}'`); - return EditorOperationResponse.Completed; + `is currently unsupported. Message: '${msg}'`); + return EditorOperationResponse.Completed; } } await this.saveDocumentContentToAbsolutePath(currentFileUri, newFileAbsolutePath); diff --git a/src/features/ExternalApi.ts b/src/features/ExternalApi.ts index 57beeefe4e..8194ba3b2b 100644 --- a/src/features/ExternalApi.ts +++ b/src/features/ExternalApi.ts @@ -59,7 +59,8 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower public registerExternalExtension(id: string, apiVersion = "v1"): string { this.log.writeDiagnostic(`Registering extension '${id}' for use with API version '${apiVersion}'.`); - for (const [_, externalExtension] of ExternalApiFeature.registeredExternalExtension) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const [_name, externalExtension] of ExternalApiFeature.registeredExternalExtension) { if (externalExtension.id === id) { const message = `The extension '${id}' is already registered.`; this.log.writeWarning(message); diff --git a/src/features/FindModule.ts b/src/features/FindModule.ts index 46ade452c6..551d06529e 100644 --- a/src/features/FindModule.ts +++ b/src/features/FindModule.ts @@ -1,13 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +// TODO: PSES does not currently support findModule...so this whole thing is broken! + import vscode = require("vscode"); import { RequestType } from "vscode-languageclient"; import QuickPickItem = vscode.QuickPickItem; import { LanguageClientConsumer } from "../languageClientConsumer"; +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface IFindModuleRequestArguments { +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface IModule { + name: string, + description: string +} + export const FindModuleRequestType = - new RequestType("powerShell/findModule"); + new RequestType("powerShell/findModule"); export const InstallModuleRequestType = new RequestType("powerShell/installModule"); @@ -66,12 +78,8 @@ export class FindModuleFeature extends LanguageClientConsumer { return Promise.resolve(""); } - if (modules !== undefined) { - for (const item in modules) { - if (modules.hasOwnProperty(item)) { - items.push({ label: modules[item].name, description: modules[item].description }); - } - } + for (const module of modules ?? []) { + items.push({ label: module.name, description: module.description }); } if (items.length === 0) { diff --git a/src/features/GenerateBugReport.ts b/src/features/GenerateBugReport.ts index cced889def..9d60ab0c23 100644 --- a/src/features/GenerateBugReport.ts +++ b/src/features/GenerateBugReport.ts @@ -3,6 +3,7 @@ import os = require("os"); import vscode = require("vscode"); +import child_process = require("child_process"); import { SessionManager } from "../session"; import Settings = require("../settings"); @@ -79,6 +80,7 @@ ${this.generateExtensionTable(extensions)} this.command.dispose(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any private generateExtensionTable(installedExtensions: vscode.Extension[]): string { if (!installedExtensions.length) { return "none"; @@ -104,8 +106,12 @@ ${tableHeader}\n${table}; return extensionTable; } - private getRuntimeInfo() { - const powerShellExePath = this.sessionManager.PowerShellExeDetails?.exePath; + private getRuntimeInfo(): string | undefined { + if (this.sessionManager.PowerShellExeDetails === undefined) { + return; + } + + const powerShellExePath = this.sessionManager.PowerShellExeDetails.exePath; const powerShellArgs = [ "-NoProfile", "-Command", @@ -113,8 +119,7 @@ ${tableHeader}\n${table}; "ForEach-Object { $PSVersionString += \"|$_|$($PSVersionTable.Item($_))|\n\" }; $PSVersionString", ]; - const spawn = require("child_process").spawnSync; - const child = spawn(powerShellExePath, powerShellArgs); + const child = child_process.spawnSync(powerShellExePath, powerShellArgs); return child.stdout.toString().replace(";", ","); } } diff --git a/src/features/GetCommands.ts b/src/features/GetCommands.ts index b34a30b00d..7e87744c34 100644 --- a/src/features/GetCommands.ts +++ b/src/features/GetCommands.ts @@ -139,6 +139,7 @@ class Command extends vscode.TreeItem { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any public async getChildren(_element?: any): Promise { return []; // Returning an empty array because we need to return something. diff --git a/src/features/HelpCompletion.ts b/src/features/HelpCompletion.ts index 9a29af0c1e..5fe3964cc1 100644 --- a/src/features/HelpCompletion.ts +++ b/src/features/HelpCompletion.ts @@ -11,8 +11,17 @@ import { Logger } from "../logging"; import Settings = require("../settings"); import { LanguageClientConsumer } from "../languageClientConsumer"; +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface ICommentHelpRequestArguments { +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface ICommentHelpRequestResponse { + content: string[] +} + export const CommentHelpRequestType = - new RequestType("powerShell/getCommentHelp"); + new RequestType("powerShell/getCommentHelp"); enum SearchState { Searching, Locked, Found } @@ -175,7 +184,7 @@ class HelpCompletionProvider { // Trim the last empty line and join the strings. const lines: string[] = result.content; const text = lines - .map((x) => (x as any).trimLeft()) + .map((x) => x.trimLeft()) .join(this.getEOL(doc.eol)); const snippetString = new SnippetString(text); diff --git a/src/features/NewFileOrProject.ts b/src/features/NewFileOrProject.ts index 3fecc0ad4d..cd65d05239 100644 --- a/src/features/NewFileOrProject.ts +++ b/src/features/NewFileOrProject.ts @@ -193,8 +193,12 @@ interface IGetProjectTemplatesResponseBody { templates: ITemplateDetails[]; } +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface INewProjectFromTemplateRequestArguments { +} + export const NewProjectFromTemplateRequestType = - new RequestType( + new RequestType( "powerShell/newProjectFromTemplate"); interface INewProjectFromTemplateResponseBody { diff --git a/src/features/OpenInISE.ts b/src/features/OpenInISE.ts index 3c12b5368f..01dd445e86 100644 --- a/src/features/OpenInISE.ts +++ b/src/features/OpenInISE.ts @@ -18,7 +18,7 @@ export class OpenInISEFeature implements vscode.Disposable { const uri = document.uri; let ISEPath = process.env.windir; - if (process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")) { + if (process.env.PROCESSOR_ARCHITEW6432 !== undefined) { ISEPath += "\\Sysnative"; } else { ISEPath += "\\System32"; diff --git a/src/features/PesterTests.ts b/src/features/PesterTests.ts index 8c23a68a42..e6fcf55d40 100644 --- a/src/features/PesterTests.ts +++ b/src/features/PesterTests.ts @@ -48,7 +48,11 @@ export class PesterTestsFeature implements vscode.Disposable { launchType: LaunchType, fileUri: vscode.Uri): Promise { - const uriString = (fileUri || vscode.window.activeTextEditor?.document.uri).toString(); + if (fileUri === undefined && vscode.window.activeTextEditor === undefined) { + return false; + } + + const uriString = (fileUri || vscode.window.activeTextEditor!.document.uri).toString(); const launchConfig = this.createLaunchConfig(uriString, launchType); return this.launch(launchConfig); } diff --git a/src/features/ShowHelp.ts b/src/features/ShowHelp.ts index d0a0450ba9..135d6caa2f 100644 --- a/src/features/ShowHelp.ts +++ b/src/features/ShowHelp.ts @@ -5,8 +5,12 @@ import vscode = require("vscode"); import { NotificationType } from "vscode-languageclient"; import { LanguageClientConsumer } from "../languageClientConsumer"; +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface IShowHelpNotificationArguments { +} + export const ShowHelpNotificationType = - new NotificationType("powerShell/showHelp"); + new NotificationType("powerShell/showHelp"); export class ShowHelpFeature extends LanguageClientConsumer { private command: vscode.Disposable; diff --git a/src/features/UpdatePowerShell.ts b/src/features/UpdatePowerShell.ts index 9e8c6bd2aa..b53ee0d5cc 100644 --- a/src/features/UpdatePowerShell.ts +++ b/src/features/UpdatePowerShell.ts @@ -50,6 +50,7 @@ export class GitHubReleaseInformation { // For preview, we grab all the releases and then grab the first prerelease. const releaseJson = preview + // eslint-disable-next-line @typescript-eslint/no-explicit-any ? (await response.json()).find((release: any) => release.prerelease) : await response.json(); @@ -59,8 +60,11 @@ export class GitHubReleaseInformation { public version: semver.SemVer; public isPreview = false; + // TODO: Establish a type for the assets. + // eslint-disable-next-line @typescript-eslint/no-explicit-any public assets: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any public constructor(version: string | semver.SemVer, assets: any[] = []) { this.version = semver.parse(version)!; @@ -128,6 +132,7 @@ export async function InvokePowerShellUpdateCheck( const msiMatcher = arch === "x86" ? "win-x86.msi" : "win-x64.msi"; + // eslint-disable-next-line @typescript-eslint/no-explicit-any const asset = release.assets.filter((a: any) => a.name.indexOf(msiMatcher) >= 0)[0]; const msiDownloadPath = path.join(os.tmpdir(), asset.name); diff --git a/src/main.ts b/src/main.ts index 59b4009b58..bdaa0dd4d7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -68,6 +68,8 @@ export async function activate(context: vscode.ExtensionContext): Promise\/\?\s]+)/g, indentationRules: { @@ -91,27 +93,33 @@ export async function activate(context: vscode.ExtensionContext): Promise { + error: (_error: Error, _message: Message, _count: number): ErrorHandlerResult => { // TODO: Is there any error worth terminating on? return { action: ErrorAction.Continue }; }, @@ -653,6 +653,7 @@ Type 'help' to get help. this.languageClient.onTelemetry((event) => { const eventName: string = event.eventName ? event.eventName : "PSESEvent"; + // eslint-disable-next-line @typescript-eslint/no-explicit-any const data: any = event.data ? event.data : event; this.sendTelemetryEvent(eventName, data); }); diff --git a/src/settings.ts b/src/settings.ts index 5d1b39ed32..e207027de8 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -299,6 +299,7 @@ export async function getEffectiveConfigurationTarget(settingName: string): Prom export async function change( settingName: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any newValue: any, configurationTarget?: vscode.ConfigurationTarget | boolean): Promise { From a55148a6c9e53c6ee42a36288635ac67988918cf Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 16:40:26 -0700 Subject: [PATCH 08/16] Update .vscodeignore --- .vscodeignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscodeignore b/.vscodeignore index d04733defc..44a638ba97 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -15,6 +15,7 @@ tools/ !out/main.js .editorconfig +.eslintrc.json .gitattributes .gitignore .markdownlint.json @@ -22,6 +23,6 @@ tools/ build.ps1 extension-dev.code-workspace *.vsix +test-results.xml tsconfig.json -tslint.json vscode-powershell.build.ps1 From 82d25f088d3369562a441d70554d20fea5529943 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 16:42:08 -0700 Subject: [PATCH 09/16] Update VS Code linter extension --- extension-dev.code-workspace | 4 ++-- vscode-powershell.build.ps1 | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/extension-dev.code-workspace b/extension-dev.code-workspace index 9a451c5dcb..4d28833762 100644 --- a/extension-dev.code-workspace +++ b/extension-dev.code-workspace @@ -12,12 +12,12 @@ "extensions": { "recommendations": [ "davidanson.vscode-markdownlint", + "dbaeumer.vscode-eslint", "editorconfig.editorconfig", "josefpihrt-vscode.roslynator", "ms-azure-devops.azure-pipelines", "ms-dotnettools.csharp", - "ms-vscode.powershell-preview", - "ms-vscode.vscode-typescript-tslint-plugin", + "ms-vscode.powershell-preview" ] }, "settings": { diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index 845724feba..8c9131f071 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -96,8 +96,6 @@ task Build Restore, { Write-Host "`n### Building vscode-powershell`n" -ForegroundColor Green assert (Test-Path ./modules/PowerShellEditorServices/bin) "Extension requires PSES" - # TODO: TSLint is deprecated and we need to switch to ESLint. - # https://github.com/PowerShell/vscode-powershell/pull/3331 exec { & npm run lint } # TODO: When supported we should use `esbuild` for the tests too. Although From b0b729aa91360a24b093e3d22455f202a56f0808 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Tue, 18 Oct 2022 16:50:20 -0700 Subject: [PATCH 10/16] Enforce copyright header with ESLint --- .eslintrc.json | 12 +++++++++++- package-lock.json | 17 +++++++++++++++++ package.json | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index ed556f037b..73d72734e7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,7 +14,8 @@ "sourceType": "module" }, "plugins": [ - "@typescript-eslint" + "@typescript-eslint", + "header" ], "rules": { "indent": [ @@ -37,6 +38,15 @@ { "argsIgnorePattern": "^_" } + ], + "header/header": [ + 2, + "line", + [ + " Copyright (c) Microsoft Corporation.", + " Licensed under the MIT License." + ], + 2 ] } } diff --git a/package-lock.json b/package-lock.json index 93ba9c94c3..2e848f5454 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,7 @@ "@vscode/test-electron": "~2.1.5", "esbuild": "^0.15.11", "eslint": "^8.25.0", + "eslint-plugin-header": "^3.1.1", "glob": "^8.0.3", "mocha": "~10.1.0", "mocha-multi-reporters": "~1.5.1", @@ -1942,6 +1943,15 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-plugin-header": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", + "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", + "dev": true, + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -6244,6 +6254,13 @@ } } }, + "eslint-plugin-header": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", + "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", + "dev": true, + "requires": {} + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", diff --git a/package.json b/package.json index e5fa1384ad..ae72b9b351 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "@vscode/test-electron": "~2.1.5", "esbuild": "^0.15.11", "eslint": "^8.25.0", + "eslint-plugin-header": "^3.1.1", "glob": "^8.0.3", "mocha": "~10.1.0", "mocha-multi-reporters": "~1.5.1", From f33b9109eb781df741ebe8c0d64844e2bcab56d4 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Wed, 19 Oct 2022 12:06:23 -0700 Subject: [PATCH 11/16] Enable 'require-await', 'no-misused-promises' and 'no-floating-promises' Except where we have to ignore them individually. --- .eslintrc.json | 15 ++++++++- src/features/CodeActions.ts | 12 +++---- src/features/CustomViews.ts | 8 ++--- src/features/DebugSession.ts | 27 +++++++++------ src/features/Examples.ts | 4 +-- src/features/ExpandAlias.ts | 9 ++--- src/features/ExtensionCommands.ts | 23 +++++++------ src/features/FindModule.ts | 28 ++++++++-------- src/features/GenerateBugReport.ts | 4 +-- src/features/GetCommands.ts | 32 ++++++++++-------- src/features/HelpCompletion.ts | 2 +- src/features/NewFileOrProject.ts | 43 ++++++++++++------------ src/features/RemoteFiles.ts | 8 +++-- src/features/RunCode.ts | 5 ++- src/features/ShowHelp.ts | 6 ++-- src/features/UpdatePowerShell.ts | 7 ++-- src/languageClientConsumer.ts | 1 + src/logging.ts | 17 +++++----- src/main.ts | 2 +- src/process.ts | 11 +++--- src/session.ts | 46 ++++++++++++-------------- src/settings.ts | 2 +- test/core/platform.test.ts | 2 ++ test/core/settings.test.ts | 28 ++-------------- test/features/CustomViews.test.ts | 2 +- test/features/ExternalApi.test.ts | 7 ++-- test/features/ISECompatibility.test.ts | 10 +++--- test/runTests.ts | 1 + 28 files changed, 183 insertions(+), 179 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 73d72734e7..f269c18efa 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -11,7 +11,11 @@ "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": "latest", - "sourceType": "module" + "sourceType": "module", + "tsconfigRootDir": ".", + "project": [ + "./tsconfig.json" + ] }, "plugins": [ "@typescript-eslint", @@ -39,6 +43,15 @@ "argsIgnorePattern": "^_" } ], + "@typescript-eslint/require-await": [ + "error" + ], + "@typescript-eslint/no-misused-promises": [ + "error" + ], + "@typescript-eslint/no-floating-promises": [ + "error" + ], "header/header": [ 2, "line", diff --git a/src/features/CodeActions.ts b/src/features/CodeActions.ts index 470d01f7c5..aaf0dbfba3 100644 --- a/src/features/CodeActions.ts +++ b/src/features/CodeActions.ts @@ -12,8 +12,8 @@ export class CodeActionsFeature implements vscode.Disposable { constructor(private log: ILogger) { // TODO: What type is `edit`, what uses this, and is it working? // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.applyEditsCommand = vscode.commands.registerCommand("PowerShell.ApplyCodeActionEdits", (edit: any) => { - Window.activeTextEditor?.edit((editBuilder) => { + this.applyEditsCommand = vscode.commands.registerCommand("PowerShell.ApplyCodeActionEdits", async (edit: any) => { + await Window.activeTextEditor?.edit((editBuilder) => { editBuilder.replace( new vscode.Range( edit.StartLineNumber - 1, @@ -25,8 +25,8 @@ export class CodeActionsFeature implements vscode.Disposable { }); this.showDocumentationCommand = - vscode.commands.registerCommand("PowerShell.ShowCodeActionDocumentation", (ruleName: string) => { - this.showRuleDocumentation(ruleName); + vscode.commands.registerCommand("PowerShell.ShowCodeActionDocumentation", async (ruleName: string) => { + await this.showRuleDocumentation(ruleName); }); } @@ -35,7 +35,7 @@ export class CodeActionsFeature implements vscode.Disposable { this.showDocumentationCommand.dispose(); } - public showRuleDocumentation(ruleId: string) { + public async showRuleDocumentation(ruleId: string) { const pssaDocBaseURL = "https://docs.microsoft.com/powershell/utility-modules/psscriptanalyzer/rules/"; if (!ruleId) { @@ -47,6 +47,6 @@ export class CodeActionsFeature implements vscode.Disposable { ruleId = ruleId.substr(2); } - vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(pssaDocBaseURL + `${ruleId}`)); + await vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(pssaDocBaseURL + `${ruleId}`)); } } diff --git a/src/features/CustomViews.ts b/src/features/CustomViews.ts index dcbb548e04..d95f358463 100644 --- a/src/features/CustomViews.ts +++ b/src/features/CustomViews.ts @@ -99,12 +99,10 @@ class PowerShellContentProvider implements vscode.TextDocumentContentProvider { public closeView(id: string) { const uriString = this.getUri(id); - vscode.workspace.textDocuments.some((doc) => { + vscode.workspace.textDocuments.some(async (doc) => { if (doc.uri.toString() === uriString) { - vscode.window - .showTextDocument(doc) - .then((_) => vscode.commands.executeCommand("workbench.action.closeActiveEditor")); - + await vscode.window.showTextDocument(doc); + await vscode.commands.executeCommand("workbench.action.closeActiveEditor"); return true; } diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index 6e0adfc82a..33a1149515 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -80,6 +80,7 @@ export class DebugSessionFeature extends LanguageClientConsumer : this.sessionManager.getSessionDetails(); if (sessionDetails === undefined) { + // eslint-disable-next-line @typescript-eslint/no-floating-promises this.logger.writeAndShowError(`No session details available for ${session.name}`); return; } @@ -101,7 +102,8 @@ export class DebugSessionFeature extends LanguageClientConsumer languageClient.onNotification( StartDebuggerNotificationType, // TODO: Use a named debug configuration. - async () => await vscode.debug.startDebugging(undefined, { + // eslint-disable-next-line @typescript-eslint/no-misused-promises + () => vscode.debug.startDebugging(undefined, { request: "launch", type: "PowerShell", name: "PowerShell: Interactive Session" @@ -109,7 +111,8 @@ export class DebugSessionFeature extends LanguageClientConsumer languageClient.onNotification( StopDebuggerNotificationType, - async () => await vscode.debug.stopDebugging(undefined)) + // eslint-disable-next-line @typescript-eslint/no-misused-promises + () => vscode.debug.stopDebugging(undefined)) ]; } @@ -188,7 +191,7 @@ export class DebugSessionFeature extends LanguageClientConsumer if (config.script === "${file}" || config.script === "${relativeFile}") { if (vscode.window.activeTextEditor === undefined) { - vscode.window.showErrorMessage("To debug the 'Current File', you must first open a PowerShell script file in the editor."); + await vscode.window.showErrorMessage("To debug the 'Current File', you must first open a PowerShell script file in the editor."); return undefined; } config.current_document = true; @@ -214,7 +217,7 @@ export class DebugSessionFeature extends LanguageClientConsumer } else if (config.request === "launch") { resolvedConfig = await this.resolveLaunchDebugConfiguration(config); } else { - vscode.window.showErrorMessage(`The request type was invalid: '${config.request}'`); + await vscode.window.showErrorMessage(`The request type was invalid: '${config.request}'`); return null; } @@ -235,7 +238,7 @@ export class DebugSessionFeature extends LanguageClientConsumer if (config.current_document) { const currentDocument = vscode.window.activeTextEditor?.document; if (currentDocument?.languageId !== "powershell") { - vscode.window.showErrorMessage("Please change the current document's language mode to PowerShell."); + await vscode.window.showErrorMessage("Please change the current document's language mode to PowerShell."); return undefined; } } @@ -244,13 +247,13 @@ export class DebugSessionFeature extends LanguageClientConsumer // check the document extension for everything else. if (config.untitled_document) { if (config.createTemporaryIntegratedConsole) { - vscode.window.showErrorMessage("Debugging untitled files in a temporary console is not supported."); + await vscode.window.showErrorMessage("Debugging untitled files in a temporary console is not supported."); return undefined; } } else if (config.script) { const ext = path.extname(config.script).toLowerCase(); if (!(ext === ".ps1" || ext === ".psm1")) { - vscode.window.showErrorMessage(`PowerShell does not support debugging this file type: '${path.basename(config.script)}'`); + await vscode.window.showErrorMessage(`PowerShell does not support debugging this file type: '${path.basename(config.script)}'`); return undefined; } } @@ -262,13 +265,13 @@ export class DebugSessionFeature extends LanguageClientConsumer const platformDetails = getPlatformDetails(); const versionDetails = this.sessionManager.getPowerShellVersionDetails(); if (versionDetails === undefined) { - vscode.window.showErrorMessage(`Session version details were not found for ${config.name}`); + await vscode.window.showErrorMessage(`Session version details were not found for ${config.name}`); return null; } // Cross-platform attach to process was added in 6.2.0-preview.4. if (versionDetails.version < "7.0.0" && platformDetails.operatingSystem !== OperatingSystem.Windows) { - vscode.window.showErrorMessage(`Attaching to a PowerShell Host Process on ${OperatingSystem[platformDetails.operatingSystem]} requires PowerShell 7.0 or higher.`); + await vscode.window.showErrorMessage(`Attaching to a PowerShell Host Process on ${OperatingSystem[platformDetails.operatingSystem]} requires PowerShell 7.0 or higher.`); return undefined; } @@ -328,7 +331,7 @@ export class SpecifyScriptArgsFeature implements vscode.Disposable { // When user cancel's the input box (by pressing Esc), the text value is undefined. // Let's not blow away the previous setting. if (text !== undefined) { - this.context.workspaceState.update(powerShellDbgScriptArgsKey, text); + await this.context.workspaceState.update(powerShellDbgScriptArgsKey, text); } return text; } @@ -393,6 +396,7 @@ export class PickPSHostProcessFeature extends LanguageClientConsumer { (resolve, reject) => { this.getLanguageClientResolve = resolve; + // eslint-disable-next-line @typescript-eslint/no-floating-promises vscode.window .showQuickPick( ["Cancel"], @@ -411,6 +415,7 @@ export class PickPSHostProcessFeature extends LanguageClientConsumer { this.clearWaitingToken(); reject(); + // eslint-disable-next-line @typescript-eslint/no-floating-promises vscode.window.showErrorMessage( "Attach to PowerShell host process: PowerShell session took too long to start."); } @@ -519,6 +524,7 @@ export class PickRunspaceFeature extends LanguageClientConsumer { (resolve, reject) => { this.getLanguageClientResolve = resolve; + // eslint-disable-next-line @typescript-eslint/no-floating-promises vscode.window .showQuickPick( ["Cancel"], @@ -537,6 +543,7 @@ export class PickRunspaceFeature extends LanguageClientConsumer { this.clearWaitingToken(); reject(); + // eslint-disable-next-line @typescript-eslint/no-floating-promises vscode.window.showErrorMessage( "Attach to PowerShell host process: PowerShell session took too long to start."); } diff --git a/src/features/Examples.ts b/src/features/Examples.ts index 5b3856f1e0..ff1f59f7b5 100644 --- a/src/features/Examples.ts +++ b/src/features/Examples.ts @@ -11,8 +11,8 @@ export class ExamplesFeature implements vscode.Disposable { constructor() { this.examplesPath = vscode.Uri.file(path.resolve(__dirname, "../examples")); - this.command = vscode.commands.registerCommand("PowerShell.OpenExamplesFolder", () => { - vscode.commands.executeCommand("vscode.openFolder", this.examplesPath, true); + this.command = vscode.commands.registerCommand("PowerShell.OpenExamplesFolder", async () => { + await vscode.commands.executeCommand("vscode.openFolder", this.examplesPath, true); // Return existence of the path for testing. The `vscode.openFolder` // command should do this, but doesn't (yet). return utils.checkIfFileExists(this.examplesPath); diff --git a/src/features/ExpandAlias.ts b/src/features/ExpandAlias.ts index 94434b7722..6db957c215 100644 --- a/src/features/ExpandAlias.ts +++ b/src/features/ExpandAlias.ts @@ -22,7 +22,7 @@ export class ExpandAliasFeature extends LanguageClientConsumer { constructor() { super(); - this.command = vscode.commands.registerCommand("PowerShell.ExpandAlias", () => { + this.command = vscode.commands.registerCommand("PowerShell.ExpandAlias", async () => { const editor = Window.activeTextEditor; if (editor === undefined) { return; @@ -44,11 +44,12 @@ export class ExpandAliasFeature extends LanguageClientConsumer { range = new vscode.Range(sls.line, sls.character, sle.line, sle.character); } - this.languageClient?.sendRequest(ExpandAliasRequestType, { text }).then((result) => { - editor.edit((editBuilder) => { + const result = await this.languageClient?.sendRequest(ExpandAliasRequestType, { text }); + if (result !== undefined) { + await editor.edit((editBuilder) => { editBuilder.replace(range, result.text); }); - }); + } }); } diff --git a/src/features/ExtensionCommands.ts b/src/features/ExtensionCommands.ts index 58f009480d..ca6131c243 100644 --- a/src/features/ExtensionCommands.ts +++ b/src/features/ExtensionCommands.ts @@ -235,6 +235,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { this.languageClient.onRequest( InsertTextRequestType, + // eslint-disable-next-line @typescript-eslint/no-floating-promises (details) => this.insertText(details)), this.languageClient.onRequest( @@ -280,6 +281,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { // We check to see if they have TrueClear on. If not, no-op because the // overriden Clear-Host already calls [System.Console]::Clear() if (Settings.load().integratedConsole.forceClearScrollbackBuffer) { + // eslint-disable-next-line @typescript-eslint/no-floating-promises vscode.commands.executeCommand("workbench.action.terminal.clear"); } }) @@ -309,8 +311,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { private async showExtensionCommands(client: LanguageClient): Promise { // If no extension commands are available, show a message if (this.extensionCommands.length === 0) { - vscode.window.showInformationMessage( - "No extension commands have been loaded into the current session."); + await vscode.window.showInformationMessage("No extension commands have been loaded into the current session."); return; } @@ -329,12 +330,12 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { return this.onCommandSelected(selectedCommand, client); } - private onCommandSelected( + private async onCommandSelected( chosenItem: IExtensionCommandQuickPickItem | undefined, client: LanguageClient | undefined) { if (chosenItem !== undefined) { - client?.sendRequest( + await client?.sendRequest( InvokeExtensionCommandRequestType, { name: chosenItem.command.name, @@ -343,7 +344,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { } } - private insertText(details: IInsertTextRequestArguments): EditorOperationResponse { + private async insertText(details: IInsertTextRequestArguments): Promise { const edit = new vscode.WorkspaceEdit(); edit.set( @@ -359,7 +360,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { ], ); - vscode.workspace.applyEdit(edit); + await vscode.workspace.applyEdit(edit); return EditorOperationResponse.Completed; } @@ -461,7 +462,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { if (!saveFileDetails.newPath) { // TODO: Create a class handle vscode warnings and errors so we can warn easily // without logging - this.log.writeAndShowWarning( + await this.log.writeAndShowWarning( "Cannot save untitled file. Try SaveAs(\"path/to/file.ps1\") instead."); return EditorOperationResponse.Completed; } @@ -472,7 +473,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { } else { // In fresh contexts, workspaceFolders is not defined... if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) { - this.log.writeAndShowWarning("Cannot save file to relative path: no workspaces are open. " + + await this.log.writeAndShowWarning("Cannot save file to relative path: no workspaces are open. " + "Try saving to an absolute path, or open a workspace."); return EditorOperationResponse.Completed; } @@ -481,7 +482,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { const workspaceRootUri = vscode.workspace.workspaceFolders[0].uri; // We don't support saving to a non-file URI-schemed workspace if (workspaceRootUri.scheme !== "file") { - this.log.writeAndShowWarning( + await this.log.writeAndShowWarning( "Cannot save untitled file to a relative path in an untitled workspace. " + "Try saving to an absolute path or opening a workspace folder."); return EditorOperationResponse.Completed; @@ -521,7 +522,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { vscode.Uri.file(destinationAbsolutePath), Buffer.from(oldDocument.getText())); } catch (e) { - this.log.writeAndShowWarning(`<${ExtensionCommandsFeature.name}>: ` + + await this.log.writeAndShowWarning(`<${ExtensionCommandsFeature.name}>: ` + `Unable to save file to path '${destinationAbsolutePath}': ${e}`); return; } @@ -529,7 +530,7 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { // Finally open the new document const newFileUri = vscode.Uri.file(destinationAbsolutePath); const newFile = await vscode.workspace.openTextDocument(newFileUri); - vscode.window.showTextDocument(newFile, { preview: true }); + await vscode.window.showTextDocument(newFile, { preview: true }); } private normalizeFilePath(filePath: string): string { diff --git a/src/features/FindModule.ts b/src/features/FindModule.ts index 551d06529e..9819eae47f 100644 --- a/src/features/FindModule.ts +++ b/src/features/FindModule.ts @@ -31,34 +31,34 @@ export class FindModuleFeature extends LanguageClientConsumer { constructor() { super(); - this.command = vscode.commands.registerCommand("PowerShell.PowerShellFindModule", () => { + this.command = vscode.commands.registerCommand("PowerShell.PowerShellFindModule", async () => { // It takes a while to get the list of PowerShell modules, display some UI to let user know this.cancelFindToken = new vscode.CancellationTokenSource(); - vscode.window - .showQuickPick( - ["Cancel"], - { placeHolder: "Please wait, retrieving list of PowerShell modules. This can take some time..." }, - this.cancelFindToken.token) - .then((response) => { - if (response === "Cancel") { this.clearCancelFindToken(); } - }); + const response = await vscode.window.showQuickPick( + ["Cancel"], + { placeHolder: "Please wait, retrieving list of PowerShell modules. This can take some time..." }, + this.cancelFindToken.token); + + if (response === "Cancel") { + this.clearCancelFindToken(); + } // Cancel the loading prompt after 60 seconds setTimeout(() => { if (this.cancelFindToken) { this.clearCancelFindToken(); + // eslint-disable-next-line @typescript-eslint/no-floating-promises vscode.window.showErrorMessage( "The online source for PowerShell modules is not responding. " + "Cancelling Find/Install PowerShell command."); } }, 60000); - this.pickPowerShellModule().then((moduleName) => { - if (moduleName) { - this.languageClient?.sendRequest(InstallModuleRequestType, moduleName); - } - }); + const module = await this.pickPowerShellModule(); + if (module !== undefined) { + await this.languageClient?.sendRequest(InstallModuleRequestType, module); + } }); } diff --git a/src/features/GenerateBugReport.ts b/src/features/GenerateBugReport.ts index 9d60ab0c23..d7db34c500 100644 --- a/src/features/GenerateBugReport.ts +++ b/src/features/GenerateBugReport.ts @@ -30,7 +30,7 @@ export class GenerateBugReportFeature implements vscode.Disposable { private command: vscode.Disposable; constructor(private sessionManager: SessionManager) { - this.command = vscode.commands.registerCommand("PowerShell.GenerateBugReport", () => { + this.command = vscode.commands.registerCommand("PowerShell.GenerateBugReport", async () => { const body = `Issue Description ===== @@ -72,7 +72,7 @@ ${this.generateExtensionTable(extensions)} const encodedBody = encodeURIComponent(body); const fullUrl = `${issuesUrl}${queryStringPrefix}body=${encodedBody}`; - vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(fullUrl)); + await vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(fullUrl)); }); } diff --git a/src/features/GetCommands.ts b/src/features/GetCommands.ts index 7e87744c34..3e0c041267 100644 --- a/src/features/GetCommands.ts +++ b/src/features/GetCommands.ts @@ -25,46 +25,50 @@ export const GetCommandRequestType = new RequestType0("powerSh * A PowerShell Command listing feature. Implements a treeview control. */ export class GetCommandsFeature extends LanguageClientConsumer { - private command: vscode.Disposable; + private commands: vscode.Disposable[]; private commandsExplorerProvider: CommandsExplorerProvider; private commandsExplorerTreeView: vscode.TreeView; constructor(private log: Logger) { super(); - this.command = vscode.commands.registerCommand("PowerShell.RefreshCommandsExplorer", - () => this.CommandExplorerRefresh()); + this.commands = [ + vscode.commands.registerCommand("PowerShell.RefreshCommandsExplorer", + async () => await this.CommandExplorerRefresh()), + vscode.commands.registerCommand("PowerShell.InsertCommand", async (item) => await this.InsertCommand(item)) + ]; this.commandsExplorerProvider = new CommandsExplorerProvider(); this.commandsExplorerTreeView = vscode.window.createTreeView("PowerShellCommands", { treeDataProvider: this.commandsExplorerProvider }); // Refresh the command explorer when the view is visible - this.commandsExplorerTreeView.onDidChangeVisibility((e) => { + this.commandsExplorerTreeView.onDidChangeVisibility(async (e) => { if (e.visible) { - this.CommandExplorerRefresh(); + await this.CommandExplorerRefresh(); } }); - - vscode.commands.registerCommand("PowerShell.InsertCommand", (item) => this.InsertCommand(item)); } public dispose() { - this.command.dispose(); + for (const command of this.commands) { + command.dispose(); + } } public override setLanguageClient(languageclient: LanguageClient) { this.languageClient = languageclient; if (this.commandsExplorerTreeView.visible) { + // eslint-disable-next-line @typescript-eslint/no-floating-promises vscode.commands.executeCommand("PowerShell.RefreshCommandsExplorer"); } } - private CommandExplorerRefresh() { + private async CommandExplorerRefresh() { if (this.languageClient === undefined) { this.log.writeVerbose(`<${GetCommandsFeature.name}>: Unable to send getCommand request`); return; } - this.languageClient.sendRequest(GetCommandRequestType).then((result) => { + await this.languageClient.sendRequest(GetCommandRequestType).then((result) => { const SidebarConfig = vscode.workspace.getConfiguration("powershell.sideBar"); const excludeFilter = (SidebarConfig.CommandExplorerExcludeFilter).map((filter: string) => filter.toLowerCase()); result = result.filter((command) => (excludeFilter.indexOf(command.moduleName.toLowerCase()) === -1)); @@ -73,7 +77,7 @@ export class GetCommandsFeature extends LanguageClientConsumer { }); } - private InsertCommand(item: { Name: string; }) { + private async InsertCommand(item: { Name: string; }) { const editor = vscode.window.activeTextEditor; if (editor === undefined) { return; @@ -82,7 +86,7 @@ export class GetCommandsFeature extends LanguageClientConsumer { const sls = editor.selection.start; const sle = editor.selection.end; const range = new vscode.Range(sls.line, sls.character, sle.line, sle.character); - editor.edit((editBuilder) => { + await editor.edit((editBuilder) => { editBuilder.replace(range, item.Name); }); } @@ -139,10 +143,10 @@ class Command extends vscode.TreeItem { }; } - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/require-await public async getChildren(_element?: any): Promise { - return []; // Returning an empty array because we need to return something. + return []; } } diff --git a/src/features/HelpCompletion.ts b/src/features/HelpCompletion.ts index 5fe3964cc1..ac4b8d77f3 100644 --- a/src/features/HelpCompletion.ts +++ b/src/features/HelpCompletion.ts @@ -189,7 +189,7 @@ class HelpCompletionProvider { const snippetString = new SnippetString(text); - window.activeTextEditor?.insertSnippet(snippetString, replaceRange); + await window.activeTextEditor?.insertSnippet(snippetString, replaceRange); } private getEOL(eol: EndOfLine): string { diff --git a/src/features/NewFileOrProject.ts b/src/features/NewFileOrProject.ts index cd65d05239..00d665e73f 100644 --- a/src/features/NewFileOrProject.ts +++ b/src/features/NewFileOrProject.ts @@ -15,35 +15,33 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { constructor() { super(); this.command = - vscode.commands.registerCommand("PowerShell.NewProjectFromTemplate", () => { + vscode.commands.registerCommand("PowerShell.NewProjectFromTemplate", async () => { if (!this.languageClient && !this.waitingForClientToken) { // If PowerShell isn't finished loading yet, show a loading message // until the LanguageClient is passed on to us this.waitingForClientToken = new vscode.CancellationTokenSource(); - vscode.window - .showQuickPick( - ["Cancel"], - { placeHolder: "New Project: Please wait, starting PowerShell..." }, - this.waitingForClientToken.token) - .then((response) => { - if (response === "Cancel") { - this.clearWaitingToken(); - } - }); + const response = await vscode.window.showQuickPick( + ["Cancel"], + { placeHolder: "New Project: Please wait, starting PowerShell..." }, + this.waitingForClientToken.token); + + if (response === "Cancel") { + this.clearWaitingToken(); + } // Cancel the loading prompt after 60 seconds setTimeout(() => { if (this.waitingForClientToken) { this.clearWaitingToken(); - vscode.window.showErrorMessage( - "New Project: PowerShell session took too long to start."); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + vscode.window.showErrorMessage("New Project: PowerShell session took too long to start."); } }, 60000); } else { - this.showProjectTemplates(); + await this.showProjectTemplates(); } }); } @@ -57,6 +55,7 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { if (this.waitingForClientToken) { this.clearWaitingToken(); + // eslint-disable-next-line @typescript-eslint/no-floating-promises this.showProjectTemplates(); } } @@ -72,9 +71,9 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { if (template === undefined) { return; } else if (template.label.startsWith(this.loadIcon)) { - this.showProjectTemplates(true); + await this.showProjectTemplates(true); } else if (template.template) { - this.createProjectFromTemplate(template.template); + await this.createProjectFromTemplate(template.template); } } @@ -89,7 +88,7 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { if (response.needsModuleInstall) { // TODO: Offer to install Plaster - vscode.window.showErrorMessage("Plaster is not installed!"); + await vscode.window.showErrorMessage("Plaster is not installed!"); return Promise.reject("Plaster needs to be installed"); } else { let templates = response.templates.map( @@ -133,13 +132,13 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { if (destinationPath !== undefined) { // Show the PowerShell session output in case an error occurred - vscode.commands.executeCommand("PowerShell.ShowSessionOutput"); + await vscode.commands.executeCommand("PowerShell.ShowSessionOutput"); const result = await this.languageClient?.sendRequest( NewProjectFromTemplateRequestType, { templatePath: template.templatePath, destinationPath }); if (result?.creationSuccessful) { - this.openWorkspacePath(destinationPath); + await this.openWorkspacePath(destinationPath); } else { await vscode.window.showErrorMessage("Project creation failed, read the Output window for more details."); } @@ -148,14 +147,14 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { "New Project: You must enter an absolute folder path to continue. Try again?", "Yes", "No"); if (response === "Yes") { - this.createProjectFromTemplate(template); + await this.createProjectFromTemplate(template); } } } - private openWorkspacePath(workspacePath: string) { + private async openWorkspacePath(workspacePath: string) { // Open the created project in a new window - vscode.commands.executeCommand( + await vscode.commands.executeCommand( "vscode.openFolder", vscode.Uri.file(workspacePath), true); diff --git a/src/features/RemoteFiles.ts b/src/features/RemoteFiles.ts index 82a398edf9..ebb8edce4f 100644 --- a/src/features/RemoteFiles.ts +++ b/src/features/RemoteFiles.ts @@ -22,7 +22,7 @@ export const DidSaveTextDocumentNotificationType = "textDocument/didSave"); export class RemoteFilesFeature extends LanguageClientConsumer { - + private command: vscode.Disposable; private tempSessionPathPrefix: string; constructor() { @@ -36,9 +36,9 @@ export class RemoteFilesFeature extends LanguageClientConsumer { // At startup, close any lingering temporary remote files this.closeRemoteFiles(); - vscode.workspace.onDidSaveTextDocument((doc) => { + this.command = vscode.workspace.onDidSaveTextDocument(async (doc) => { if (this.isDocumentRemote(doc) && this.languageClient) { - this.languageClient.sendNotification( + await this.languageClient.sendNotification( DidSaveTextDocumentNotificationType, { textDocument: TextDocumentIdentifier.create(doc.uri.toString()), @@ -48,6 +48,7 @@ export class RemoteFilesFeature extends LanguageClientConsumer { } public dispose() { + this.command?.dispose(); // Close any leftover remote files before exiting this.closeRemoteFiles(); } @@ -71,6 +72,7 @@ export class RemoteFilesFeature extends LanguageClientConsumer { return await innerCloseFiles(); } + // eslint-disable-next-line @typescript-eslint/no-floating-promises innerCloseFiles(); } } diff --git a/src/features/RunCode.ts b/src/features/RunCode.ts index db1a8546b3..269ceebe9c 100644 --- a/src/features/RunCode.ts +++ b/src/features/RunCode.ts @@ -11,14 +11,13 @@ enum LaunchType { } export class RunCodeFeature implements vscode.Disposable { - private command: vscode.Disposable; constructor(private sessionManager: SessionManager) { this.command = vscode.commands.registerCommand( "PowerShell.RunCode", - (runInDebugger: boolean, scriptToRun: string, args: string[]) => { - this.launchTask(runInDebugger, scriptToRun, args); + async (runInDebugger: boolean, scriptToRun: string, args: string[]) => { + await this.launchTask(runInDebugger, scriptToRun, args); }); } diff --git a/src/features/ShowHelp.ts b/src/features/ShowHelp.ts index 135d6caa2f..2db801bf42 100644 --- a/src/features/ShowHelp.ts +++ b/src/features/ShowHelp.ts @@ -17,7 +17,7 @@ export class ShowHelpFeature extends LanguageClientConsumer { constructor() { super(); - this.command = vscode.commands.registerCommand("PowerShell.ShowHelp", (item?) => { + this.command = vscode.commands.registerCommand("PowerShell.ShowHelp", async (item?) => { if (!item || !item.Name) { const editor = vscode.window.activeTextEditor; @@ -30,9 +30,9 @@ export class ShowHelpFeature extends LanguageClientConsumer { const cwr = doc.getWordRangeAtPosition(selection.active); const text = doc.getText(cwr); - this.languageClient?.sendNotification(ShowHelpNotificationType, { text }); + await this.languageClient?.sendNotification(ShowHelpNotificationType, { text }); } else { - this.languageClient?.sendNotification(ShowHelpNotificationType, { text: item.Name }); + await this.languageClient?.sendNotification(ShowHelpNotificationType, { text: item.Name }); } }); } diff --git a/src/features/UpdatePowerShell.ts b/src/features/UpdatePowerShell.ts index b53ee0d5cc..28e1f3663d 100644 --- a/src/features/UpdatePowerShell.ts +++ b/src/features/UpdatePowerShell.ts @@ -152,7 +152,7 @@ export async function InvokePowerShellUpdateCheck( }); // Stop the session because Windows likes to hold on to files. - sessionManager.stop(); + await sessionManager.stop(); // Close all terminals with the name "pwsh" in the current VS Code session. // This will encourage folks to not close the instance of VS Code that spawned @@ -166,9 +166,10 @@ export async function InvokePowerShellUpdateCheck( // Invoke the MSI via cmd. const msi = spawn("msiexec", ["/i", msiDownloadPath]); - msi.on("close", async () => { + msi.on("close", () => { // Now that the MSI is finished, restart the session. - await sessionManager.start(); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + sessionManager.start(); fs.unlinkSync(msiDownloadPath); }); diff --git a/src/languageClientConsumer.ts b/src/languageClientConsumer.ts index d191c366c1..4ff998d0c2 100644 --- a/src/languageClientConsumer.ts +++ b/src/languageClientConsumer.ts @@ -16,6 +16,7 @@ export abstract class LanguageClientConsumer { public get languageClient(): LanguageClient | undefined { if (!this._languageClient) { + // eslint-disable-next-line @typescript-eslint/no-floating-promises window.showInformationMessage( "PowerShell extension has not finished starting up yet. Please try again in a few moments."); } diff --git a/src/logging.ts b/src/logging.ts index 81c535ab84..86834318b7 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -22,7 +22,7 @@ export interface ILogger { writeDiagnostic(message: string, ...additionalMessages: string[]): void; writeVerbose(message: string, ...additionalMessages: string[]): void; writeWarning(message: string, ...additionalMessages: string[]): void; - writeAndShowWarning(message: string, ...additionalMessages: string[]): void; + writeAndShowWarning(message: string, ...additionalMessages: string[]): Promise; writeError(message: string, ...additionalMessages: string[]): void; } @@ -62,9 +62,11 @@ export class Logger implements ILogger { private writeAtLevel(logLevel: LogLevel, message: string, ...additionalMessages: string[]): void { if (logLevel >= this.MinimumLogLevel) { + // eslint-disable-next-line @typescript-eslint/no-floating-promises this.writeLine(message, logLevel); for (const additionalMessage of additionalMessages) { + // eslint-disable-next-line @typescript-eslint/no-floating-promises this.writeLine(additionalMessage, logLevel); } } @@ -86,14 +88,13 @@ export class Logger implements ILogger { this.writeAtLevel(LogLevel.Warning, message, ...additionalMessages); } - public writeAndShowWarning(message: string, ...additionalMessages: string[]): void { + public async writeAndShowWarning(message: string, ...additionalMessages: string[]): Promise { this.writeWarning(message, ...additionalMessages); - vscode.window.showWarningMessage(message, "Show Logs").then((selection) => { - if (selection !== undefined) { - this.showLogPanel(); - } - }); + const selection = await vscode.window.showWarningMessage(message, "Show Logs"); + if (selection !== undefined) { + this.showLogPanel(); + } } public writeError(message: string, ...additionalMessages: string[]): void { @@ -116,7 +117,7 @@ export class Logger implements ILogger { const fullActions = [ ...actions, - { prompt: "Show Logs", action: async () => { this.showLogPanel(); } }, + { prompt: "Show Logs", action: () => { this.showLogPanel(); } }, ]; const actionKeys: string[] = fullActions.map((action) => action.prompt); diff --git a/src/main.ts b/src/main.ts index bdaa0dd4d7..0a803a1a7b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -57,7 +57,7 @@ export async function activate(context: vscode.ExtensionContext): Promise this.onTerminalClose(terminal)); // Log that the PowerShell terminal process has been started - this.consoleTerminal.processId.then((pid) => this.logTerminalPid(pid ?? 0, pwshName)); + const pid = await this.consoleTerminal.processId; + this.logTerminalPid(pid ?? 0, pwshName); return sessionDetails; } @@ -141,11 +142,11 @@ export class PowerShellProcess { this.consoleTerminal?.show(preserveFocus); } - public dispose() { + public async dispose() { // Clean up the session file this.log.write("Terminating PowerShell process..."); - PowerShellProcess.deleteSessionFile(this.sessionFilePath); + await PowerShellProcess.deleteSessionFile(this.sessionFilePath); this.consoleCloseSubscription?.dispose(); this.consoleCloseSubscription = undefined; @@ -204,12 +205,12 @@ export class PowerShellProcess { if (await utils.checkIfFileExists(this.sessionFilePath)) { this.log.write("Session file found!"); const sessionDetails = await PowerShellProcess.readSessionFile(this.sessionFilePath); - PowerShellProcess.deleteSessionFile(this.sessionFilePath); + await PowerShellProcess.deleteSessionFile(this.sessionFilePath); return sessionDetails; } if (warnAt === i) { - vscode.window.showWarningMessage(`Loading the PowerShell extension is taking longer than expected. + await vscode.window.showWarningMessage(`Loading the PowerShell extension is taking longer than expected. If you're using privilege enforcement software, this can affect start up performance.`); } diff --git a/src/session.ts b/src/session.ts index 70681a622d..b509ab2062 100644 --- a/src/session.ts +++ b/src/session.ts @@ -111,13 +111,8 @@ export class SessionManager implements Middleware { // Create the language status item this.languageStatusItem = this.createStatusBarItem(); - - // Create a folder for the session files. this.sessionsFolder = vscode.Uri.joinPath(extensionContext.globalStorageUri, "sessions"); - vscode.workspace.fs.createDirectory(this.sessionsFolder); - this.platformDetails = getPlatformDetails(); - this.HostName = hostName; this.HostVersion = hostVersion; @@ -148,7 +143,7 @@ export class SessionManager implements Middleware { command.dispose(); } - this.languageClient?.dispose(); + await this.languageClient?.dispose(); } public setLanguageClientConsumers(languageClientConsumers: LanguageClientConsumer[]) { @@ -166,6 +161,8 @@ export class SessionManager implements Middleware { if (exeNameOverride) { this.sessionSettings.powerShellDefaultVersion = exeNameOverride; } + // Create a folder for the session files. + await vscode.workspace.fs.createDirectory(this.sessionsFolder); await this.log.startNewLog(this.sessionSettings.developer.editorServicesLogLevel); await this.promptPowerShellExeSettingsCleanup(); await this.migrateWhitespaceAroundPipeSetting(); @@ -183,9 +180,9 @@ export class SessionManager implements Middleware { if (this.sessionStatus === SessionStatus.Failed) { // Before moving further, clear out the client and process if // the process is already dead (i.e. it crashed). - this.languageClient?.dispose(); + await this.languageClient?.dispose(); this.languageClient = undefined; - this.languageServerProcess?.dispose(); + await this.languageServerProcess?.dispose(); this.languageServerProcess = undefined; } @@ -193,16 +190,16 @@ export class SessionManager implements Middleware { // Stop the language client. await this.languageClient?.stop(); - this.languageClient?.dispose(); + await this.languageClient?.dispose(); this.languageClient = undefined; // Kill the PowerShell process(es) we spawned. - this.debugSessionProcess?.dispose(); + await this.debugSessionProcess?.dispose(); this.debugSessionProcess = undefined; this.debugEventHandler?.dispose(); this.debugEventHandler = undefined; - this.languageServerProcess?.dispose(); + await this.languageServerProcess?.dispose(); this.languageServerProcess = undefined; } finally { @@ -243,7 +240,7 @@ export class SessionManager implements Middleware { // support more, we need to track each separately, and tie the session // for the event handler to the right process (and dispose of the event // handler when the process is disposed). - this.debugSessionProcess?.dispose(); + await this.debugSessionProcess?.dispose(); this.debugEventHandler?.dispose(); if (this.PowerShellExeDetails === undefined) { @@ -344,8 +341,8 @@ export class SessionManager implements Middleware { const configuration = vscode.workspace.getConfiguration(utils.PowerShellLanguageId); const deprecatedSetting = "codeFormatting.whitespaceAroundPipe"; const newSetting = "codeFormatting.addWhitespaceAroundPipe"; - const configurationTargetOfNewSetting = await Settings.getEffectiveConfigurationTarget(newSetting); - const configurationTargetOfOldSetting = await Settings.getEffectiveConfigurationTarget(deprecatedSetting); + const configurationTargetOfNewSetting = Settings.getEffectiveConfigurationTarget(newSetting); + const configurationTargetOfOldSetting = Settings.getEffectiveConfigurationTarget(deprecatedSetting); if (configurationTargetOfOldSetting !== undefined && configurationTargetOfNewSetting === undefined) { const value = configuration.get(deprecatedSetting, configurationTargetOfOldSetting); await Settings.change(newSetting, value, configurationTargetOfOldSetting); @@ -514,7 +511,7 @@ export class SessionManager implements Middleware { prompt: "Get PowerShell", action: async () => { const getPSUri = vscode.Uri.parse("https://aka.ms/get-powershell-vscode"); - vscode.env.openExternal(getPSUri); + await vscode.env.openExternal(getPSUri); }, }, ]); @@ -591,7 +588,7 @@ Type 'help' to get help. } } - private async sendTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measures?: TelemetryEventMeasurements) { + private sendTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measures?: TelemetryEventMeasurements) { if (this.extensionContext.extensionMode === vscode.ExtensionMode.Production) { this.telemetryReporter.sendTelemetryEvent(eventName, properties, measures); } @@ -698,6 +695,7 @@ Type 'help' to get help. this.started = true; // NOTE: We specifically don't want to wait for this. + // eslint-disable-next-line @typescript-eslint/no-floating-promises this.checkForPowerShellUpdate(); } @@ -869,13 +867,13 @@ Type 'help' to get help. .map((item) => { return new SessionMenuItem( `Switch to: ${item.displayName}`, - () => { this.changePowerShellDefaultVersion(item); }); + async () => { await this.changePowerShellDefaultVersion(item); }); }); const menuItems: SessionMenuItem[] = [ new SessionMenuItem( sessionText, - () => { vscode.commands.executeCommand("PowerShell.ShowLogs"); }), + async () => { await vscode.commands.executeCommand("PowerShell.ShowLogs"); }), // Add all of the different PowerShell options ...powerShellItems, @@ -894,17 +892,15 @@ Type 'help' to get help. new SessionMenuItem( "Open Session Logs Folder", - () => { vscode.commands.executeCommand("PowerShell.OpenLogFolder"); }), + async () => { await vscode.commands.executeCommand("PowerShell.OpenLogFolder"); }), new SessionMenuItem( "Modify list of additional PowerShell locations", - () => { vscode.commands.executeCommand("workbench.action.openSettings", "powerShellAdditionalExePaths"); }), + async () => { await vscode.commands.executeCommand("workbench.action.openSettings", "powerShellAdditionalExePaths"); }), ]; - vscode - .window - .showQuickPick(menuItems) - .then((selectedItem) => { selectedItem?.callback(); }); + const selectedItem = await vscode.window.showQuickPick(menuItems); + await selectedItem?.callback(); } } @@ -914,6 +910,6 @@ class SessionMenuItem implements vscode.QuickPickItem { constructor( public readonly label: string, // eslint-disable-next-line @typescript-eslint/no-empty-function - public readonly callback: () => void = () => { }) { + public readonly callback = async () => { }) { } } diff --git a/src/settings.ts b/src/settings.ts index e207027de8..05b452e4cf 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -280,7 +280,7 @@ export function load(): ISettings { } // Get the ConfigurationTarget (read: scope) of where the *effective* setting value comes from -export async function getEffectiveConfigurationTarget(settingName: string): Promise { +export function getEffectiveConfigurationTarget(settingName: string): vscode.ConfigurationTarget | undefined { const configuration = vscode.workspace.getConfiguration(utils.PowerShellLanguageId); const detail = configuration.inspect(settingName); if (detail === undefined) { diff --git a/test/core/platform.test.ts b/test/core/platform.test.ts index 61de501296..bbdeca8b25 100644 --- a/test/core/platform.test.ts +++ b/test/core/platform.test.ts @@ -15,6 +15,7 @@ import * as vscode from "vscode"; // overrides the fs module but not the vscode.workspace.fs module. const platformMock = rewire("../../src/platform"); +// eslint-disable-next-line @typescript-eslint/require-await async function fakeCheckIfFileOrDirectoryExists(targetPath: string | vscode.Uri): Promise { try { fs.lstatSync(targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath); @@ -24,6 +25,7 @@ async function fakeCheckIfFileOrDirectoryExists(targetPath: string | vscode.Uri) } } +// eslint-disable-next-line @typescript-eslint/require-await async function fakeReadDirectory(targetPath: string | vscode.Uri): Promise { return fs.readdirSync(targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath); } diff --git a/test/core/settings.test.ts b/test/core/settings.test.ts index 687f7aa906..c245209383 100644 --- a/test/core/settings.test.ts +++ b/test/core/settings.test.ts @@ -10,40 +10,18 @@ describe("Settings module", function () { assert.doesNotThrow(Settings.load); }); - it("Updates correctly with 'then' syntax", async function () { - Settings.change("helpCompletion", "BlockComment", false).then(() => - assert.strictEqual(Settings.load().helpCompletion, "BlockComment")); - }); - - it("Updates correctly with 'async/await' syntax", async function () { + it("Updates correctly", async function () { await Settings.change("helpCompletion", "LineComment", false); assert.strictEqual(Settings.load().helpCompletion, "LineComment"); }); - describe("User-only settings", async function () { - const psExeDetails = { - "My PowerShell": "dummyPath", - }; - - it("Throws when updating at workspace-level", async function () { - assert.rejects(async () => await Settings.change("powerShellAdditionalExePaths", psExeDetails, false /* workspace-level */)); - }); - - it("Doesn't throw when updating at user-level", async function () { - await Settings.change("powerShellAdditionalExePaths", psExeDetails, true /* user-level */); - const result = Settings.load().powerShellAdditionalExePaths!["My PowerShell"]; - assert.notStrictEqual(result, undefined); - assert.strictEqual(result, psExeDetails["My PowerShell"]); - }); - }); - it("Gets the effective configuration target", async function () { await Settings.change("helpCompletion", "LineComment", false); - let target = await Settings.getEffectiveConfigurationTarget("helpCompletion"); + let target = Settings.getEffectiveConfigurationTarget("helpCompletion"); assert.strictEqual(target, vscode.ConfigurationTarget.Workspace); await Settings.change("helpCompletion", undefined, false); - target = await Settings.getEffectiveConfigurationTarget("helpCompletion"); + target = Settings.getEffectiveConfigurationTarget("helpCompletion"); assert.strictEqual(target, undefined); }); }); diff --git a/test/features/CustomViews.test.ts b/test/features/CustomViews.test.ts index 3576616203..88ccbc7b1a 100644 --- a/test/features/CustomViews.test.ts +++ b/test/features/CustomViews.test.ts @@ -29,7 +29,7 @@ function convertToVSCodeResourceScheme(filePath: string): string { return vscode.Uri.file(filePath).toString().replace("file://", "vscode-resource://"); } -describe("CustomViews feature", async function () { +describe("CustomViews feature", function () { const testCases: IHtmlContentViewTestCase[] = [ { name: "with no JavaScript or CSS", diff --git a/test/features/ExternalApi.test.ts b/test/features/ExternalApi.test.ts index 8a769dcd17..84fe48af96 100644 --- a/test/features/ExternalApi.test.ts +++ b/test/features/ExternalApi.test.ts @@ -31,11 +31,10 @@ describe("ExternalApi feature", function () { }); it("Rejects if not registered", async function () { - assert.rejects( - async () => await extension.getPowerShellVersionDetails("")); + await assert.rejects(async () => await extension.getPowerShellVersionDetails("")); }); - it("Throws if attempting to register an extension more than once", async function () { + it("Throws if attempting to register an extension more than once", function () { const sessionId: string = extension.registerExternalExtension(utils.extensionId); try { assert.throws( @@ -48,7 +47,7 @@ describe("ExternalApi feature", function () { } }); - it("Throws when unregistering an extension that isn't registered", async function () { + it("Throws when unregistering an extension that isn't registered", function () { assert.throws( () => extension.unregisterExternalExtension("not-real"), { diff --git a/test/features/ISECompatibility.test.ts b/test/features/ISECompatibility.test.ts index 5531dfc3bc..01d8504cf8 100644 --- a/test/features/ISECompatibility.test.ts +++ b/test/features/ISECompatibility.test.ts @@ -25,7 +25,7 @@ describe("ISE compatibility feature", function () { assert.strictEqual(vscode.workspace.getConfiguration("workbench").get("colorTheme"), currentTheme); }); - describe("Enable ISE Mode updates expected settings", async function () { + describe("Enable ISE Mode updates expected settings", function () { before(enableISEMode); after(disableISEMode); for (const iseSetting of ISECompatibilityFeature.settings) { @@ -36,7 +36,7 @@ describe("ISE compatibility feature", function () { } }); - describe("Disable ISE Mode reverts expected settings", async function () { + describe("Disable ISE Mode reverts expected settings", function () { before(enableISEMode); before(disableISEMode); after(disableISEMode); @@ -48,7 +48,7 @@ describe("ISE compatibility feature", function () { } }); - describe("Toggle switches from enabled to disabled", async function () { + describe("Toggle switches from enabled to disabled", function () { before(enableISEMode); before(toggleISEMode); after(disableISEMode); @@ -60,7 +60,7 @@ describe("ISE compatibility feature", function () { } }); - describe("Toggle switches from disabled to enabled", async function () { + describe("Toggle switches from disabled to enabled", function () { before(disableISEMode); before(toggleISEMode); after(disableISEMode); @@ -72,7 +72,7 @@ describe("ISE compatibility feature", function () { } }); - describe("Color theme interactions", async function () { + describe("Color theme interactions", function () { beforeEach(enableISEMode); function assertISESettings() { diff --git a/test/runTests.ts b/test/runTests.ts index 7a98901020..e3cec43047 100644 --- a/test/runTests.ts +++ b/test/runTests.ts @@ -33,4 +33,5 @@ async function main() { } } +// eslint-disable-next-line @typescript-eslint/no-floating-promises main(); From 97d6a26b903d8331f0dfa707d7557ff6fea23f81 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Wed, 19 Oct 2022 12:21:25 -0700 Subject: [PATCH 12/16] Enable 'await-thenable', 'unbound-method' and 'restrict-plus-operands' --- .eslintrc.json | 9 +++++++++ src/features/HelpCompletion.ts | 4 +--- src/features/OpenInISE.ts | 2 +- src/logging.ts | 2 +- src/platform.ts | 3 ++- src/session.ts | 2 +- test/core/platform.test.ts | 12 ++++++------ 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f269c18efa..fada630e2f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -52,6 +52,15 @@ "@typescript-eslint/no-floating-promises": [ "error" ], + "@typescript-eslint/await-thenable": [ + "error" + ], + "@typescript-eslint/unbound-method": [ + "error" + ], + "@typescript-eslint/restrict-plus-operands": [ + "error" + ], "header/header": [ 2, "line", diff --git a/src/features/HelpCompletion.ts b/src/features/HelpCompletion.ts index ac4b8d77f3..d40cf44579 100644 --- a/src/features/HelpCompletion.ts +++ b/src/features/HelpCompletion.ts @@ -36,9 +36,7 @@ export class HelpCompletionFeature extends LanguageClientConsumer { if (this.settings.helpCompletion !== Settings.CommentType.Disabled) { this.helpCompletionProvider = new HelpCompletionProvider(); - const subscriptions: Disposable[] = []; - workspace.onDidChangeTextDocument(this.onEvent, this, subscriptions); - this.disposable = Disposable.from(...subscriptions); + this.disposable = workspace.onDidChangeTextDocument(async (e) => { await this.onEvent(e); }); } } diff --git a/src/features/OpenInISE.ts b/src/features/OpenInISE.ts index 01dd445e86..7bc7826bbd 100644 --- a/src/features/OpenInISE.ts +++ b/src/features/OpenInISE.ts @@ -26,7 +26,7 @@ export class OpenInISEFeature implements vscode.Disposable { ISEPath += "\\WindowsPowerShell\\v1.0\\powershell_ise.exe"; - ChildProcess.exec(ISEPath + ` -File "${uri.fsPath}"`).unref(); + ChildProcess.exec(`${ISEPath} -File "${uri.fsPath}"`).unref(); }); } diff --git a/src/logging.ts b/src/logging.ts index 86834318b7..cf3f68d907 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -126,7 +126,7 @@ export class Logger implements ILogger { if (choice) { for (const action of fullActions) { if (choice === action.prompt) { - await action.action(); + action.action(); return; } } diff --git a/src/platform.ts b/src/platform.ts index 23c9cbd6da..f7b0257ee0 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -4,6 +4,7 @@ import * as os from "os"; import * as path from "path"; import * as process from "process"; +import { integer } from "vscode-languageserver-protocol"; import { IPowerShellAdditionalExePathSettings } from "./settings"; // This uses require so we can rewire it in unit tests! @@ -339,7 +340,7 @@ export class PowerShellExeFinder { // We are looking for something like "7-preview" // Preview dirs all have dashes in them - const dashIndex = item.indexOf("-"); + const dashIndex: integer = item.indexOf("-"); if (dashIndex < 0) { continue; } diff --git a/src/session.ts b/src/session.ts index b509ab2062..11472338a3 100644 --- a/src/session.ts +++ b/src/session.ts @@ -232,7 +232,7 @@ export class SessionManager implements Middleware { public getNewSessionFilePath(): vscode.Uri { const uniqueId: number = Math.floor(100000 + Math.random() * 900000); - return vscode.Uri.joinPath(this.sessionsFolder, "PSES-VSCode-" + process.env.VSCODE_PID + "-" + uniqueId + ".json"); + return vscode.Uri.joinPath(this.sessionsFolder, `PSES-VSCode-${process.env.VSCODE_PID}-${uniqueId}.json`); } public async createDebugSessionProcess(settings: Settings.ISettings): Promise { diff --git a/test/core/platform.test.ts b/test/core/platform.test.ts index bbdeca8b25..30129bc702 100644 --- a/test/core/platform.test.ts +++ b/test/core/platform.test.ts @@ -719,9 +719,9 @@ describe("Platform module", function () { const defaultPowerShell = await powerShellExeFinder.getFirstAvailablePowerShellInstallation(); const expectedPowerShell = testPlatform.expectedPowerShellSequence[0]; - assert.strictEqual(defaultPowerShell.exePath, expectedPowerShell!.exePath); - assert.strictEqual(defaultPowerShell.displayName, expectedPowerShell!.displayName); - assert.strictEqual(defaultPowerShell.supportsProperArguments, expectedPowerShell!.supportsProperArguments); + assert.strictEqual(defaultPowerShell.exePath, expectedPowerShell.exePath); + assert.strictEqual(defaultPowerShell.displayName, expectedPowerShell.displayName); + assert.strictEqual(defaultPowerShell.supportsProperArguments, expectedPowerShell.supportsProperArguments); }); } @@ -755,9 +755,9 @@ describe("Platform module", function () { const foundPowerShell = foundPowerShells[i]; const expectedPowerShell = testPlatform.expectedPowerShellSequence[i]; - assert.strictEqual(foundPowerShell && foundPowerShell.exePath, expectedPowerShell!.exePath); - assert.strictEqual(foundPowerShell && foundPowerShell.displayName, expectedPowerShell!.displayName); - assert.strictEqual(foundPowerShell && foundPowerShell.supportsProperArguments, expectedPowerShell!.supportsProperArguments); + assert.strictEqual(foundPowerShell && foundPowerShell.exePath, expectedPowerShell.exePath); + assert.strictEqual(foundPowerShell && foundPowerShell.displayName, expectedPowerShell.displayName); + assert.strictEqual(foundPowerShell && foundPowerShell.supportsProperArguments, expectedPowerShell.supportsProperArguments); } assert.strictEqual( From 7d62af774054b1e3c11e82aa2422797a437a6bf8 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Wed, 19 Oct 2022 12:25:04 -0700 Subject: [PATCH 13/16] Enable '@typescript-eslint/recommended-requiring-type-checking' We selectively fixed and enabled most of its warnings, and then disabled the ones we cannot (for now) fix (mostly due to use of `any`). --- .eslintrc.json | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index fada630e2f..ae16d138fa 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,7 +5,8 @@ }, "extends": [ "eslint:recommended", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" ], "overrides": [], "parser": "@typescript-eslint/parser", @@ -43,23 +44,23 @@ "argsIgnorePattern": "^_" } ], - "@typescript-eslint/require-await": [ - "error" + "@typescript-eslint/no-unsafe-argument": [ + "off" ], - "@typescript-eslint/no-misused-promises": [ - "error" + "@typescript-eslint/no-unsafe-assignment": [ + "off" ], - "@typescript-eslint/no-floating-promises": [ - "error" + "@typescript-eslint/no-unsafe-call": [ + "off" ], - "@typescript-eslint/await-thenable": [ - "error" + "@typescript-eslint/no-unsafe-member-access": [ + "off" ], - "@typescript-eslint/unbound-method": [ - "error" + "@typescript-eslint/no-unsafe-return": [ + "off" ], - "@typescript-eslint/restrict-plus-operands": [ - "error" + "@typescript-eslint/restrict-template-expressions": [ + "off" ], "header/header": [ 2, From d74b328459a5bbb1b74fe7756c2ef2efc718eb72 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Wed, 19 Oct 2022 13:12:49 -0700 Subject: [PATCH 14/16] Enable '@typescript-eslint/strict' --- .eslintrc.json | 3 +- src/features/Console.ts | 2 +- src/features/CustomViews.ts | 44 ++++++++------------ src/features/ExtensionCommands.ts | 27 ++---------- src/features/GetCommands.ts | 2 +- src/features/HelpCompletion.ts | 12 +++--- src/features/PesterTests.ts | 68 +++++++++++++++++-------------- src/features/RemoteFiles.ts | 2 +- src/platform.ts | 6 +-- src/session.ts | 3 ++ src/settings.ts | 16 +++----- test/core/platform.test.ts | 6 +-- 12 files changed, 85 insertions(+), 106 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index ae16d138fa..54639ae29a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,8 @@ "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@typescript-eslint/strict" ], "overrides": [], "parser": "@typescript-eslint/parser", diff --git a/src/features/Console.ts b/src/features/Console.ts index 5074c2ffcf..8262e623f5 100644 --- a/src/features/Console.ts +++ b/src/features/Console.ts @@ -71,7 +71,7 @@ function showChoicePrompt(promptDetails: IShowChoicePromptRequestArgs): Thenable }; }); - if (promptDetails.defaultChoices && promptDetails.defaultChoices.length > 0) { + if (promptDetails.defaultChoices.length > 0) { // Shift the default items to the front of the // array so that the user can select it easily const defaultChoice = promptDetails.defaultChoices[0]; diff --git a/src/features/CustomViews.ts b/src/features/CustomViews.ts index d95f358463..31d21cbca2 100644 --- a/src/features/CustomViews.ts +++ b/src/features/CustomViews.ts @@ -72,7 +72,7 @@ export class CustomViewsFeature extends LanguageClientConsumer { class PowerShellContentProvider implements vscode.TextDocumentContentProvider { - private viewIndex: { [id: string]: CustomView } = {}; + private viewIndex: Record = {}; private didChangeEvent: vscode.EventEmitter = new vscode.EventEmitter(); public onDidChange: vscode.Event = this.didChangeEvent.event; @@ -99,10 +99,12 @@ class PowerShellContentProvider implements vscode.TextDocumentContentProvider { public closeView(id: string) { const uriString = this.getUri(id); - vscode.workspace.textDocuments.some(async (doc) => { + vscode.workspace.textDocuments.some((doc) => { if (doc.uri.toString() === uriString) { - await vscode.window.showTextDocument(doc); - await vscode.commands.executeCommand("workbench.action.closeActiveEditor"); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + vscode.window.showTextDocument(doc); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + vscode.commands.executeCommand("workbench.action.closeActiveEditor"); return true; } @@ -114,20 +116,16 @@ class PowerShellContentProvider implements vscode.TextDocumentContentProvider { const uriString = this.getUri(id); const view: CustomView = this.viewIndex[uriString]; - if (view.viewType === CustomViewType.HtmlContent) { - (view as HtmlContentView).setContent(content); - this.didChangeEvent.fire(vscode.Uri.parse(uriString)); - } + (view as HtmlContentView).setContent(content); + this.didChangeEvent.fire(vscode.Uri.parse(uriString)); } public appendHtmlOutputView(id: string, content: string) { const uriString = this.getUri(id); const view: CustomView = this.viewIndex[uriString]; - if (view.viewType === CustomViewType.HtmlContent) { - (view as HtmlContentView).appendContent(content); - this.didChangeEvent.fire(vscode.Uri.parse(uriString)); - } + (view as HtmlContentView).appendContent(content); + this.didChangeEvent.fire(vscode.Uri.parse(uriString)); } private getUri(id: string) { @@ -172,16 +170,14 @@ class HtmlContentView extends CustomView { public getContent(): string { let styleTags = ""; - if (this.htmlContent.styleSheetPaths && - this.htmlContent.styleSheetPaths.length > 0) { + if (this.htmlContent.styleSheetPaths.length > 0) { for (const styleSheetPath of this.htmlContent.styleSheetPaths) { styleTags += `\n`; } } let scriptTags = ""; - if (this.htmlContent.javaScriptPaths && - this.htmlContent.javaScriptPaths.length > 0) { + if (this.htmlContent.javaScriptPaths.length > 0) { for (const javaScriptPath of this.htmlContent.javaScriptPaths) { scriptTags += `\n`; } @@ -195,17 +191,13 @@ class HtmlContentView extends CustomView { this.webviewPanel?.dispose(); let localResourceRoots: vscode.Uri[] = []; - if (this.htmlContent.javaScriptPaths) { - localResourceRoots = localResourceRoots.concat(this.htmlContent.javaScriptPaths.map((p) => { - return vscode.Uri.parse(path.dirname(p)); - })); - } + localResourceRoots = localResourceRoots.concat(this.htmlContent.javaScriptPaths.map((p) => { + return vscode.Uri.parse(path.dirname(p)); + })); - if (this.htmlContent.styleSheetPaths) { - localResourceRoots = localResourceRoots.concat(this.htmlContent.styleSheetPaths.map((p) => { - return vscode.Uri.parse(path.dirname(p)); - })); - } + localResourceRoots = localResourceRoots.concat(this.htmlContent.styleSheetPaths.map((p) => { + return vscode.Uri.parse(path.dirname(p)); + })); this.webviewPanel = vscode.window.createWebviewPanel( this.id, diff --git a/src/features/ExtensionCommands.ts b/src/features/ExtensionCommands.ts index ca6131c243..cd8272b166 100644 --- a/src/features/ExtensionCommands.ts +++ b/src/features/ExtensionCommands.ts @@ -48,30 +48,15 @@ export interface IExtensionCommandAddedNotificationBody { displayName: string; } -function asRange(value: vscode.Range): Range | undefined | null { - if (value === undefined) { - return undefined; - } else if (value === null) { - return null; - } - return { start: asPosition(value.start)!, end: asPosition(value.end)! }; +function asRange(value: vscode.Range): Range { + return { start: asPosition(value.start), end: asPosition(value.end) }; } -function asPosition(value: vscode.Position): Position | undefined | null { - if (value === undefined) { - return undefined; - } else if (value === null) { - return null; - } +function asPosition(value: vscode.Position): Position { return { line: value.line, character: value.character }; } -function asCodePosition(value: Position): vscode.Position | undefined | null { - if (value === undefined) { - return undefined; - } else if (value === null) { - return null; - } +function asCodePosition(value: Position): vscode.Position { return new vscode.Position(value.line, value.character); } @@ -218,10 +203,6 @@ export class ExtensionCommandsFeature extends LanguageClientConsumer { // only relevant to the previous session this.extensionCommands = []; - if (languageclient === undefined) { - this.log.write("Language client given to ExtensionCommandsFeature is undefined"); - return; - } this.languageClient = languageclient; this.handlers = [ diff --git a/src/features/GetCommands.ts b/src/features/GetCommands.ts index 3e0c041267..c0c59dd938 100644 --- a/src/features/GetCommands.ts +++ b/src/features/GetCommands.ts @@ -110,7 +110,7 @@ class CommandsExplorerProvider implements vscode.TreeDataProvider { } public getChildren(_element?: Command): Thenable { - return Promise.resolve(this.powerShellCommands || []); + return Promise.resolve(this.powerShellCommands); } } diff --git a/src/features/HelpCompletion.ts b/src/features/HelpCompletion.ts index d40cf44579..26dcfc25b7 100644 --- a/src/features/HelpCompletion.ts +++ b/src/features/HelpCompletion.ts @@ -57,7 +57,7 @@ export class HelpCompletionFeature extends LanguageClientConsumer { return; } - if (!(changeEvent && changeEvent.contentChanges)) { + if (changeEvent.contentChanges.length === 0) { this.log.writeWarning(`<${HelpCompletionFeature.name}>: ` + `Bad TextDocumentChangeEvent message: ${JSON.stringify(changeEvent)}`); return; @@ -95,6 +95,7 @@ class TriggerFinder { public updateState(document: TextDocument, changeText: string): void { switch (this.state) { case SearchState.Searching: + // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with if (changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) { this.state = SearchState.Locked; this.document = document; @@ -103,9 +104,8 @@ class TriggerFinder { break; case SearchState.Locked: - if (document === this.document && - changeText.length === 1 && - changeText[0] === this.triggerCharacters[this.count]) { + // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with + if (document === this.document && changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) { this.count++; if (this.count === this.triggerCharacters.length) { this.state = SearchState.Found; @@ -171,13 +171,13 @@ class HelpCompletionProvider { blockComment: this.settings.helpCompletion === Settings.CommentType.BlockComment, }); - if (!(result && result.content)) { + if (result.content.length === 0) { return; } const replaceRange = new Range(triggerStartPos.translate(0, -1), triggerStartPos.translate(0, 1)); - // TODO add indentation level to the help content + // TODO: add indentation level to the help content // Trim leading whitespace (used by the rule for indentation) as VSCode takes care of the indentation. // Trim the last empty line and join the strings. const lines: string[] = result.content; diff --git a/src/features/PesterTests.ts b/src/features/PesterTests.ts index e6fcf55d40..dc703254c0 100644 --- a/src/features/PesterTests.ts +++ b/src/features/PesterTests.ts @@ -13,75 +13,81 @@ enum LaunchType { } export class PesterTestsFeature implements vscode.Disposable { - - private command: vscode.Disposable; + private commands: vscode.Disposable[]; private invokePesterStubScriptPath: string; constructor(private sessionManager: SessionManager) { this.invokePesterStubScriptPath = path.resolve(__dirname, "../modules/PowerShellEditorServices/InvokePesterStub.ps1"); - - // File context-menu command - Run Pester Tests - this.command = vscode.commands.registerCommand( - "PowerShell.RunPesterTestsFromFile", - (fileUri) => { - return this.launchAllTestsInActiveEditor(LaunchType.Run, fileUri); - }); - // File context-menu command - Debug Pester Tests - this.command = vscode.commands.registerCommand( - "PowerShell.DebugPesterTestsFromFile", - (fileUri) => { - return this.launchAllTestsInActiveEditor(LaunchType.Debug, fileUri); - }); - // This command is provided for usage by PowerShellEditorServices (PSES) only - this.command = vscode.commands.registerCommand( - "PowerShell.RunPesterTests", - (uriString, runInDebugger, describeBlockName?, describeBlockLineNumber?, outputPath?) => { - return this.launchTests(uriString, runInDebugger, describeBlockName, describeBlockLineNumber, outputPath); - }); + this.commands = [ + // File context-menu command - Run Pester Tests + vscode.commands.registerCommand( + "PowerShell.RunPesterTestsFromFile", + (fileUri?) => { + return this.launchAllTestsInActiveEditor(LaunchType.Run, fileUri); + }), + + // File context-menu command - Debug Pester Tests + vscode.commands.registerCommand( + "PowerShell.DebugPesterTestsFromFile", + (fileUri?) => { + return this.launchAllTestsInActiveEditor(LaunchType.Debug, fileUri); + }), + + // This command is provided for usage by PowerShellEditorServices (PSES) only + vscode.commands.registerCommand( + "PowerShell.RunPesterTests", + (uriString, runInDebugger, describeBlockName?, describeBlockLineNumber?, outputPath?) => { + return this.launchTests(vscode.Uri.parse(uriString), runInDebugger, describeBlockName, describeBlockLineNumber, outputPath); + }) + ]; } public dispose() { - this.command.dispose(); + for (const command of this.commands) { + command.dispose(); + } } private async launchAllTestsInActiveEditor( launchType: LaunchType, - fileUri: vscode.Uri): Promise { + fileUri?: vscode.Uri): Promise { + + if (fileUri === undefined) { + fileUri = vscode.window.activeTextEditor?.document.uri; + } - if (fileUri === undefined && vscode.window.activeTextEditor === undefined) { + if (fileUri === undefined) { return false; } - const uriString = (fileUri || vscode.window.activeTextEditor!.document.uri).toString(); - const launchConfig = this.createLaunchConfig(uriString, launchType); + const launchConfig = this.createLaunchConfig(fileUri, launchType); return this.launch(launchConfig); } private async launchTests( - uriString: string, + fileUri: vscode.Uri, runInDebugger: boolean, describeBlockName?: string, describeBlockLineNumber?: number, outputPath?: string): Promise { const launchType = runInDebugger ? LaunchType.Debug : LaunchType.Run; - const launchConfig = this.createLaunchConfig(uriString, launchType, describeBlockName, describeBlockLineNumber, outputPath); + const launchConfig = this.createLaunchConfig(fileUri, launchType, describeBlockName, describeBlockLineNumber, outputPath); return this.launch(launchConfig); } private createLaunchConfig( - uriString: string, + fileUri: vscode.Uri, launchType: LaunchType, testName?: string, lineNum?: number, outputPath?: string): vscode.DebugConfiguration { - const uri = vscode.Uri.parse(uriString); const settings = Settings.load(); // Since we pass the script path to PSES in single quotes to avoid issues with PowerShell // special chars like & $ @ () [], we do have to double up the interior single quotes. - const scriptPath = uri.fsPath.replace(/'/g, "''"); + const scriptPath = fileUri.fsPath.replace(/'/g, "''"); const launchConfig = { request: "launch", diff --git a/src/features/RemoteFiles.ts b/src/features/RemoteFiles.ts index ebb8edce4f..ee5c184252 100644 --- a/src/features/RemoteFiles.ts +++ b/src/features/RemoteFiles.ts @@ -48,7 +48,7 @@ export class RemoteFilesFeature extends LanguageClientConsumer { } public dispose() { - this.command?.dispose(); + this.command.dispose(); // Close any leftover remote files before exiting this.closeRemoteFiles(); } diff --git a/src/platform.ts b/src/platform.ts index f7b0257ee0..4225b916d5 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -94,8 +94,8 @@ export class PowerShellExeFinder { platformDetails?: IPlatformDetails, additionalPowerShellExes?: IPowerShellAdditionalExePathSettings) { - this.platformDetails = platformDetails || getPlatformDetails(); - this.additionalPSExeSettings = additionalPowerShellExes || {}; + this.platformDetails = platformDetails ?? getPlatformDetails(); + this.additionalPSExeSettings = additionalPowerShellExes ?? {}; } /** @@ -157,7 +157,7 @@ export class PowerShellExeFinder { // Also show any additionally configured PowerShells // These may be duplicates of the default installations, but given a different name. for (const additionalPwsh of this.enumerateAdditionalPowerShellInstallations()) { - if (additionalPwsh && await additionalPwsh.exists()) { + if (await additionalPwsh.exists()) { yield additionalPwsh; } } diff --git a/src/session.ts b/src/session.ts index 11472338a3..c1de1fcf0c 100644 --- a/src/session.ts +++ b/src/session.ts @@ -327,8 +327,11 @@ export class SessionManager implements Middleware { return codeLensToFix; }; + // TODO: This makes zero sense, but appears to be "working" and copied by others per https://github.com/microsoft/vscode-languageserver-node/issues/495. Thing is, ESLint says these conditionals are always truthy. + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if ((resolvedCodeLens as Thenable).then) { return (resolvedCodeLens as Thenable).then(resolveFunc); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition } else if (resolvedCodeLens as vscode.CodeLens) { return resolveFunc(resolvedCodeLens as vscode.CodeLens); } diff --git a/src/settings.ts b/src/settings.ts index 05b452e4cf..372cbc3f68 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -25,9 +25,7 @@ export enum CommentType { LineComment = "LineComment", } -export interface IPowerShellAdditionalExePathSettings { - [versionName: string]: string; -} +export type IPowerShellAdditionalExePathSettings = Record; export interface IBugReportingSettings { project: string; @@ -316,9 +314,7 @@ function getWorkspaceSettingsWithDefaults( const importedSettings: TSettings = workspaceConfiguration.get(settingName, defaultSettings); for (const setting in importedSettings) { - if (importedSettings[setting]) { - defaultSettings[setting] = importedSettings[setting]; - } + defaultSettings[setting] = importedSettings[setting]; } return defaultSettings; } @@ -336,13 +332,13 @@ export async function validateCwdSetting(): Promise { // If there is no workspace, or there is but it has no folders, fallback. if (vscode.workspace.workspaceFolders === undefined - || vscode.workspace.workspaceFolders?.length === 0) { + || vscode.workspace.workspaceFolders.length === 0) { cwd = undefined; // If there is exactly one workspace folder, use that. - } else if (vscode.workspace.workspaceFolders?.length === 1) { - cwd = vscode.workspace.workspaceFolders?.[0].uri.fsPath; + } else if (vscode.workspace.workspaceFolders.length === 1) { + cwd = vscode.workspace.workspaceFolders[0].uri.fsPath; // If there is more than one workspace folder, prompt the user once. - } else if (vscode.workspace.workspaceFolders?.length > 1 && !hasPrompted) { + } else if (vscode.workspace.workspaceFolders.length > 1 && !hasPrompted) { hasPrompted = true; const options: vscode.WorkspaceFolderPickOptions = { placeHolder: "Select a folder to use as the PowerShell extension's working directory.", diff --git a/test/core/platform.test.ts b/test/core/platform.test.ts index 30129bc702..6058ccf388 100644 --- a/test/core/platform.test.ts +++ b/test/core/platform.test.ts @@ -755,9 +755,9 @@ describe("Platform module", function () { const foundPowerShell = foundPowerShells[i]; const expectedPowerShell = testPlatform.expectedPowerShellSequence[i]; - assert.strictEqual(foundPowerShell && foundPowerShell.exePath, expectedPowerShell.exePath); - assert.strictEqual(foundPowerShell && foundPowerShell.displayName, expectedPowerShell.displayName); - assert.strictEqual(foundPowerShell && foundPowerShell.supportsProperArguments, expectedPowerShell.supportsProperArguments); + assert.strictEqual(foundPowerShell?.exePath, expectedPowerShell.exePath); + assert.strictEqual(foundPowerShell?.displayName, expectedPowerShell.displayName); + assert.strictEqual(foundPowerShell?.supportsProperArguments, expectedPowerShell.supportsProperArguments); } assert.strictEqual( From 1a31f5f8404cdc680490d38d4a5479b70b226203 Mon Sep 17 00:00:00 2001 From: Andy Jordan Date: Wed, 19 Oct 2022 15:10:49 -0700 Subject: [PATCH 15/16] Remove useless check in `HelpCompletion.ts` --- src/features/HelpCompletion.ts | 11 ++--------- src/main.ts | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/features/HelpCompletion.ts b/src/features/HelpCompletion.ts index 26dcfc25b7..ec64795743 100644 --- a/src/features/HelpCompletion.ts +++ b/src/features/HelpCompletion.ts @@ -7,7 +7,6 @@ import { } from "vscode"; import { RequestType } from "vscode-languageclient"; import { LanguageClient } from "vscode-languageclient/node"; -import { Logger } from "../logging"; import Settings = require("../settings"); import { LanguageClientConsumer } from "../languageClientConsumer"; @@ -30,7 +29,7 @@ export class HelpCompletionFeature extends LanguageClientConsumer { private disposable: Disposable | undefined; private settings: Settings.ISettings; - constructor(private log: Logger) { + constructor() { super(); this.settings = Settings.load(); @@ -57,19 +56,13 @@ export class HelpCompletionFeature extends LanguageClientConsumer { return; } - if (changeEvent.contentChanges.length === 0) { - this.log.writeWarning(`<${HelpCompletionFeature.name}>: ` + - `Bad TextDocumentChangeEvent message: ${JSON.stringify(changeEvent)}`); - return; - } - if (changeEvent.contentChanges.length > 0) { this.helpCompletionProvider?.updateState( changeEvent.document, changeEvent.contentChanges[0].text, changeEvent.contentChanges[0].range); - // todo raise an event when trigger is found, and attach complete() to the event. + // TODO: Raise an event when trigger is found, and attach complete() to the event. if (this.helpCompletionProvider?.triggerFound) { await this.helpCompletionProvider.complete(); this.helpCompletionProvider.reset(); diff --git a/src/main.ts b/src/main.ts index 0a803a1a7b..21fe2cc255 100644 --- a/src/main.ts +++ b/src/main.ts @@ -165,7 +165,7 @@ export async function activate(context: vscode.ExtensionContext): Promise Date: Wed, 19 Oct 2022 15:17:38 -0700 Subject: [PATCH 16/16] Fix unrelated bug in `PowerShell.NewProjectFromTemplate` --- src/features/NewFileOrProject.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/features/NewFileOrProject.ts b/src/features/NewFileOrProject.ts index 00d665e73f..3c3047ed1d 100644 --- a/src/features/NewFileOrProject.ts +++ b/src/features/NewFileOrProject.ts @@ -16,9 +16,7 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { super(); this.command = vscode.commands.registerCommand("PowerShell.NewProjectFromTemplate", async () => { - if (!this.languageClient && !this.waitingForClientToken) { - // If PowerShell isn't finished loading yet, show a loading message // until the LanguageClient is passed on to us this.waitingForClientToken = new vscode.CancellationTokenSource(); @@ -131,8 +129,7 @@ export class NewFileOrProjectFeature extends LanguageClientConsumer { }); if (destinationPath !== undefined) { - // Show the PowerShell session output in case an error occurred - await vscode.commands.executeCommand("PowerShell.ShowSessionOutput"); + await vscode.commands.executeCommand("PowerShell.ShowSessionConsole"); const result = await this.languageClient?.sendRequest( NewProjectFromTemplateRequestType,