diff --git a/.eslintignore b/.eslintignore index a97cddeaf9..3aabbc930e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,12 +7,15 @@ types/*.d.ts # Duplicate entries because prettier can be ran from root or within the workspace/subpackage. # TODO: Avoid this. +resources/js/graphStateMachine.js src/shared/telemetry/clienttelemetry.d.ts src/codewhisperer/client/codewhispererclient.d.ts src/codewhisperer/client/codewhispereruserclient.d.ts src/amazonqFeatureDev/client/featuredevproxyclient.d.ts src/auth/sso/oidcclientpkce.d.ts src/testFixtures/** + +packages/core/resources/js/graphStateMachine.js packages/core/src/shared/telemetry/clienttelemetry.d.ts packages/core/src/codewhisperer/client/codewhispererclient.d.ts packages/core/src/codewhisperer/client/codewhispereruserclient.d.ts diff --git a/.eslintrc.js b/.eslintrc.js index 4872665a63..b91042ef17 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -94,6 +94,9 @@ module.exports = { // This is off because prettier takes care of it 'no-extra-semi': 'off', '@typescript-eslint/no-empty-function': 'off', + // Disallows returning e.g. Promise<…|never> which signals that an exception may be thrown. + // https://stackoverflow.com/q/64230626/152142 + '@typescript-eslint/no-redundant-type-constituents': 'off', '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/no-floating-promises': 'error', // Promises must catch errors or be awaited. '@typescript-eslint/no-var-requires': 'off', // Should be able to remove with the full migration of SDK v3 diff --git a/package-lock.json b/package-lock.json index 5eedb53d3d..7e26352cdf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,8 +24,8 @@ "@types/vscode": "^1.68.0", "@types/vscode-webview": "^1.57.1", "@types/webpack-env": "^1.18.1", - "@typescript-eslint/eslint-plugin": "^5.59.0", - "@typescript-eslint/parser": "^5.59.1", + "@typescript-eslint/eslint-plugin": "^7.10.0", + "@typescript-eslint/parser": "^7.10.0", "@vscode/codicons": "^0.0.33", "@vscode/test-electron": "^2.3.8", "@vscode/test-web": "^0.0.54", @@ -5300,32 +5300,31 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.0.tgz", - "integrity": "sha512-p0QgrEyrxAWBecR56gyn3wkG15TJdI//eetInP3zYRewDh0XS+DhB3VUAd3QqvziFsfaQIoIuZMxZRB7vXYaYw==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.10.0.tgz", + "integrity": "sha512-PzCr+a/KAef5ZawX7nbyNwBDtM1HdLIT53aSA2DDlxmxMngZ43O8SIePOeX8H5S+FHXeI6t97mTt/dDdzY4Fyw==", "dev": true, "dependencies": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.59.0", - "@typescript-eslint/type-utils": "5.59.0", - "@typescript-eslint/utils": "5.59.0", - "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.10.0", + "@typescript-eslint/type-utils": "7.10.0", + "@typescript-eslint/utils": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.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" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -5334,25 +5333,26 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.1.tgz", - "integrity": "sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.10.0.tgz", + "integrity": "sha512-2EjZMA0LUW5V5tGQiaa2Gys+nKdfrn2xiTIBLR4fxmPmVSvgPcKNW+AE/ln9k0A4zDUti0J/GZXMDupQoI+e1w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.59.1", - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/typescript-estree": "5.59.1", + "@typescript-eslint/scope-manager": "7.10.0", + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/typescript-estree": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0", "debug": "^4.3.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -5360,201 +5360,148 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.1.tgz", - "integrity": "sha512-mau0waO5frJctPuAzcxiNWqJR5Z8V0190FTSqRw1Q4Euop6+zTwHAf8YIXNwDOT29tyUDrQ65jSg9aTU/H0omA==", + "node_modules/@typescript-eslint/scope-manager": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.10.0.tgz", + "integrity": "sha512-7L01/K8W/VGl7noe2mgH0K7BE29Sq6KAbVmxurj8GGaPDZXPr8EEQ2seOeAS+mEV9DnzxBQB6ax6qQQ5C6P4xg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/visitor-keys": "5.59.1" + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.1.tgz", - "integrity": "sha512-dg0ICB+RZwHlysIy/Dh1SP+gnXNzwd/KS0JprD3Lmgmdq+dJAJnUPe1gNG34p0U19HvRlGX733d/KqscrGC1Pg==", - "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/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.1.tgz", - "integrity": "sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA==", + "node_modules/@typescript-eslint/type-utils": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.10.0.tgz", + "integrity": "sha512-D7tS4WDkJWrVkuzgm90qYw9RdgBcrWmbbRkrLA4d7Pg3w0ttVGDsvYGV19SH8gPR5L7OtcN5J1hTtyenO9xE9g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/visitor-keys": "5.59.1", + "@typescript-eslint/typescript-estree": "7.10.0", + "@typescript-eslint/utils": "7.10.0", "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^8.56.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.1.tgz", - "integrity": "sha512-6waEYwBTCWryx0VJmP7JaM4FpipLsFl9CvYf2foAE8Qh/Y0s+bxWysciwOs0LTBED4JCaNxTZ5rGadB14M6dwA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.59.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/@typescript-eslint/scope-manager": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.0.tgz", - "integrity": "sha512-tsoldKaMh7izN6BvkK6zRMINj4Z2d6gGhO2UsI8zGZY3XhLq1DndP3Ycjhi1JwdwPRwtLMW4EFPgpuKhbCGOvQ==", + "node_modules/@typescript-eslint/types": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.10.0.tgz", + "integrity": "sha512-7fNj+Ya35aNyhuqrA1E/VayQX9Elwr8NKZ4WueClR3KwJ7Xx9jcCdOrLW04h51de/+gNbyFMs+IDxh5xIwfbNg==", "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.59.0", - "@typescript-eslint/visitor-keys": "5.59.0" - }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/type-utils": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.0.tgz", - "integrity": "sha512-d/B6VSWnZwu70kcKQSCqjcXpVH+7ABKH8P1KNn4K7j5PXXuycZTPXF44Nui0TEm6rbWGi8kc78xRgOC4n7xFgA==", + "node_modules/@typescript-eslint/typescript-estree": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.10.0.tgz", + "integrity": "sha512-LXFnQJjL9XIcxeVfqmNj60YhatpRLt6UhdlFwAkjNc6jSUlK8zQOl1oktAP8PlWFzPQC1jny/8Bai3/HPuvN5g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.59.0", - "@typescript-eslint/utils": "5.59.0", + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, - "peerDependencies": { - "eslint": "*" - }, "peerDependenciesMeta": { "typescript": { "optional": true } } }, - "node_modules/@typescript-eslint/types": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.0.tgz", - "integrity": "sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA==", + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "dependencies": { + "balanced-match": "^1.0.0" } }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz", - "integrity": "sha512-sUNnktjmI8DyGzPdZ8dRwW741zopGxltGs/SAPgGL/AAgDpiLsCFLcMNSpbfXfmnNeHmK9h3wGmCkGRGAoUZAg==", + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.0", - "@typescript-eslint/visitor-keys": "5.59.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=16 || 14 >=14.17" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/@typescript-eslint/utils": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.0.tgz", - "integrity": "sha512-GGLFd+86drlHSvPgN/el6dRQNYYGOvRSDVydsUaQluwIW3HvbXuxyuD5JETvBt/9qGYe+lOrDk6gRrWOHb/FvA==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.10.0.tgz", + "integrity": "sha512-olzif1Fuo8R8m/qKkzJqT7qwy16CzPRWBvERS0uvyc+DHd8AKbO4Jb7kpAvVzMmZm8TrHnI7hvjN4I05zow+tg==", "dev": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.59.0", - "@typescript-eslint/types": "5.59.0", - "@typescript-eslint/typescript-estree": "5.59.0", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.10.0", + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/typescript-estree": "7.10.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.0.tgz", - "integrity": "sha512-qZ3iXxQhanchCeaExlKPV3gDQFxMUmU35xfd5eCXB6+kUw1TUAbIy2n7QIrwz9s98DQLzNWyHp61fY0da4ZcbA==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.10.0.tgz", + "integrity": "sha512-9ntIVgsi6gg6FIq9xjEO4VQJvwOqA3jaBFQJ/6TK5AvEup2+cECI6Fh7QiBxmfMHXU0V0J4RyPeOU1VDNzl9cg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.0", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "7.10.0", + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -10869,12 +10816,6 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, - "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/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -11356,9 +11297,9 @@ "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" }, "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, "engines": { "node": ">= 4" @@ -12747,6 +12688,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -13538,12 +13480,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "node_modules/neatequal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/neatequal/-/neatequal-1.0.0.tgz", @@ -15679,12 +15615,9 @@ } }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "bin": { "semver": "bin/semver.js" }, @@ -16979,6 +16912,18 @@ "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" }, + "node_modules/ts-api-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "dev": true, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/ts-morph": { "version": "21.0.1", "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-21.0.1.tgz", @@ -17055,27 +17000,6 @@ "node": ">=0.6.x" } }, - "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/tsutils/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, "node_modules/ttf2eot": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ttf2eot/-/ttf2eot-2.0.0.tgz", @@ -18541,7 +18465,8 @@ "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "node_modules/yaml": { "version": "1.10.2", @@ -19035,8 +18960,8 @@ "@types/uuid": "^9.0.1", "@types/whatwg-url": "^11.0.4", "@types/xml2js": "^0.4.11", - "@typescript-eslint/eslint-plugin": "^5.59.0", - "@typescript-eslint/parser": "^5.59.1", + "@typescript-eslint/eslint-plugin": "^7.10.0", + "@typescript-eslint/parser": "^7.10.0", "@vue/compiler-sfc": "^3.3.2", "c8": "^9.0.0", "circular-dependency-plugin": "^5.2.2", diff --git a/package.json b/package.json index da3721a93c..9a71e3023e 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "@types/vscode": "^1.68.0", "@types/vscode-webview": "^1.57.1", "@types/webpack-env": "^1.18.1", - "@typescript-eslint/eslint-plugin": "^5.59.0", - "@typescript-eslint/parser": "^5.59.1", + "@typescript-eslint/eslint-plugin": "^7.10.0", + "@typescript-eslint/parser": "^7.10.0", "@vscode/codicons": "^0.0.33", "@vscode/test-electron": "^2.3.8", "@vscode/test-web": "^0.0.54", diff --git a/packages/amazonq/src/extensionShared.ts b/packages/amazonq/src/extensionShared.ts index 44341e4538..d40b6060f9 100644 --- a/packages/amazonq/src/extensionShared.ts +++ b/packages/amazonq/src/extensionShared.ts @@ -60,7 +60,9 @@ export async function activateShared(context: vscode.ExtensionContext, isWeb: bo () => vscode.window .showInformationMessage( - `The Amazon Q extension is incompatible with AWS Toolkit ${toolkitVersion} and older. Your AWS Toolkit was updated to version 3.0 or later.`, + `The Amazon Q extension is incompatible with AWS Toolkit ${ + toolkitVersion as any + } and older. Your AWS Toolkit was updated to version 3.0 or later.`, 'Reload Now' ) .then(async resp => { diff --git a/packages/core/package.json b/packages/core/package.json index 5a789d6c33..7fa1ac07c4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4015,8 +4015,8 @@ "@types/uuid": "^9.0.1", "@types/whatwg-url": "^11.0.4", "@types/xml2js": "^0.4.11", - "@typescript-eslint/eslint-plugin": "^5.59.0", - "@typescript-eslint/parser": "^5.59.1", + "@typescript-eslint/eslint-plugin": "^7.10.0", + "@typescript-eslint/parser": "^7.10.0", "@vue/compiler-sfc": "^3.3.2", "c8": "^9.0.0", "circular-dependency-plugin": "^5.2.2", diff --git a/packages/core/scripts/build/generateServiceClient.ts b/packages/core/scripts/build/generateServiceClient.ts index 724862c06e..dc1c160b5a 100644 --- a/packages/core/scripts/build/generateServiceClient.ts +++ b/packages/core/scripts/build/generateServiceClient.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import * as child_process from 'child_process' +import * as proc from 'child_process' import * as fs from 'fs-extra' import * as path from 'path' @@ -48,7 +48,7 @@ async function cloneJsSdk(dir: string): Promise { } const tag = `v${sdkversion}` - const gitHead = child_process.spawnSync('git', ['-C', dir, 'rev-parse', 'HEAD']) + const gitHead = proc.spawnSync('git', ['-C', dir, 'rev-parse', 'HEAD']) const alreadyCloned = gitHead.status !== undefined && gitHead.status === 0 const msg = `${alreadyCloned ? 'Updating' : 'Cloning'} AWS JS SDK... @@ -75,7 +75,7 @@ async function cloneJsSdk(dir: string): Promise { dir, ] - const gitCmd = child_process.execFile('git', gitArgs, { encoding: 'utf8' }) + const gitCmd = proc.execFile('git', gitArgs, { encoding: 'utf8' }) gitCmd.stderr?.on('data', (data: any) => { console.log(data) @@ -84,7 +84,7 @@ async function cloneJsSdk(dir: string): Promise { gitCmd.stdout?.removeAllListeners() // Only needed for the "update" case, but harmless for "clone". - const gitCheckout = child_process.spawnSync('git', [ + const gitCheckout = proc.spawnSync('git', [ '-c', 'advice.detachedHead=false', '-C', @@ -164,7 +164,7 @@ async function patchServicesIntoApiMetadata(apiMetadataPath: string, serviceName async function runTypingsGenerator(repoPath: string): Promise { console.log('Generating service client typings...') - const stdout = child_process.execFileSync('node', ['scripts/typings-generator.js'], { + const stdout = proc.execFileSync('node', ['scripts/typings-generator.js'], { encoding: 'utf8', cwd: repoPath, }) diff --git a/packages/core/scripts/test/launchTestUtilities.ts b/packages/core/scripts/test/launchTestUtilities.ts index f45cb5cc4b..b96bc46874 100644 --- a/packages/core/scripts/test/launchTestUtilities.ts +++ b/packages/core/scripts/test/launchTestUtilities.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import * as child_process from 'child_process' +import * as proc from 'child_process' import packageJson from '../../package.json' import { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath } from '@vscode/test-electron' import { join, resolve } from 'path' @@ -168,7 +168,7 @@ async function invokeVSCodeCli(vsCodeExecutablePath: string, args: string[]): Pr } console.log(`Invoking vscode CLI command:\n "${cli}" ${JSON.stringify(cmdArgs)}`) - const spawnResult = child_process.spawnSync(cli, cmdArgs, { + const spawnResult = proc.spawnSync(cli, cmdArgs, { encoding: 'utf-8', stdio: 'pipe', }) diff --git a/packages/core/src/accessanalyzer/vue/iamPolicyChecks.ts b/packages/core/src/accessanalyzer/vue/iamPolicyChecks.ts index a187ec5876..04ae36331a 100644 --- a/packages/core/src/accessanalyzer/vue/iamPolicyChecks.ts +++ b/packages/core/src/accessanalyzer/vue/iamPolicyChecks.ts @@ -657,6 +657,8 @@ async function _readCustomChecksFile(input: string): Promise { const [region, bucket, key] = parseS3Uri(input) const s3Client = new DefaultS3Client(region) const resp = await s3Client.getObject({ bucketName: bucket, key }) + // Lint warning: this may evaluate to '[object Object]'. @typescript-eslint/no-base-to-string + // eslint-disable-next-line @typescript-eslint/no-base-to-string return resp.objectBody.toString() } catch (e: any) { if (e.message.includes('Invalid S3 URI')) { diff --git a/packages/core/src/apigateway/vue/invokeRemoteRestApi.ts b/packages/core/src/apigateway/vue/invokeRemoteRestApi.ts index 39780a8751..b23409381b 100644 --- a/packages/core/src/apigateway/vue/invokeRemoteRestApi.ts +++ b/packages/core/src/apigateway/vue/invokeRemoteRestApi.ts @@ -125,7 +125,7 @@ export async function invokeRemoteRestApi( [curr.id!]: curr, } }, {}) - logger.debug(`Loaded: ${resources}`) + logger.debug(`Loaded: %O`, resources) // something is wrong if the paths aren't defined... // const sortResources = (a: [string, Resource], b: [string, Resource]) => a[1].path!.localeCompare(b[1].path!) diff --git a/packages/core/src/applicationcomposer/types.ts b/packages/core/src/applicationcomposer/types.ts index ae19443fe7..e3bfb674e2 100644 --- a/packages/core/src/applicationcomposer/types.ts +++ b/packages/core/src/applicationcomposer/types.ts @@ -42,21 +42,20 @@ export enum MessageType { BROADCAST = 'BROADCAST', } -enum TelemetryType { - GENERATE_CLICKED = 'GENERATE_CLICKED', - REGENERATE_CLICKED = 'REGENERATE_CLICKED', - GENERATE_ACCEPTED = 'GENERATE_ACCEPTED', - GENERATE_REJECTED = 'GENERATE_REJECTED', - INVALID_GENERATION = 'INVALID_GENERATION', - POST_PROCESS = 'POST_PROCESS', - CUSTOMER_READY = 'CUSTOMER_READY', - FPS = 'FPS', - ADD_RESOURCE = 'ADD_RESOURCE', - ADD_CONNECTION = 'ADD_CONNECTION', - OPEN_WFS = 'OPEN_WFS', - CLOSE_WFS = 'CLOSE_WFS', - TEMPLATE_OPENED = 'TEMPLATE_OPENED', -} +type TelemetryType = + | 'GENERATE_CLICKED' + | 'REGENERATE_CLICKED' + | 'GENERATE_ACCEPTED' + | 'GENERATE_REJECTED' + | 'INVALID_GENERATION' + | 'POST_PROCESS' + | 'CUSTOMER_READY' + | 'FPS' + | 'ADD_RESOURCE' + | 'ADD_CONNECTION' + | 'OPEN_WFS' + | 'CLOSE_WFS' + | 'TEMPLATE_OPENED' export interface InitResponseMessage extends Message { templateFileName: string diff --git a/packages/core/src/auth/credentials/validation.ts b/packages/core/src/auth/credentials/validation.ts index 3a9402a621..e1bee0b8c0 100644 --- a/packages/core/src/auth/credentials/validation.ts +++ b/packages/core/src/auth/credentials/validation.ts @@ -114,7 +114,7 @@ export async function throwOnInvalidCredentials(profileName: SectionName, data: const credentialsDataErrors = getCredentialsErrors(data) if (credentialsDataErrors !== undefined) { - throw new ToolkitError(`Errors in credentials data: ${credentialsDataErrors}`, { + throw new ToolkitError(`Errors in credentials data: ${String(credentialsDataErrors)}`, { code: 'InvalidCredentialsData', details: credentialsDataErrors, }) diff --git a/packages/core/src/awsexplorer/awsExplorer.ts b/packages/core/src/awsexplorer/awsExplorer.ts index 51399efe04..7c00e3c476 100644 --- a/packages/core/src/awsexplorer/awsExplorer.ts +++ b/packages/core/src/awsexplorer/awsExplorer.ts @@ -75,7 +75,7 @@ export class AwsExplorer implements vscode.TreeDataProvider, Re } } catch (err) { const error = err as Error - this.logger.error(`Error getting children for node ${element?.label ?? 'Root Node'}: %s`, error) + this.logger.error(`Error getting children for node %O: %s`, element?.label ?? 'Root Node', error) childNodes.splice( 0, diff --git a/packages/core/src/codewhisperer/client/codewhisperer.ts b/packages/core/src/codewhisperer/client/codewhisperer.ts index b8f97ad581..94a8a824cb 100644 --- a/packages/core/src/codewhisperer/client/codewhisperer.ts +++ b/packages/core/src/codewhisperer/client/codewhisperer.ts @@ -83,6 +83,7 @@ export type ListCodeScanFindingsRequest = Readonly< export type SupplementalContext = Readonly< CodeWhispererClient.SupplementalContext | CodeWhispererUserClient.SupplementalContext > +// eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents export type ArtifactType = Readonly export type ArtifactMap = Readonly export type ListCodeScanFindingsResponse = diff --git a/packages/core/src/codewhisperer/commands/startTransformByQ.ts b/packages/core/src/codewhisperer/commands/startTransformByQ.ts index a2caeea5cd..c7b534207f 100644 --- a/packages/core/src/codewhisperer/commands/startTransformByQ.ts +++ b/packages/core/src/codewhisperer/commands/startTransformByQ.ts @@ -17,6 +17,7 @@ import { FolderInfo, TransformationCandidateProject, ZipManifest, + TransformByQStatus, } from '../models/model' import { convertDateToTimestamp, getStringHash } from '../../shared/utilities/textUtilities' import { @@ -650,7 +651,7 @@ export async function postTransformationJob() { codeTransformRunTimeLatency: durationInMs, codeTransformLocalMavenVersion: mavenVersionInfoMessage, codeTransformLocalJavaVersion: javaVersionInfoMessage, - result: resultStatusMessage === 'Succeeded' ? MetadataResult.Pass : MetadataResult.Fail, + result: resultStatusMessage === TransformByQStatus.Succeeded ? MetadataResult.Pass : MetadataResult.Fail, reason: resultStatusMessage, }) diff --git a/packages/core/src/codewhisperer/service/inlineCompletionItemProvider.ts b/packages/core/src/codewhisperer/service/inlineCompletionItemProvider.ts index 28c3d43bb6..b6ff3d518e 100644 --- a/packages/core/src/codewhisperer/service/inlineCompletionItemProvider.ts +++ b/packages/core/src/codewhisperer/service/inlineCompletionItemProvider.ts @@ -173,7 +173,12 @@ export class CWInlineCompletionItemProvider implements vscode.InlineCompletionIt if (matchedCount >= 2 || this.nextToken !== '') { const result = [item] for (let j = 0; j < matchedCount - 1; j++) { - result.push({ insertText: `${item.insertText}${j}`, range: item.range }) + result.push({ + insertText: `${ + typeof item.insertText === 'string' ? item.insertText : item.insertText.value + }${j}`, + range: item.range, + }) } return result } diff --git a/packages/core/src/codewhisperer/service/recommendationHandler.ts b/packages/core/src/codewhisperer/service/recommendationHandler.ts index 9d42e9ca3e..4df54e10d6 100644 --- a/packages/core/src/codewhisperer/service/recommendationHandler.ts +++ b/packages/core/src/codewhisperer/service/recommendationHandler.ts @@ -633,12 +633,14 @@ export class RecommendationHandler { } async onCursorChange(e: vscode.TextEditorSelectionChangeEvent) { - // e.kind will be 1 for keyboard cursor change events // we do not want to reset the states for keyboard events because they can be typeahead - if (e.kind !== 1 && vscode.window.activeTextEditor === e.textEditor) { + if ( + e.kind !== vscode.TextEditorSelectionChangeKind.Keyboard && + vscode.window.activeTextEditor === e.textEditor + ) { application()._clearCodeWhispererUIListener.fire() // when cursor change due to mouse movement we need to reset the active item index for inline - if (e.kind === 2) { + if (e.kind === vscode.TextEditorSelectionChangeKind.Mouse) { this.inlineCompletionProvider?.clearActiveItemIndex() } } diff --git a/packages/core/src/dev/activation.ts b/packages/core/src/dev/activation.ts index 9f7b9855e0..17d59ee2b3 100644 --- a/packages/core/src/dev/activation.ts +++ b/packages/core/src/dev/activation.ts @@ -35,7 +35,6 @@ export type DevFunction = | 'openTerminal' | 'deleteDevEnv' | 'editStorage' - | 'editStorage' | 'showEnvVars' | 'deleteSsoConnections' | 'expireSsoConnections' diff --git a/packages/core/src/dev/codecatalyst.ts b/packages/core/src/dev/codecatalyst.ts index 3a69cf905f..78c194cc2b 100644 --- a/packages/core/src/dev/codecatalyst.ts +++ b/packages/core/src/dev/codecatalyst.ts @@ -107,13 +107,7 @@ async function promptVsix( ): Promise { const folders = (vscode.workspace.workspaceFolders ?? []).map(f => f.uri).concat(vscode.Uri.file(ctx.extensionPath)) - enum ExtensionMode { - Production = 1, - Development = 2, - Test = 3, - } - - const isDevelopmentWindow = ctx.extensionMode === ExtensionMode.Development + const isDevelopmentWindow = ctx.extensionMode === vscode.ExtensionMode.Development const extPath = isDevelopmentWindow ? ctx.extensionPath : folders[0].fsPath const packageNew = { diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts index 1d6b51b0f5..eaeebac482 100644 --- a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts +++ b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts @@ -204,7 +204,7 @@ export default defineComponent({ } this.containerBuild = config.sam?.containerBuild ?? false this.skipNewImageCheck = config.sam?.skipNewImageCheck ?? false - this.msg = `Loaded config ${config}` + this.msg = `Loaded config: ${config.name}` this.company = company }, loadPayload() { diff --git a/packages/core/src/lambda/vue/remoteInvoke/invokeLambda.ts b/packages/core/src/lambda/vue/remoteInvoke/invokeLambda.ts index fb4f3fcab6..852537800f 100644 --- a/packages/core/src/lambda/vue/remoteInvoke/invokeLambda.ts +++ b/packages/core/src/lambda/vue/remoteInvoke/invokeLambda.ts @@ -69,7 +69,7 @@ export class RemoteInvokeWebview extends VueWebview { this.channel.appendLine(logs) this.channel.appendLine('') this.channel.appendLine('Payload:') - this.channel.appendLine(payload.toString()) + this.channel.appendLine(String(payload)) this.channel.appendLine('') } catch (e) { const error = e as Error diff --git a/packages/core/src/shared/cloudformation/cloudformation.ts b/packages/core/src/shared/cloudformation/cloudformation.ts index 025a1d4dc9..4289a2245f 100644 --- a/packages/core/src/shared/cloudformation/cloudformation.ts +++ b/packages/core/src/shared/cloudformation/cloudformation.ts @@ -446,7 +446,9 @@ export async function tryLoad( // https://github.com/aws-cloudformation/aws-cfn-lint-visual-studio-code/blob/629de0bac4f36cfc6534e409a6f6766a2240992f/client/src/yaml-support/yaml-schema.ts#L39-L51 if (rv.template?.AWSTemplateFormatVersion || rv.template?.Resources) { rv.kind = - rv.template.Transform && rv.template.Transform.toString().startsWith('AWS::Serverless') ? 'sam' : 'cfn' + typeof rv.template.Transform === 'string' && rv.template.Transform.startsWith('AWS::Serverless') + ? 'sam' + : 'cfn' return rv } diff --git a/packages/core/src/shared/extensions/git.ts b/packages/core/src/shared/extensions/git.ts index 8451df42b7..bb22d12e3d 100644 --- a/packages/core/src/shared/extensions/git.ts +++ b/packages/core/src/shared/extensions/git.ts @@ -341,8 +341,8 @@ export class GitExtension { if (version === undefined || version.compare(minGitFilterVersion) === -1) { throw new Error( - `Git version is too low or could not be determined (min=${minGitFilterVersion}): ${ - version ?? 'unknown' + `Git version is too low or could not be determined (min=${minGitFilterVersion.version}): ${ + version?.version ?? 'unknown' }` ) } diff --git a/packages/core/src/shared/fs/watchedFiles.ts b/packages/core/src/shared/fs/watchedFiles.ts index 742d77e6a3..ad498ae709 100644 --- a/packages/core/src/shared/fs/watchedFiles.ts +++ b/packages/core/src/shared/fs/watchedFiles.ts @@ -389,7 +389,7 @@ export abstract class WatchedFiles implements vscode.Disposable { } private outputPatterns(): string { - const watch = this.globs.map(cur => cur.toString()) + const watch = this.globs.map(cur => (typeof cur === 'string' ? cur.toString() : cur.pattern)) if (this.watchingUntitledFiles) { watch.push('Untitled Files') } diff --git a/packages/core/src/shared/icons.ts b/packages/core/src/shared/icons.ts index e9206a62e7..9521feb235 100644 --- a/packages/core/src/shared/icons.ts +++ b/packages/core/src/shared/icons.ts @@ -17,7 +17,7 @@ import { getLogger } from './logger/logger' // https://code.visualstudio.com/api/references/icons-in-labels#animation type ContributedIcon = keyof typeof packageJson.contributes.icons -type IconPath = { light: Uri; dark: Uri } | Icon +type IconPath = { light: Uri; dark: Uri; toString: () => string } | Icon type IconId = `vscode-${string}` | ContributedIcon /** @@ -117,13 +117,17 @@ function resolveIconId( return new Icon(namespace === 'vscode' ? name : id, source) } -function resolvePathsSync(rootDir: string, target: string): { light: Uri; dark: Uri } | undefined { - const darkPath = path.join(rootDir, 'dark', `${target}.svg`) - const lightPath = path.join(rootDir, 'light', `${target}.svg`) +function resolvePathsSync( + rootDir: string, + target: string +): { light: Uri; dark: Uri; toString: () => string } | undefined { + const filename = `${target}.svg` + const darkPath = path.join(rootDir, 'dark', filename) + const lightPath = path.join(rootDir, 'light', filename) try { if (!isWeb() && fs.existsSync(darkPath) && fs.existsSync(lightPath)) { - return { dark: Uri.file(darkPath), light: Uri.file(lightPath) } + return { dark: Uri.file(darkPath), light: Uri.file(lightPath), toString: () => filename } } } catch (error) { getLogger().warn(`icons: path resolution failed for "${target}": %s`, error) diff --git a/packages/core/src/shared/resourcefetcher/httpResourceFetcher.ts b/packages/core/src/shared/resourcefetcher/httpResourceFetcher.ts index ba10787e30..bea272abed 100644 --- a/packages/core/src/shared/resourcefetcher/httpResourceFetcher.ts +++ b/packages/core/src/shared/resourcefetcher/httpResourceFetcher.ts @@ -181,9 +181,7 @@ export class HttpResourceFetcher implements ResourceFetcher { promise.cancel(new CancellationError(event.agent).message) }) - promise.finally(() => cancelListener?.dispose()) - - return promise + return promise.finally(() => cancelListener?.dispose()) } private buildRequestHeaders(requestHeaders?: RequestHeaders): Headers { diff --git a/packages/core/src/shared/sam/cli/samCliLocalInvoke.ts b/packages/core/src/shared/sam/cli/samCliLocalInvoke.ts index 418044cfe2..417a8445da 100644 --- a/packages/core/src/shared/sam/cli/samCliLocalInvoke.ts +++ b/packages/core/src/shared/sam/cli/samCliLocalInvoke.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import * as child_process from 'child_process' +import * as proc from 'child_process' import { pushIf } from '../../utilities/collectionUtils' import * as nls from 'vscode-nls' import { fileExists } from '../../filesystemUtilities' @@ -30,7 +30,7 @@ export const waitForDebuggerMessages = { export interface SamLocalInvokeCommandArgs { command: string args: string[] - options?: child_process.SpawnOptions + options?: proc.SpawnOptions /** Wait until strings specified in `debuggerAttachCues` appear in the process output. */ waitForCues: boolean timeout?: Timeout diff --git a/packages/core/src/shared/sam/debugger/csharpSamDebug.ts b/packages/core/src/shared/sam/debugger/csharpSamDebug.ts index 8f7dcbadd8..06a04b08db 100644 --- a/packages/core/src/shared/sam/debugger/csharpSamDebug.ts +++ b/packages/core/src/shared/sam/debugger/csharpSamDebug.ts @@ -219,7 +219,7 @@ export async function makeDotnetDebugConfiguration( codeUri: string ): Promise { if (config.noDebug) { - throw Error(`SAM debug: invalid config ${config}`) + throw Error(`SAM debug: invalid config: ${config.name}`) } const pipeArgs = ['-c', `docker exec -i $(docker ps -q -f publish=${config.debugPort}) \${debuggerCommand}`] config.debuggerPath = pathutil.normalize(getDebuggerPath(codeUri)) diff --git a/packages/core/src/shared/treeview/nodes/awsTreeNodeBase.ts b/packages/core/src/shared/treeview/nodes/awsTreeNodeBase.ts index a123321ba2..4b72ed74d4 100644 --- a/packages/core/src/shared/treeview/nodes/awsTreeNodeBase.ts +++ b/packages/core/src/shared/treeview/nodes/awsTreeNodeBase.ts @@ -11,6 +11,10 @@ export abstract class AWSTreeNodeBase extends TreeItem { /** Service id as defined in the service model. May be undefined for child nodes. */ public serviceId: string | undefined + public override toString(): string { + return `TreeItem(serviceId=${this.serviceId}, label=${this.label})` + } + public constructor(label: string, collapsibleState?: TreeItemCollapsibleState) { super(label, collapsibleState) } diff --git a/packages/core/src/shared/typescriptLambdaHandlerSearch.ts b/packages/core/src/shared/typescriptLambdaHandlerSearch.ts index 62449eb839..ca5640f881 100644 --- a/packages/core/src/shared/typescriptLambdaHandlerSearch.ts +++ b/packages/core/src/shared/typescriptLambdaHandlerSearch.ts @@ -303,6 +303,7 @@ export class TypescriptLambdaHandlerSearch implements LambdaHandlerSearch { private static isNodeExported(node: ts.Node): boolean { const flags: ts.ModifierFlags = ts.getCombinedModifierFlags(node as ts.Declaration) + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison return (flags & ts.ModifierFlags.Export) === ts.ModifierFlags.Export } diff --git a/packages/core/src/shared/utilities/childProcess.ts b/packages/core/src/shared/utilities/childProcess.ts index 7b7ec2c2fc..9b854a1104 100644 --- a/packages/core/src/shared/utilities/childProcess.ts +++ b/packages/core/src/shared/utilities/childProcess.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import * as child_process from 'child_process' +import * as proc from 'child_process' import * as crossSpawn from 'cross-spawn' import * as logger from '../logger' import { Timeout, CancellationError, waitUntil } from './timeoutUtils' @@ -35,7 +35,7 @@ export interface ChildProcessOptions { /** A `Timeout` token. The running process will be terminated on expiration or cancellation. */ timeout?: Timeout /** Options sent to the `spawn` command. This is merged in with the base options if they exist. */ - spawnOptions?: child_process.SpawnOptions + spawnOptions?: proc.SpawnOptions /** Callback for intercepting text from the stdout stream. */ onStdout?: (text: string, context: RunParameterContext) => void /** Callback for intercepting text from the stderr stream. */ @@ -67,7 +67,7 @@ export const eof = Symbol('EOF') */ export class ChildProcess { static #runningProcesses: Map = new Map() - #childProcess: child_process.ChildProcess | undefined + #childProcess: proc.ChildProcess | undefined #processErrors: Error[] = [] #processResult: ChildProcessResult | undefined #log: logger.Logger @@ -291,7 +291,7 @@ export class ChildProcess { } #registerLifecycleListeners( - process: child_process.ChildProcess, + process: proc.ChildProcess, errorHandler: (error: Error, forceStop?: boolean) => void, options?: ChildProcessOptions ): void { diff --git a/packages/core/src/shared/utilities/vsCodeUtils.ts b/packages/core/src/shared/utilities/vsCodeUtils.ts index 8320fe4702..481343e18a 100644 --- a/packages/core/src/shared/utilities/vsCodeUtils.ts +++ b/packages/core/src/shared/utilities/vsCodeUtils.ts @@ -102,7 +102,7 @@ export function buildMissingExtensionMessage( feat = `${getIdeProperties().company} Toolkit` ): string { const minV = semver.coerce(minVersion) - const expectedVersionMsg = isNonNullable(minV) ? ` of version >=${minV}` : '' + const expectedVersionMsg = isNonNullable(minV) ? ` of version >=${minV.version}` : '' return localize( 'AWS.missingExtension', diff --git a/packages/core/src/ssmDocument/commands/publishDocument.ts b/packages/core/src/ssmDocument/commands/publishDocument.ts index 1865d7b96c..4c0905f358 100644 --- a/packages/core/src/ssmDocument/commands/publishDocument.ts +++ b/packages/core/src/ssmDocument/commands/publishDocument.ts @@ -12,7 +12,11 @@ import { ssmJson, ssmYaml } from '../../shared/constants' import * as localizedText from '../../shared/localizedText' import { getLogger, Logger } from '../../shared/logger' -import { PublishSSMDocumentWizard, PublishSSMDocumentWizardResponse } from '../wizards/publishDocumentWizard' +import { + PublishSSMDocumentAction, + PublishSSMDocumentWizard, + PublishSSMDocumentWizardResponse, +} from '../wizards/publishDocumentWizard' import { showConfirmationMessage } from '../util/util' import { telemetry } from '../../shared/telemetry/telemetry' import { Result, SsmOperation } from '../../shared/telemetry/telemetry' @@ -49,9 +53,9 @@ export async function publishSSMDocument(): Promise { try { const response = await new PublishSSMDocumentWizard().run() - if (response?.action === 'Create') { + if (response?.action === PublishSSMDocumentAction.QuickCreate) { await createDocument(response, textDocument) - } else if (response?.action === 'Update') { + } else if (response?.action === PublishSSMDocumentAction.QuickUpdate) { await updateDocument(response, textDocument) } } catch (err) { diff --git a/packages/core/src/stepFunctions/commands/createStateMachineFromTemplate.ts b/packages/core/src/stepFunctions/commands/createStateMachineFromTemplate.ts index 0ed2a65f1b..13b95aef5f 100644 --- a/packages/core/src/stepFunctions/commands/createStateMachineFromTemplate.ts +++ b/packages/core/src/stepFunctions/commands/createStateMachineFromTemplate.ts @@ -43,7 +43,7 @@ export async function createStateMachineFromTemplate(context: vscode.ExtensionCo async function getTextDocumentForSelectedItem( fileName: string, extensionPath: string, - format: string + format: TemplateFormats ): Promise { let content = await readFileAsString(path.join(extensionPath, 'templates', fileName)) diff --git a/packages/core/src/test/eventSchemas/commands/downloadSchemaItemCode.test.ts b/packages/core/src/test/eventSchemas/commands/downloadSchemaItemCode.test.ts index 0c0f9cbade..5afa7f8ad6 100644 --- a/packages/core/src/test/eventSchemas/commands/downloadSchemaItemCode.test.ts +++ b/packages/core/src/test/eventSchemas/commands/downloadSchemaItemCode.test.ts @@ -83,7 +83,9 @@ describe('CodeDownloader', function () { const comparisonResult = arrayBuffersEqual(returnedBuffer, myBuffer.buffer) assert.ok( comparisonResult, - `Buffers do not match, string representation of expected buffer : TEST STRING, returned : ${returnedBuffer.toString()}` + `Buffers do not match, string representation of expected buffer : TEST STRING, returned : ${String( + returnedBuffer + )}` ) }) diff --git a/packages/core/src/test/s3/explorer/s3BucketNode.test.ts b/packages/core/src/test/s3/explorer/s3BucketNode.test.ts index 7a130e0a46..fac4c6cf4b 100644 --- a/packages/core/src/test/s3/explorer/s3BucketNode.test.ts +++ b/packages/core/src/test/s3/explorer/s3BucketNode.test.ts @@ -26,7 +26,7 @@ describe('S3BucketNode', function () { let config: TestSettings function assertBucketNode(node: LoadMoreNode): void { - assert.ok(node instanceof S3BucketNode, `Node ${node} should be a Bucket Node`) + assert.ok(node instanceof S3BucketNode, `Node ${String(node)} should be a Bucket Node`) assert.deepStrictEqual((node as S3BucketNode).bucket, bucket) } diff --git a/packages/core/src/test/s3/explorer/s3FolderNode.test.ts b/packages/core/src/test/s3/explorer/s3FolderNode.test.ts index 6bc7b5e22d..57f72559f7 100644 --- a/packages/core/src/test/s3/explorer/s3FolderNode.test.ts +++ b/packages/core/src/test/s3/explorer/s3FolderNode.test.ts @@ -27,7 +27,7 @@ describe('S3FolderNode', function () { let config: TestSettings function assertFolderNode(node: AWSTreeNodeBase | LoadMoreNode, expectedFolder: Folder): void { - assert.ok(node instanceof S3FolderNode, `Node ${node} should be a Folder Node`) + assert.ok(node instanceof S3FolderNode, `Node ${String(node)} should be a Folder Node`) assert.deepStrictEqual((node as S3FolderNode).bucket, bucket) assert.deepStrictEqual((node as S3FolderNode).folder, expectedFolder) } diff --git a/packages/core/src/test/shared/vscode/message.ts b/packages/core/src/test/shared/vscode/message.ts index 3aca52efff..0c0b960fbe 100644 --- a/packages/core/src/test/shared/vscode/message.ts +++ b/packages/core/src/test/shared/vscode/message.ts @@ -170,7 +170,9 @@ export class TestMessage { throw new Error('Attempted to select from a disposed message') } if (!this.options?.items || this.options.items.length === 0) { - throw new Error(`Could not find the specified item "${item}". Message has no items: ${this.message}`) + throw new Error( + `Could not find the specified item "${String(item)}". Message has no items: ${this.message}` + ) } const selected = @@ -179,7 +181,7 @@ export class TestMessage { : this.options?.items?.find(i => i === item) if (!selected) { - throw new Error(`Could not find the specified item "${item}" on message: ${this.printDebug()}`) + throw new Error(`Could not find the specified item "${String(item)}" on message: ${this.printDebug()}`) } this._selected = selected diff --git a/packages/core/src/test/shared/vscode/quickInput.ts b/packages/core/src/test/shared/vscode/quickInput.ts index 58c1dcf43d..67e1a5878a 100644 --- a/packages/core/src/test/shared/vscode/quickInput.ts +++ b/packages/core/src/test/shared/vscode/quickInput.ts @@ -132,7 +132,7 @@ function findButtonOrThrow( ) { const target = typeof button === 'string' ? input.buttons.filter(b => b.tooltip === button)[0] : button if (target === undefined) { - throwError(`Unable to find button: ${button}`) + throwError(`Unable to find button: ${String(button)}`) } return target diff --git a/plugins/eslint-plugin-aws-toolkits/lib/rules/no-await-on-vscode-msg.ts b/plugins/eslint-plugin-aws-toolkits/lib/rules/no-await-on-vscode-msg.ts index 7510d95db9..aaccbf0020 100644 --- a/plugins/eslint-plugin-aws-toolkits/lib/rules/no-await-on-vscode-msg.ts +++ b/plugins/eslint-plugin-aws-toolkits/lib/rules/no-await-on-vscode-msg.ts @@ -10,9 +10,8 @@ * Awaiting without assigning or otherwise using the response could keep code blocked and cause subtle issues. */ -import { ESLintUtils } from '@typescript-eslint/utils' +import { ESLintUtils, TSESTree } from '@typescript-eslint/utils' import { AST_NODE_TYPES } from '@typescript-eslint/types' -import { Node, Identifier } from '@typescript-eslint/types/dist/generated/ast-spec' import { Rule } from 'eslint' export const errMsg = @@ -20,7 +19,7 @@ export const errMsg = const notificationFuncNames = ['showInformationMessage', 'showWarningMessage', 'showErrorMessage'] -function isVariableAssignment(node: Node) { +function isVariableAssignment(node: TSESTree.Node) { while (node.parent) { if (node.parent.type === AST_NODE_TYPES.VariableDeclarator) { return true // we are assigning the response, i.e. its being used. @@ -37,7 +36,7 @@ export default ESLintUtils.RuleCreator.withoutDocs({ meta: { docs: { description: 'disallow awaiting on vscode notifications if the response is unused', - recommended: 'error', + recommended: 'recommended', }, messages: { errMsg, @@ -66,9 +65,9 @@ export default ESLintUtils.RuleCreator.withoutDocs({ const expr = node.argument.callee let property if (expr.type === AST_NODE_TYPES.MemberExpression) { - property = expr.property as Identifier + property = expr.property as TSESTree.Identifier } else if (expr.type === AST_NODE_TYPES.Identifier) { - property = expr as Identifier + property = expr as TSESTree.Identifier } else { return } diff --git a/plugins/eslint-plugin-aws-toolkits/lib/rules/no-only-in-tests.ts b/plugins/eslint-plugin-aws-toolkits/lib/rules/no-only-in-tests.ts index b35eaa90e5..0e43dd73ef 100644 --- a/plugins/eslint-plugin-aws-toolkits/lib/rules/no-only-in-tests.ts +++ b/plugins/eslint-plugin-aws-toolkits/lib/rules/no-only-in-tests.ts @@ -8,18 +8,17 @@ * This rule prevents us from accidentially committing this to the public repo. */ -import { ESLintUtils } from '@typescript-eslint/utils' +import { ESLintUtils, TSESTree } from '@typescript-eslint/utils' import { AST_NODE_TYPES } from '@typescript-eslint/types' -import { CallExpression, Identifier, MemberExpression } from '@typescript-eslint/types/dist/generated/ast-spec' import { Rule } from 'eslint' -function isValidExpression(node: CallExpression): MemberExpression | undefined { +function isValidExpression(node: TSESTree.CallExpression): TSESTree.MemberExpression | undefined { const isValid = node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.property.type === AST_NODE_TYPES.Identifier - return isValid ? (node.callee as MemberExpression) : undefined + return isValid ? (node.callee as TSESTree.MemberExpression) : undefined } export const describeOnlyErrMsg = 'mocha test `.only()` not allowed for `describe`' @@ -29,7 +28,7 @@ export default ESLintUtils.RuleCreator.withoutDocs({ meta: { docs: { description: "disallow mocha's only() from being published in test code", - recommended: 'error', + recommended: 'recommended', }, messages: { describeOnlyErrMsg, @@ -46,9 +45,9 @@ export default ESLintUtils.RuleCreator.withoutDocs({ if (!isValidExpression(node)) { return } - const expr = node.callee as MemberExpression - const property = expr.property as Identifier - const object = expr.object as Identifier + const expr = node.callee as TSESTree.MemberExpression + const property = expr.property as TSESTree.Identifier + const object = expr.object as TSESTree.Identifier if (property.name !== 'only') { return