From b9c9954592b3c39a1c0f206cc603b8357cf5047a Mon Sep 17 00:00:00 2001 From: Andy Pickering Date: Mon, 18 May 2026 12:25:11 +0900 Subject: [PATCH] 4.19: Enable TypeScript noImplicitAny option & fix types as necessary Co-authored-by: Cursor --- package-lock.json | 256 ++++++++++++++++-------- package.json | 5 + src/components/AttachLogModal.tsx | 10 +- src/components/AttachmentModal.tsx | 6 +- src/components/AttachmentsSizeAlert.tsx | 5 +- src/components/Prompt.tsx | 22 +- src/hooks/usePopover.ts | 4 +- src/redux-reducers.ts | 4 +- src/validation.ts | 2 +- tsconfig.json | 1 - 10 files changed, 211 insertions(+), 104 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5221b594..2281ed83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,8 +37,13 @@ }, "devDependencies": { "@cypress/grep": "6.0.0", + "@types/js-yaml": "4.0.9", + "@types/lodash": "4.17.24", + "@types/murmurhash-js": "1.0.7", "@types/node": "^22.19.17", "@types/react": "^17.0.91", + "@types/react-modal": "3.16.3", + "@types/react-redux": "7.1.34", "@typescript-eslint/eslint-plugin": "^8.58.1", "@typescript-eslint/parser": "^8.58.1", "cypress": "15.14.2", @@ -358,13 +363,10 @@ } }, "node_modules/@babel/runtime": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz", - "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==", + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz", + "integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==", "license": "MIT", - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, "engines": { "node": ">=6.9.0" } @@ -1561,9 +1563,10 @@ } }, "node_modules/@openshift/dynamic-plugin-sdk-webpack": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@openshift/dynamic-plugin-sdk-webpack/-/dynamic-plugin-sdk-webpack-4.0.2.tgz", - "integrity": "sha512-zgRLt9WM63aGYygrQEtd8QtWoP5zYWr67kzlRKzGcHeRbWDgiHnY7FOiDUM04bYeb4lL6qv3iErEnrtvVpyh0Q==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@openshift/dynamic-plugin-sdk-webpack/-/dynamic-plugin-sdk-webpack-4.1.0.tgz", + "integrity": "sha512-Pkq6R+fkoE0llgv9WJBcotViAPywrzDkpWK0HSTmrVyfEuWS5cuZUs8ono6L5w9BqDBRXm3ceEuUAZA/Zrar1w==", + "license": "Apache-2.0", "dependencies": { "lodash": "^4.17.21", "semver": "^7.3.7", @@ -1577,9 +1580,9 @@ } }, "node_modules/@openshift/dynamic-plugin-sdk-webpack/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.0.tgz", + "integrity": "sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -1627,9 +1630,9 @@ } }, "node_modules/@patternfly/chatbot/node_modules/@types/react": { - "version": "19.2.14", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", - "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", + "version": "19.2.15", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.15.tgz", + "integrity": "sha512-eRwcGNHve+E8qtEQSSRl6urh+rFop4v8gm6O8rGv25CodbvFdLjA1vVQ1KkiFE0w0UPOnb8tDiFKL5lp0rtY5Q==", "license": "MIT", "peer": true, "dependencies": { @@ -1757,15 +1760,15 @@ "license": "MIT" }, "node_modules/@patternfly/react-topology": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@patternfly/react-topology/-/react-topology-6.3.0.tgz", - "integrity": "sha512-v0P8khAJqS01haEl9abw3L/MzdpIY+PsEVGBAMgA/tBhU/+9Ieco8fmmjW+7CfRmXhSC8NUjYgasl+9ZJVd3rA==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@patternfly/react-topology/-/react-topology-6.5.0.tgz", + "integrity": "sha512-z86n2jXlv21Enwf/Km6mORbVX6lfTQ+/jvn75AUK/DXpXDdSFpxI23mS+yBPNSZ1dbWVv9a8tLKGum0WP50H9g==", "license": "MIT", "dependencies": { "@dagrejs/dagre": "1.1.2", - "@patternfly/react-core": "^6.0.0", - "@patternfly/react-icons": "^6.0.0", - "@patternfly/react-styles": "^6.0.0", + "@patternfly/react-core": "^6.4.0", + "@patternfly/react-icons": "^6.4.0", + "@patternfly/react-styles": "^6.4.0", "@types/d3": "^7.4.0", "@types/d3-force": "^1.2.1", "d3": "^7.8.0", @@ -2342,9 +2345,9 @@ "license": "MIT" }, "node_modules/@types/d3-shape": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz", - "integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.8.tgz", + "integrity": "sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w==", "license": "MIT", "dependencies": { "@types/d3-path": "*" @@ -2497,6 +2500,13 @@ "@types/node": "*" } }, + "node_modules/@types/js-yaml": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -2504,9 +2514,10 @@ "license": "MIT" }, "node_modules/@types/lodash": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.0.tgz", - "integrity": "sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA==" + "version": "4.17.24", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.24.tgz", + "integrity": "sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==", + "license": "MIT" }, "node_modules/@types/mdast": { "version": "4.0.4", @@ -2535,6 +2546,13 @@ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, + "node_modules/@types/murmurhash-js": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/murmurhash-js/-/murmurhash-js-1.0.7.tgz", + "integrity": "sha512-XM6078Du3jaEJVwpxmPZsJQDMzWabjY4ILQQvW4VPBzTULd+Fjs2Z54s+OrLzDRxgs6J09YyDISnZDlltYAchw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "22.19.17", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.17.tgz", @@ -2551,9 +2569,9 @@ "license": "MIT" }, "node_modules/@types/prop-types": { - "version": "15.7.4", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", - "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==", + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", "license": "MIT" }, "node_modules/@types/qs": { @@ -2569,9 +2587,9 @@ "devOptional": true }, "node_modules/@types/react": { - "version": "17.0.91", - "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.91.tgz", - "integrity": "sha512-xauZca6qMeCU3Moy0KxCM9jtf1vyk6qRYK39Ryf3afUqwgNUjRIGoDdS9BcGWgAMGSg1hvP4XcmlYrM66PtqeA==", + "version": "17.0.92", + "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.92.tgz", + "integrity": "sha512-TqKlM6WfeXFUV0rKnRhe7yYctmCNfLHhJGyN3FRr70nwQmCM4pYRO1l0W8979K0Va72KGF1d8MPtT1kt0pw0ng==", "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -2579,6 +2597,16 @@ "csstype": "^3.2.2" } }, + "node_modules/@types/react-modal": { + "version": "3.16.3", + "resolved": "https://registry.npmjs.org/@types/react-modal/-/react-modal-3.16.3.tgz", + "integrity": "sha512-xXuGavyEGaFQDgBv4UVm8/ZsG+qxeQ7f77yNrW3n+1J6XAstUy5rYHeIHPh1KzsGc6IkCIdu6lQ2xWzu1jBTLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/react": "*" + } + }, "node_modules/@types/react-redux": { "version": "7.1.34", "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.34.tgz", @@ -2591,6 +2619,15 @@ "redux": "^4.0.0" } }, + "node_modules/@types/react-redux/node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, "node_modules/@types/retry": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", @@ -2600,7 +2637,8 @@ "node_modules/@types/scheduler": { "version": "0.16.8", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", - "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==" + "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==", + "license": "MIT" }, "node_modules/@types/send": { "version": "0.17.4", @@ -4446,7 +4484,8 @@ "node_modules/classnames": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", - "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==" + "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", + "license": "MIT" }, "node_modules/cli-cursor": { "version": "5.0.0", @@ -4818,10 +4857,11 @@ "dev": true }, "node_modules/cookie": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", - "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", "devOptional": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5446,9 +5486,9 @@ } }, "node_modules/d3-format": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", - "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz", + "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==", "license": "ISC", "engines": { "node": ">=12" @@ -5834,9 +5874,9 @@ } }, "node_modules/delaunator": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz", - "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.1.0.tgz", + "integrity": "sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ==", "license": "ISC", "dependencies": { "robust-predicates": "^3.0.2" @@ -6964,7 +7004,8 @@ "node_modules/exenv": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", - "integrity": "sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==" + "integrity": "sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==", + "license": "BSD-3-Clause" }, "node_modules/express": { "version": "4.22.1", @@ -8272,6 +8313,7 @@ "version": "4.10.1", "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.1.2", "loose-envify": "^1.2.0", @@ -8500,25 +8542,32 @@ } }, "node_modules/i18next": { - "version": "23.11.5", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.11.5.tgz", - "integrity": "sha512-41pvpVbW9rhZPk5xjCX2TPJi2861LEig/YRhUkY+1FQ2IQPS0bKUDYnEqY8XPPbB48h1uIwLnP9iiEfuSl20CA==", + "version": "26.2.0", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-26.2.0.tgz", + "integrity": "sha512-zwBHldHdTmwN7r6UNc7lC6GWNN+YYg3DrRSeHR5PRRBf5QnJZcYHrQc0uaU26qZeYxR7iFZD+Y315dPnKP47wA==", "funding": [ { "type": "individual", - "url": "https://locize.com" + "url": "https://www.locize.com/i18next" }, { "type": "individual", - "url": "https://locize.com/i18next.html" + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" }, { "type": "individual", - "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + "url": "https://www.locize.com" } ], - "dependencies": { - "@babel/runtime": "^7.23.2" + "license": "MIT", + "peer": true, + "peerDependencies": { + "typescript": "^5 || ^6" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/i18next-parser": { @@ -8557,9 +8606,9 @@ } }, "node_modules/i18next-parser/node_modules/fs-extra": { - "version": "11.3.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", - "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", + "version": "11.3.4", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.4.tgz", + "integrity": "sha512-CTXd6rk/M3/ULNQj8FBqBWHYBVYybQ3VPBw0xGKFe3tuH7ytT6ACnvzpIQ3UZtB8yvUKC2cXn1a+x+5EVQLovA==", "dev": true, "license": "MIT", "dependencies": { @@ -8571,6 +8620,38 @@ "node": ">=14.14" } }, + "node_modules/i18next-parser/node_modules/i18next": { + "version": "24.2.3", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-24.2.3.tgz", + "integrity": "sha512-lfbf80OzkocvX7nmZtu7nSTNbrTYR52sLWxPtlXX1zAhVw8WEnFk4puUkCR4B1dNQwbSpEHHHemcZu//7EcB7A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.26.10" + }, + "peerDependencies": { + "typescript": "^5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -11142,9 +11223,9 @@ } }, "node_modules/mobx": { - "version": "6.15.0", - "resolved": "https://registry.npmjs.org/mobx/-/mobx-6.15.0.tgz", - "integrity": "sha512-UczzB+0nnwGotYSgllfARAqWCJ5e/skuV2K/l+Zyck/H6pJIhLXuBnz+6vn2i211o7DtbE78HQtsYEKICHGI+g==", + "version": "6.15.3", + "resolved": "https://registry.npmjs.org/mobx/-/mobx-6.15.3.tgz", + "integrity": "sha512-6+ZSYDs5zgH5CdGfEU2q2Lsa5PztVryL1ys7kAImTU25n2A9LAMj/yneVsQpd03MfwMLDQF+7kakJR9Z+cQxSw==", "license": "MIT", "funding": { "type": "opencollective", @@ -11478,7 +11559,8 @@ "node_modules/nanoclone": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz", - "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==" + "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==", + "license": "MIT" }, "node_modules/nanoid": { "version": "3.3.11", @@ -12060,6 +12142,7 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.9.0.tgz", "integrity": "sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==", + "license": "MIT", "dependencies": { "isarray": "0.0.1" } @@ -12067,7 +12150,8 @@ "node_modules/path-to-regexp/node_modules/isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "license": "MIT" }, "node_modules/path-type": { "version": "4.0.0", @@ -12187,9 +12271,9 @@ } }, "node_modules/postcss": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", - "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "version": "8.5.12", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.12.tgz", + "integrity": "sha512-W62t/Se6rA0Az3DfCL0AqJwXuKwBeYg6nOaIgzP+xZ7N5BFCI7DYi1qs6ygUYT6rvfi6t9k65UMLJC+PHZpDAA==", "funding": [ { "type": "opencollective", @@ -12436,7 +12520,8 @@ "node_modules/property-expr": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.6.tgz", - "integrity": "sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==" + "integrity": "sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==", + "license": "MIT" }, "node_modules/proxy-addr": { "version": "2.0.7", @@ -12719,6 +12804,7 @@ "version": "11.18.6", "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.18.6.tgz", "integrity": "sha512-yHb2F9BiT0lqoQDt8loZ5gWP331GwctHz9tYQ8A2EIEUu+CcEdjBLQWli1USG3RdWQt3W+jqQLg/d4rrQR96LA==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.14.5", "html-parse-stringify": "^3.0.1" @@ -12745,12 +12831,14 @@ "node_modules/react-lifecycles-compat": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", - "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==", + "license": "MIT" }, "node_modules/react-modal": { "version": "3.16.3", "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.16.3.tgz", "integrity": "sha512-yCYRJB5YkeQDQlTt17WGAgFJ7jr2QYcWa1SHqZ3PluDmnKJ/7+tVU+E6uKyZ0nODaeEj+xCpK4LcSnKXLMC0Nw==", + "license": "MIT", "dependencies": { "exenv": "^1.2.0", "prop-types": "^15.7.2", @@ -12797,6 +12885,7 @@ "version": "5.3.4", "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.3.4.tgz", "integrity": "sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.13", "history": "^4.9.0", @@ -12816,6 +12905,7 @@ "version": "5.3.4", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.3.4.tgz", "integrity": "sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.13", "history": "^4.9.0", @@ -12852,6 +12942,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.7.6" } @@ -12990,11 +13081,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" - }, "node_modules/regexp.prototype.flags": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", @@ -13201,7 +13287,8 @@ "node_modules/reselect": { "version": "4.1.8", "resolved": "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz", - "integrity": "sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==" + "integrity": "sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==", + "license": "MIT" }, "node_modules/resolve": { "version": "1.22.11", @@ -13269,7 +13356,8 @@ "node_modules/resolve-pathname": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", - "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==" + "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==", + "license": "MIT" }, "node_modules/restore-cursor": { "version": "5.1.0", @@ -13360,9 +13448,9 @@ } }, "node_modules/robust-predicates": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", - "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.3.tgz", + "integrity": "sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==", "license": "Unlicense" }, "node_modules/rsvp": { @@ -14986,12 +15074,14 @@ "node_modules/tiny-invariant": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", - "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==" + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "license": "MIT" }, "node_modules/tiny-warning": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", - "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==", + "license": "MIT" }, "node_modules/tinyglobby": { "version": "0.2.15", @@ -15103,7 +15193,8 @@ "node_modules/toposort": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", - "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==" + "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==", + "license": "MIT" }, "node_modules/tough-cookie": { "version": "5.1.2", @@ -15785,7 +15876,8 @@ "node_modules/value-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz", - "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==" + "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==", + "license": "MIT" }, "node_modules/value-or-function": { "version": "4.0.0", @@ -15947,7 +16039,7 @@ "node_modules/void-elements": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", - "integrity": "sha1-YU9/v42AHwu18GYfWy9XhXUOTwk=", + "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==", "license": "MIT", "engines": { "node": ">=0.10.0" @@ -15972,6 +16064,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", + "license": "MIT", "dependencies": { "loose-envify": "^1.0.0" } @@ -16667,6 +16760,7 @@ "version": "0.32.11", "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz", "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.15.4", "@types/lodash": "^4.14.175", diff --git a/package.json b/package.json index 6aad567f..443f7cfd 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,13 @@ }, "devDependencies": { "@cypress/grep": "6.0.0", + "@types/js-yaml": "4.0.9", + "@types/lodash": "4.17.24", + "@types/murmurhash-js": "1.0.7", "@types/node": "^22.19.17", "@types/react": "^17.0.91", + "@types/react-modal": "3.16.3", + "@types/react-redux": "7.1.34", "@typescript-eslint/eslint-plugin": "^8.58.1", "@typescript-eslint/parser": "^8.58.1", "cypress": "15.14.2", diff --git a/src/components/AttachLogModal.tsx b/src/components/AttachLogModal.tsx index 1cb6f59d..91583907 100644 --- a/src/components/AttachLogModal.tsx +++ b/src/components/AttachLogModal.tsx @@ -5,6 +5,7 @@ import { useDispatch } from 'react-redux'; import { consoleFetchText, K8sResourceKind, + Selector, useK8sWatchResource, } from '@openshift-console/dynamic-plugin-sdk'; import { @@ -257,9 +258,9 @@ const AttachLogModal: React.FC = ({ isOpen, onClose, resour isCronJob ? { isList: true, kind: 'Job', namespace } : null, ); - let selector; + let selector: Selector | undefined; if (kind === 'Job') { - selector = { 'job-name': name }; + selector = { matchLabels: { 'job-name': name } }; } else if (isCronJob) { const ownedJobNames = (jobs || []) .filter((job) => @@ -281,7 +282,7 @@ const AttachLogModal: React.FC = ({ isOpen, onClose, resour selector = undefined; } } else if (kind === 'VirtualMachine' || kind === 'VirtualMachineInstance') { - selector = { 'vm.kubevirt.io/name': name }; + selector = { matchLabels: { 'vm.kubevirt.io/name': name } }; } else if (scaleTarget && scaleTargetLoaded && !scaleTargetError) { selector = scaleTarget.spec?.selector; } else { @@ -297,7 +298,8 @@ const AttachLogModal: React.FC = ({ isOpen, onClose, resour const changePod = (newPod: K8sResourceKind) => { if (newPod) { setPod(newPod); - const newContainers = newPod.spec?.containers?.map((c) => c.name).sort() ?? []; + const newContainers = + newPod.spec?.containers?.map((c: { name: string }) => c.name).sort() ?? []; setContainers(newContainers); setContainer(newContainers[0]); } diff --git a/src/components/AttachmentModal.tsx b/src/components/AttachmentModal.tsx index 33a29ec8..bc4c1d04 100644 --- a/src/components/AttachmentModal.tsx +++ b/src/components/AttachmentModal.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { BlueInfoCircleIcon } from '@openshift-console/dynamic-plugin-sdk'; -import { CodeEditor, Language } from '@patternfly/react-code-editor'; +import { CodeEditor, EditorDidMount, Language } from '@patternfly/react-code-editor'; import { ActionGroup, Button, @@ -49,10 +49,10 @@ type EditorProps = { const Editor: React.FC = ({ onChange }) => { const attachment: Attachment = useSelector((s: State) => s.plugins?.ols?.get('openAttachment')); - const onEditorDidMount = (_editor, monaco) => { + const onEditorDidMount: EditorDidMount = (_editor, monaco) => { // Work around crash when CodeEditor attempts to call this nonexistent function // TODO: Figure out why this is happening - monaco.editor.onDidChangeMarkers = () => {}; + (monaco.editor as { onDidChangeMarkers: () => void }).onDidChangeMarkers = () => {}; }; const [isDarkTheme] = useIsDarkTheme(); diff --git a/src/components/AttachmentsSizeAlert.tsx b/src/components/AttachmentsSizeAlert.tsx index 5c793991..d1a43d95 100644 --- a/src/components/AttachmentsSizeAlert.tsx +++ b/src/components/AttachmentsSizeAlert.tsx @@ -4,6 +4,7 @@ import { useSelector } from 'react-redux'; import { Alert } from '@patternfly/react-core'; import { State } from '../redux-reducers'; +import { Attachment } from '../types'; const MAX_CHARS = 1000000; @@ -12,7 +13,9 @@ const AttachmentsSizeAlert: React.FC = () => { const attachments = useSelector((s: State) => s.plugins?.ols?.get('attachments')); - const totalChars = attachments.valueSeq().reduce((sum, a) => sum + a.value.length, 0); + const totalChars = attachments + .valueSeq() + .reduce((sum: number, a: Attachment) => sum + a.value.length, 0); if (totalChars <= MAX_CHARS) { return null; diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx index 55cadffd..ae83a2a5 100644 --- a/src/components/Prompt.tsx +++ b/src/components/Prompt.tsx @@ -8,6 +8,10 @@ import { consoleFetch, consoleFetchJSON, K8sResourceKind, + PrometheusAlert, + PrometheusRule, + PrometheusRulesResponse, + Silence, useK8sWatchResource, } from '@openshift-console/dynamic-plugin-sdk'; import { MessageBar } from '@patternfly/chatbot'; @@ -184,8 +188,8 @@ const Prompt: React.FC = ({ scrollIntoView }) => { reader.onload = (event) => { try { const yaml = event.target?.result as string; - const content = loadYAML(yaml); - if (typeof content !== 'object') { + const content = loadYAML(yaml) as K8sResourceKind | null; + if (typeof content !== 'object' || content === null) { setError(t('Uploaded file is not valid YAML')); return; } @@ -356,8 +360,8 @@ const Prompt: React.FC = ({ scrollIntoView }) => { const labels = Object.fromEntries(new URLSearchParams(location.search)); const alertsEndpoint = labels.cluster ? ALERTS_THANOS_ENDPOINT : ALERTS_ENDPOINT; consoleFetchJSON(alertsEndpoint, 'get', getRequestInitWithAuthHeader()) - .then((response) => { - let alert; + .then((response: PrometheusRulesResponse) => { + let alert: PrometheusAlert | undefined; each(response?.data?.groups, (group) => { each(group.rules, (rule) => { alert = rule.alerts?.find((a) => isMatch(labels, a.labels)); @@ -406,7 +410,7 @@ const Prompt: React.FC = ({ scrollIntoView }) => { } else if (kind === 'Silence') { setLoading(); consoleFetchJSON(`${SILENCE_ENDPOINT}/${name}`, 'get', getRequestInitWithAuthHeader()) - .then((silence) => { + .then((silence: Silence) => { try { const silenceName = silence.matchers @@ -433,8 +437,8 @@ const Prompt: React.FC = ({ scrollIntoView }) => { const ruleLabels = Object.fromEntries(new URLSearchParams(location.search)); const rulesEndpoint = ruleLabels.cluster ? ALERTS_THANOS_ENDPOINT : ALERTS_ENDPOINT; consoleFetchJSON(rulesEndpoint, 'get', getRequestInitWithAuthHeader()) - .then((response) => { - let matchedRule; + .then((response: PrometheusRulesResponse) => { + let matchedRule: PrometheusRule | undefined; each(response?.data?.groups, (group) => { const found = group.rules?.find( (rule) => rule.type === 'alerting' && alertingRuleID(group, rule) === name, @@ -575,7 +579,7 @@ const Prompt: React.FC = ({ scrollIntoView }) => { dispatch( chatHistoryPush({ - attachments: attachments.map((a) => omit(a, 'originalValue')), + attachments: attachments.map((a: Attachment) => omit(a, 'originalValue')), hidden: hidePrompt, text: query, who: 'user', @@ -907,7 +911,7 @@ const Prompt: React.FC = ({ scrollIntoView }) => { hasStopButton={isStreaming} innerRef={textareaRef} isSendButtonDisabled={!query || query.trim().length === 0} - onChange={(e) => onChange(e, e.target.value)} + onChange={(e: React.ChangeEvent) => onChange(e, e.target.value)} onSendMessage={onSubmit} placeholder={ isTroubleshooting diff --git a/src/hooks/usePopover.ts b/src/hooks/usePopover.ts index 0d455ea6..316bcd4d 100644 --- a/src/hooks/usePopover.ts +++ b/src/hooks/usePopover.ts @@ -6,7 +6,7 @@ import Popover from '../components/Popover'; const POPOVER_ID = 'plugin__lightspeed-console-plugin__POPOVER_ID'; -const usePopover = () => { +const usePopover = (): null => { const [isLaunched, , setLaunched] = useBoolean(false); const launchModal = useModal(); @@ -18,7 +18,7 @@ const usePopover = () => { } }, [isLaunched, launchModal, setLaunched]); - return []; + return null; }; export default usePopover; diff --git a/src/redux-reducers.ts b/src/redux-reducers.ts index b2709d5a..2c8966e2 100644 --- a/src/redux-reducers.ts +++ b/src/redux-reducers.ts @@ -77,14 +77,14 @@ const reducer = (state: OLSState, action: OLSAction): OLSState => { case ActionType.ChatHistoryUpdateByID: { const index = state .get('chatHistory') - .findIndex((entry) => entry.get('id') === action.payload.id); + .findIndex((entry: ImmutableMap) => entry.get('id') === action.payload.id); return state.mergeIn(['chatHistory', index], action.payload.entry); } case ActionType.ChatHistoryUpdateTool: { const index = state .get('chatHistory') - .findIndex((entry) => entry.get('id') === action.payload.id); + .findIndex((entry: ImmutableMap) => entry.get('id') === action.payload.id); return state.mergeIn( ['chatHistory', index, 'tools', action.payload.toolID], action.payload.tool, diff --git a/src/validation.ts b/src/validation.ts index f1051ac3..1fac82af 100644 --- a/src/validation.ts +++ b/src/validation.ts @@ -14,7 +14,7 @@ export const alertingRuleID = ( rule.query, ..._map(rule.labels, (v, k) => `${v}=${k}`), ].join(','); - return String(murmur3(key, 'monitoring-salt')); + return String(murmur3(key)); }; export const isValidAlertName = (value: string | null | undefined): boolean => diff --git a/tsconfig.json b/tsconfig.json index 26f5f27f..cef5078c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,6 @@ "jsx": "react", "allowJs": true, "strict": true, - "noImplicitAny": false, "strictNullChecks": false, "noUnusedLocals": true, "sourceMap": false,