From a5f16906e912187d043cd3793fcc7bfc921d07d0 Mon Sep 17 00:00:00 2001 From: Peyton-McKee Date: Sat, 25 May 2024 22:13:44 -0400 Subject: [PATCH 1/4] Fix yarn.lock --- yarn.lock | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 106 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 90dec3d861..7927f618ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4123,7 +4123,29 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^4.18.0, @typescript-eslint/eslint-plugin@npm:^4.5.0": +"@typescript-eslint/eslint-plugin@npm:4.18.0": + version: 4.18.0 + resolution: "@typescript-eslint/eslint-plugin@npm:4.18.0" + dependencies: + "@typescript-eslint/experimental-utils": 4.18.0 + "@typescript-eslint/scope-manager": 4.18.0 + debug: ^4.1.1 + functional-red-black-tree: ^1.0.1 + lodash: ^4.17.15 + regexpp: ^3.0.0 + semver: ^7.3.2 + tsutils: ^3.17.1 + peerDependencies: + "@typescript-eslint/parser": ^4.0.0 + eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 0e781b0d88ad29badc593a5d3babc53c38a4a5ad8f76161b2d9d47b651c939233f83fb4ce14dd075d86625e834aa25fb07d6f19bb7d98ec55646664eec8c7e29 + languageName: node + linkType: hard + +"@typescript-eslint/eslint-plugin@npm:^4.5.0": version: 4.33.0 resolution: "@typescript-eslint/eslint-plugin@npm:4.33.0" dependencies: @@ -4145,6 +4167,22 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/experimental-utils@npm:4.18.0": + version: 4.18.0 + resolution: "@typescript-eslint/experimental-utils@npm:4.18.0" + dependencies: + "@types/json-schema": ^7.0.3 + "@typescript-eslint/scope-manager": 4.18.0 + "@typescript-eslint/types": 4.18.0 + "@typescript-eslint/typescript-estree": 4.18.0 + eslint-scope: ^5.0.0 + eslint-utils: ^2.0.0 + peerDependencies: + eslint: "*" + checksum: e3a404cc0102b3a414798daf2f98782657112abc99ca6b83a74978c078a28c86314cb09ff1919ec00356001e10f2f21ea395c1c0b643849f0dec0f70904c1f15 + languageName: node + linkType: hard + "@typescript-eslint/experimental-utils@npm:4.33.0, @typescript-eslint/experimental-utils@npm:^4.0.1": version: 4.33.0 resolution: "@typescript-eslint/experimental-utils@npm:4.33.0" @@ -4176,7 +4214,24 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^4.18.0, @typescript-eslint/parser@npm:^4.5.0": +"@typescript-eslint/parser@npm:4.18.0": + version: 4.18.0 + resolution: "@typescript-eslint/parser@npm:4.18.0" + dependencies: + "@typescript-eslint/scope-manager": 4.18.0 + "@typescript-eslint/types": 4.18.0 + "@typescript-eslint/typescript-estree": 4.18.0 + debug: ^4.1.1 + peerDependencies: + eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 03ab70d1cb0b04ffa60aa089be45cc45737881c8ae57fac02afe02c38e61c3f1fb281a7d2dfbc6600c88c197c142ca3db83cefed96937e6cc2fce6014f37c410 + languageName: node + linkType: hard + +"@typescript-eslint/parser@npm:^4.5.0": version: 4.33.0 resolution: "@typescript-eslint/parser@npm:4.33.0" dependencies: @@ -4193,6 +4248,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:4.18.0": + version: 4.18.0 + resolution: "@typescript-eslint/scope-manager@npm:4.18.0" + dependencies: + "@typescript-eslint/types": 4.18.0 + "@typescript-eslint/visitor-keys": 4.18.0 + checksum: 52b6dbac8cac1599d087882d9469fba00eff9d3e4c64dc1118eef3d10a7ba02e59675c0cfe1363af0cd87c8840d31f7375fe3b01a0866c5ff6a69721d52e586d + languageName: node + linkType: hard + "@typescript-eslint/scope-manager@npm:4.33.0": version: 4.33.0 resolution: "@typescript-eslint/scope-manager@npm:4.33.0" @@ -4210,6 +4275,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:4.18.0": + version: 4.18.0 + resolution: "@typescript-eslint/types@npm:4.18.0" + checksum: 3397b58099c0a86a13b201b9b6b2313577d92f71dd5be5f87f050559902b36be0de63e54e1d1ceda39e8cf1d57937588cff7374b2481a5a92e8ede5e8c986872 + languageName: node + linkType: hard + "@typescript-eslint/types@npm:4.33.0": version: 4.33.0 resolution: "@typescript-eslint/types@npm:4.33.0" @@ -4236,6 +4308,24 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/typescript-estree@npm:4.18.0": + version: 4.18.0 + resolution: "@typescript-eslint/typescript-estree@npm:4.18.0" + dependencies: + "@typescript-eslint/types": 4.18.0 + "@typescript-eslint/visitor-keys": 4.18.0 + debug: ^4.1.1 + globby: ^11.0.1 + is-glob: ^4.0.1 + semver: ^7.3.2 + tsutils: ^3.17.1 + peerDependenciesMeta: + typescript: + optional: true + checksum: 451d329f0086cf1ecabfe1f3b73cc291472e02b3e167d83f2ffa6681a8de9054c1d8c63a6b56f34da22910802483382fc3a456221a94db5013f21e76e83a933b + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:4.33.0": version: 4.33.0 resolution: "@typescript-eslint/typescript-estree@npm:4.33.0" @@ -4263,6 +4353,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:4.18.0": + version: 4.18.0 + resolution: "@typescript-eslint/visitor-keys@npm:4.18.0" + dependencies: + "@typescript-eslint/types": 4.18.0 + eslint-visitor-keys: ^2.0.0 + checksum: 4e515d93edff7c2a7c7b558581c448865b845d2dcea912c2a19373b65f8f8949b858a2f2e283f670a3e49302892b9c139a50578de6d8ba8fe7e85cf3f880a5fe + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:4.33.0": version: 4.33.0 resolution: "@typescript-eslint/visitor-keys@npm:4.33.0" @@ -9805,8 +9905,8 @@ __metadata: "@babel/preset-typescript": ^7.18.6 "@types/jest": ^28.1.6 "@types/node": 18.17.1 - "@typescript-eslint/eslint-plugin": ^4.18.0 - "@typescript-eslint/parser": ^4.18.0 + "@typescript-eslint/eslint-plugin": 4.18.0 + "@typescript-eslint/parser": 4.18.0 concurrently: ^5.2.0 eslint: ^7.0.0 eslint-config-prettier: ^8.5.0 @@ -10398,7 +10498,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.0.3": +"globby@npm:^11.0.1, globby@npm:^11.0.3": version: 11.1.0 resolution: "globby@npm:11.1.0" dependencies: @@ -17179,7 +17279,7 @@ __metadata: languageName: node linkType: hard -"regexpp@npm:^3.1.0": +"regexpp@npm:^3.0.0, regexpp@npm:^3.1.0": version: 3.2.0 resolution: "regexpp@npm:3.2.0" checksum: a78dc5c7158ad9ddcfe01aa9144f46e192ddbfa7b263895a70a5c6c73edd9ce85faf7c0430e59ac38839e1734e275b9c3de5c57ee3ab6edc0e0b1bdebefccef8 From 94cf3dd26999e58cae6aa9eb546d25d23d0a4ff6 Mon Sep 17 00:00:00 2001 From: Peyton-McKee Date: Sat, 25 May 2024 22:17:13 -0400 Subject: [PATCH 2/4] Add React App Eslint Dependency --- package.json | 1 + yarn.lock | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/package.json b/package.json index 85d823caa0..a6f7b30145 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "concurrently": "^5.2.0", "eslint": "^7.0.0", "eslint-config-prettier": "^8.5.0", + "eslint-config-react": "^1.1.7", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.0.5", "rimraf": "^3.0.2", diff --git a/yarn.lock b/yarn.lock index 7927f618ec..f89ac3f99e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8988,6 +8988,13 @@ __metadata: languageName: node linkType: hard +"eslint-config-react@npm:^1.1.7": + version: 1.1.7 + resolution: "eslint-config-react@npm:1.1.7" + checksum: 15d3d7f78e720c225ac983fb6985825b561941f1c930116c96f8ab8600eb65db603f5ef200a10fabd51f8ef564c107e8eb0d3f69609bfdedfb50290227249a70 + languageName: node + linkType: hard + "eslint-import-resolver-node@npm:^0.3.9": version: 0.3.9 resolution: "eslint-import-resolver-node@npm:0.3.9" @@ -9910,6 +9917,7 @@ __metadata: concurrently: ^5.2.0 eslint: ^7.0.0 eslint-config-prettier: ^8.5.0 + eslint-config-react: ^1.1.7 eslint-plugin-prettier: ^4.2.1 prettier: ^2.0.5 rimraf: ^3.0.2 From feb239e07fea5430ad01ccc46db9bd3b8477311b Mon Sep 17 00:00:00 2001 From: Peyton-McKee Date: Sat, 25 May 2024 22:21:18 -0400 Subject: [PATCH 3/4] Fix Lint --- package.json | 2 +- yarn.lock | 311 +++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 290 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index a6f7b30145..ca01c50def 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "concurrently": "^5.2.0", "eslint": "^7.0.0", "eslint-config-prettier": "^8.5.0", - "eslint-config-react": "^1.1.7", + "eslint-config-react-app": "^7.0.1", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.0.5", "rimraf": "^3.0.2", diff --git a/yarn.lock b/yarn.lock index f89ac3f99e..b55ae05c81 100644 --- a/yarn.lock +++ b/yarn.lock @@ -104,6 +104,20 @@ __metadata: languageName: node linkType: hard +"@babel/eslint-parser@npm:^7.16.3": + version: 7.24.6 + resolution: "@babel/eslint-parser@npm:7.24.6" + dependencies: + "@nicolo-ribaudo/eslint-scope-5-internals": 5.1.1-v1 + eslint-visitor-keys: ^2.1.0 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.11.0 + eslint: ^7.5.0 || ^8.0.0 || ^9.0.0 + checksum: 90fa58eef884c0a480fc51c0ed8e56f04c5b4dc7656066d1f994b4bea1a546173d82551fc98996bb2b203bfb32fa4e8c4b7b5d8a03b0bec51665d1382813dfbe + languageName: node + linkType: hard + "@babel/generator@npm:^7.12.1, @babel/generator@npm:^7.24.6": version: 7.24.6 resolution: "@babel/generator@npm:7.24.6" @@ -2048,6 +2062,24 @@ __metadata: languageName: node linkType: hard +"@eslint-community/eslint-utils@npm:^4.2.0": + version: 4.4.0 + resolution: "@eslint-community/eslint-utils@npm:4.4.0" + dependencies: + eslint-visitor-keys: ^3.3.0 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + checksum: cdfe3ae42b4f572cbfb46d20edafe6f36fc5fb52bf2d90875c58aefe226892b9677fef60820e2832caf864a326fe4fc225714c46e8389ccca04d5f9288aabd22 + languageName: node + linkType: hard + +"@eslint-community/regexpp@npm:^4.4.0": + version: 4.10.0 + resolution: "@eslint-community/regexpp@npm:4.10.0" + checksum: 2a6e345429ea8382aaaf3a61f865cae16ed44d31ca917910033c02dc00d505d939f10b81e079fa14d43b51499c640138e153b7e40743c4c094d9df97d4e56f7b + languageName: node + linkType: hard + "@eslint/eslintrc@npm:^0.4.3": version: 0.4.3 resolution: "@eslint/eslintrc@npm:0.4.3" @@ -2840,6 +2872,15 @@ __metadata: languageName: node linkType: hard +"@nicolo-ribaudo/eslint-scope-5-internals@npm:5.1.1-v1": + version: 5.1.1-v1 + resolution: "@nicolo-ribaudo/eslint-scope-5-internals@npm:5.1.1-v1" + dependencies: + eslint-scope: 5.1.1 + checksum: f2e3b2d6a6e2d9f163ca22105910c9f850dc4897af0aea3ef0a5886b63d8e1ba6505b71c99cb78a3bba24a09557d601eb21c8dede3f3213753fcfef364eb0e57 + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -3082,6 +3123,13 @@ __metadata: languageName: node linkType: hard +"@rushstack/eslint-patch@npm:^1.1.0": + version: 1.10.3 + resolution: "@rushstack/eslint-patch@npm:1.10.3" + checksum: 1042779367ee102576a3c132f052d718d7111fee9f815758a72b21e8145620f7d3403c14fcde3b4cfa1cbc14b08b8519151ff77d0f353bf647f0a0a16eafdef5 + languageName: node + linkType: hard + "@sinclair/typebox@npm:^0.24.1": version: 0.24.51 resolution: "@sinclair/typebox@npm:0.24.51" @@ -3744,7 +3792,7 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.3, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.7, @types/json-schema@npm:^7.0.8": +"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.3, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.7, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.15 resolution: "@types/json-schema@npm:7.0.15" checksum: 97ed0cb44d4070aecea772b7b2e2ed971e10c81ec87dd4ecc160322ffa55ff330dace1793489540e3e318d90942064bb697cc0f8989391797792d919737b3b98 @@ -3977,6 +4025,13 @@ __metadata: languageName: node linkType: hard +"@types/semver@npm:^7.3.12": + version: 7.5.8 + resolution: "@types/semver@npm:7.5.8" + checksum: ea6f5276f5b84c55921785a3a27a3cd37afee0111dfe2bcb3e03c31819c197c782598f17f0b150a69d453c9584cd14c4c4d7b9a55d2c5e6cacd4d66fdb3b3663 + languageName: node + linkType: hard + "@types/send@npm:*": version: 0.17.4 resolution: "@types/send@npm:0.17.4" @@ -4167,6 +4222,30 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/eslint-plugin@npm:^5.5.0": + version: 5.62.0 + resolution: "@typescript-eslint/eslint-plugin@npm:5.62.0" + dependencies: + "@eslint-community/regexpp": ^4.4.0 + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/type-utils": 5.62.0 + "@typescript-eslint/utils": 5.62.0 + debug: ^4.3.4 + graphemer: ^1.4.0 + ignore: ^5.2.0 + natural-compare-lite: ^1.4.0 + semver: ^7.3.7 + tsutils: ^3.21.0 + peerDependencies: + "@typescript-eslint/parser": ^5.0.0 + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: fc104b389c768f9fa7d45a48c86d5c1ad522c1d0512943e782a56b1e3096b2cbcc1eea3fcc590647bf0658eef61aac35120a9c6daf979bf629ad2956deb516a1 + languageName: node + linkType: hard + "@typescript-eslint/experimental-utils@npm:4.18.0": version: 4.18.0 resolution: "@typescript-eslint/experimental-utils@npm:4.18.0" @@ -4214,6 +4293,17 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/experimental-utils@npm:^5.0.0": + version: 5.62.0 + resolution: "@typescript-eslint/experimental-utils@npm:5.62.0" + dependencies: + "@typescript-eslint/utils": 5.62.0 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: ce55d9f74eac5cb94d66d5db9ead9a5d734f4301519fb5956a57f4b405a5318a115b0316195a3c039e0111489138680411709cb769085d71e1e1db1376ea0949 + languageName: node + linkType: hard + "@typescript-eslint/parser@npm:4.18.0": version: 4.18.0 resolution: "@typescript-eslint/parser@npm:4.18.0" @@ -4248,6 +4338,23 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/parser@npm:^5.5.0": + version: 5.62.0 + resolution: "@typescript-eslint/parser@npm:5.62.0" + dependencies: + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/typescript-estree": 5.62.0 + debug: ^4.3.4 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: d168f4c7f21a7a63f47002e2d319bcbb6173597af5c60c1cf2de046b46c76b4930a093619e69faf2d30214c29ab27b54dcf1efc7046a6a6bd6f37f59a990e752 + languageName: node + linkType: hard + "@typescript-eslint/scope-manager@npm:4.18.0": version: 4.18.0 resolution: "@typescript-eslint/scope-manager@npm:4.18.0" @@ -4268,6 +4375,33 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/scope-manager@npm:5.62.0" + dependencies: + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/visitor-keys": 5.62.0 + checksum: 6062d6b797fe1ce4d275bb0d17204c827494af59b5eaf09d8a78cdd39dadddb31074dded4297aaf5d0f839016d601032857698b0e4516c86a41207de606e9573 + languageName: node + linkType: hard + +"@typescript-eslint/type-utils@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/type-utils@npm:5.62.0" + dependencies: + "@typescript-eslint/typescript-estree": 5.62.0 + "@typescript-eslint/utils": 5.62.0 + debug: ^4.3.4 + tsutils: ^3.21.0 + peerDependencies: + eslint: "*" + peerDependenciesMeta: + typescript: + optional: true + checksum: fc41eece5f315dfda14320be0da78d3a971d650ea41300be7196934b9715f3fe1120a80207551eb71d39568275dbbcf359bde540d1ca1439d8be15e9885d2739 + languageName: node + linkType: hard + "@typescript-eslint/types@npm:3.10.1": version: 3.10.1 resolution: "@typescript-eslint/types@npm:3.10.1" @@ -4289,6 +4423,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/types@npm:5.62.0" + checksum: 48c87117383d1864766486f24de34086155532b070f6264e09d0e6139449270f8a9559cfef3c56d16e3bcfb52d83d42105d61b36743626399c7c2b5e0ac3b670 + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:3.10.1": version: 3.10.1 resolution: "@typescript-eslint/typescript-estree@npm:3.10.1" @@ -4344,6 +4485,42 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/typescript-estree@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" + dependencies: + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/visitor-keys": 5.62.0 + debug: ^4.3.4 + globby: ^11.1.0 + is-glob: ^4.0.3 + semver: ^7.3.7 + tsutils: ^3.21.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 3624520abb5807ed8f57b1197e61c7b1ed770c56dfcaca66372d584ff50175225798bccb701f7ef129d62c5989070e1ee3a0aa2d84e56d9524dcf011a2bb1a52 + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:5.62.0, @typescript-eslint/utils@npm:^5.58.0": + version: 5.62.0 + resolution: "@typescript-eslint/utils@npm:5.62.0" + dependencies: + "@eslint-community/eslint-utils": ^4.2.0 + "@types/json-schema": ^7.0.9 + "@types/semver": ^7.3.12 + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/typescript-estree": 5.62.0 + eslint-scope: ^5.1.1 + semver: ^7.3.7 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: ee9398c8c5db6d1da09463ca7bf36ed134361e20131ea354b2da16a5fdb6df9ba70c62a388d19f6eebb421af1786dbbd79ba95ddd6ab287324fc171c3e28d931 + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:3.10.1": version: 3.10.1 resolution: "@typescript-eslint/visitor-keys@npm:3.10.1" @@ -4373,6 +4550,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" + dependencies: + "@typescript-eslint/types": 5.62.0 + eslint-visitor-keys: ^3.3.0 + checksum: 976b05d103fe8335bef5c93ad3f76d781e3ce50329c0243ee0f00c0fcfb186c81df50e64bfdd34970148113f8ade90887f53e3c4938183afba830b4ba8e30a35 + languageName: node + linkType: hard + "@vitejs/plugin-react@npm:^4.0.0": version: 4.3.0 resolution: "@vitejs/plugin-react@npm:4.3.0" @@ -5586,7 +5773,7 @@ __metadata: languageName: node linkType: hard -"babel-preset-react-app@npm:^10.0.0": +"babel-preset-react-app@npm:^10.0.0, babel-preset-react-app@npm:^10.0.1": version: 10.0.1 resolution: "babel-preset-react-app@npm:10.0.1" dependencies: @@ -6928,7 +7115,7 @@ __metadata: languageName: node linkType: hard -"confusing-browser-globals@npm:^1.0.10": +"confusing-browser-globals@npm:^1.0.10, confusing-browser-globals@npm:^1.0.11": version: 1.0.11 resolution: "confusing-browser-globals@npm:1.0.11" checksum: 3afc635abd37e566477f610e7978b15753f0e84025c25d49236f1f14d480117185516bdd40d2a2167e6bed8048641a9854964b9c067e3dcdfa6b5d0ad3c3a5ef @@ -8988,10 +9175,27 @@ __metadata: languageName: node linkType: hard -"eslint-config-react@npm:^1.1.7": - version: 1.1.7 - resolution: "eslint-config-react@npm:1.1.7" - checksum: 15d3d7f78e720c225ac983fb6985825b561941f1c930116c96f8ab8600eb65db603f5ef200a10fabd51f8ef564c107e8eb0d3f69609bfdedfb50290227249a70 +"eslint-config-react-app@npm:^7.0.1": + version: 7.0.1 + resolution: "eslint-config-react-app@npm:7.0.1" + dependencies: + "@babel/core": ^7.16.0 + "@babel/eslint-parser": ^7.16.3 + "@rushstack/eslint-patch": ^1.1.0 + "@typescript-eslint/eslint-plugin": ^5.5.0 + "@typescript-eslint/parser": ^5.5.0 + babel-preset-react-app: ^10.0.1 + confusing-browser-globals: ^1.0.11 + eslint-plugin-flowtype: ^8.0.3 + eslint-plugin-import: ^2.25.3 + eslint-plugin-jest: ^25.3.0 + eslint-plugin-jsx-a11y: ^6.5.1 + eslint-plugin-react: ^7.27.1 + eslint-plugin-react-hooks: ^4.3.0 + eslint-plugin-testing-library: ^5.0.1 + peerDependencies: + eslint: ^8.0.0 + checksum: a67e0821809e62308d6e419753fa2acfc7cd353659fab08cf34735f59c6c66910c0b6fda0471c4ec0d712ce762d65efc6431b39569f8d575e2d9bdfc384e0824 languageName: node linkType: hard @@ -9030,7 +9234,21 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-import@npm:^2.22.1": +"eslint-plugin-flowtype@npm:^8.0.3": + version: 8.0.3 + resolution: "eslint-plugin-flowtype@npm:8.0.3" + dependencies: + lodash: ^4.17.21 + string-natural-compare: ^3.0.1 + peerDependencies: + "@babel/plugin-syntax-flow": ^7.14.5 + "@babel/plugin-transform-react-jsx": ^7.14.9 + eslint: ^8.1.0 + checksum: 30e63c5357b0b5571f39afed51e59c140084f4aa53c106b1fd04f26da42b268908466daa6020b92943e71409bdaee1c67202515ed9012404d027cc92cb03cefa + languageName: node + linkType: hard + +"eslint-plugin-import@npm:^2.22.1, eslint-plugin-import@npm:^2.25.3": version: 2.29.1 resolution: "eslint-plugin-import@npm:2.29.1" dependencies: @@ -9072,7 +9290,24 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-jsx-a11y@npm:^6.3.1": +"eslint-plugin-jest@npm:^25.3.0": + version: 25.7.0 + resolution: "eslint-plugin-jest@npm:25.7.0" + dependencies: + "@typescript-eslint/experimental-utils": ^5.0.0 + peerDependencies: + "@typescript-eslint/eslint-plugin": ^4.0.0 || ^5.0.0 + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + "@typescript-eslint/eslint-plugin": + optional: true + jest: + optional: true + checksum: fc6da96131f4cbf33d15ef911ec8e600ccd71deb97d73c0ca340427cef7b01ff41a797e2e7d1e351abf97321a46ed0c0acff5ee8eeedac94961dd6dad1f718a9 + languageName: node + linkType: hard + +"eslint-plugin-jsx-a11y@npm:^6.3.1, eslint-plugin-jsx-a11y@npm:^6.5.1": version: 6.8.0 resolution: "eslint-plugin-jsx-a11y@npm:6.8.0" dependencies: @@ -9113,7 +9348,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-react-hooks@npm:^4.2.0": +"eslint-plugin-react-hooks@npm:^4.2.0, eslint-plugin-react-hooks@npm:^4.3.0": version: 4.6.2 resolution: "eslint-plugin-react-hooks@npm:4.6.2" peerDependencies: @@ -9122,7 +9357,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-react@npm:^7.21.5": +"eslint-plugin-react@npm:^7.21.5, eslint-plugin-react@npm:^7.27.1": version: 7.34.1 resolution: "eslint-plugin-react@npm:7.34.1" dependencies: @@ -9161,17 +9396,18 @@ __metadata: languageName: node linkType: hard -"eslint-scope@npm:^4.0.3": - version: 4.0.3 - resolution: "eslint-scope@npm:4.0.3" +"eslint-plugin-testing-library@npm:^5.0.1": + version: 5.11.1 + resolution: "eslint-plugin-testing-library@npm:5.11.1" dependencies: - esrecurse: ^4.1.0 - estraverse: ^4.1.1 - checksum: c5f835f681884469991fe58d76a554688d9c9e50811299ccd4a8f79993a039f5bcb0ee6e8de2b0017d97c794b5832ef3b21c9aac66228e3aa0f7a0485bcfb65b + "@typescript-eslint/utils": ^5.58.0 + peerDependencies: + eslint: ^7.5.0 || ^8.0.0 + checksum: 9f3fc68ef9f13016a4381b33ab5dbffcc189e5de3eaeba184bcf7d2771faa7f54e59c04b652162fb1c0f83fb52428dd909db5450a25508b94be59eba69fcc990 languageName: node linkType: hard -"eslint-scope@npm:^5.0.0, eslint-scope@npm:^5.1.1": +"eslint-scope@npm:5.1.1, eslint-scope@npm:^5.0.0, eslint-scope@npm:^5.1.1": version: 5.1.1 resolution: "eslint-scope@npm:5.1.1" dependencies: @@ -9181,6 +9417,16 @@ __metadata: languageName: node linkType: hard +"eslint-scope@npm:^4.0.3": + version: 4.0.3 + resolution: "eslint-scope@npm:4.0.3" + dependencies: + esrecurse: ^4.1.0 + estraverse: ^4.1.1 + checksum: c5f835f681884469991fe58d76a554688d9c9e50811299ccd4a8f79993a039f5bcb0ee6e8de2b0017d97c794b5832ef3b21c9aac66228e3aa0f7a0485bcfb65b + languageName: node + linkType: hard + "eslint-utils@npm:^2.0.0, eslint-utils@npm:^2.1.0": version: 2.1.0 resolution: "eslint-utils@npm:2.1.0" @@ -9208,13 +9454,20 @@ __metadata: languageName: node linkType: hard -"eslint-visitor-keys@npm:^2.0.0": +"eslint-visitor-keys@npm:^2.0.0, eslint-visitor-keys@npm:^2.1.0": version: 2.1.0 resolution: "eslint-visitor-keys@npm:2.1.0" checksum: e3081d7dd2611a35f0388bbdc2f5da60b3a3c5b8b6e928daffff7391146b434d691577aa95064c8b7faad0b8a680266bcda0a42439c18c717b80e6718d7e267d languageName: node linkType: hard +"eslint-visitor-keys@npm:^3.3.0": + version: 3.4.3 + resolution: "eslint-visitor-keys@npm:3.4.3" + checksum: 36e9ef87fca698b6fd7ca5ca35d7b2b6eeaaf106572e2f7fd31c12d3bfdaccdb587bba6d3621067e5aece31c8c3a348b93922ab8f7b2cbc6aaab5e1d89040c60 + languageName: node + linkType: hard + "eslint-webpack-plugin@npm:^2.5.2": version: 2.7.0 resolution: "eslint-webpack-plugin@npm:2.7.0" @@ -9917,7 +10170,7 @@ __metadata: concurrently: ^5.2.0 eslint: ^7.0.0 eslint-config-prettier: ^8.5.0 - eslint-config-react: ^1.1.7 + eslint-config-react-app: ^7.0.1 eslint-plugin-prettier: ^4.2.1 prettier: ^2.0.5 rimraf: ^3.0.2 @@ -10506,7 +10759,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.0.1, globby@npm:^11.0.3": +"globby@npm:^11.0.1, globby@npm:^11.0.3, globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" dependencies: @@ -10601,6 +10854,13 @@ __metadata: languageName: node linkType: hard +"graphemer@npm:^1.4.0": + version: 1.4.0 + resolution: "graphemer@npm:1.4.0" + checksum: bab8f0be9b568857c7bec9fda95a89f87b783546d02951c40c33f84d05bb7da3fd10f863a9beb901463669b6583173a8c8cc6d6b306ea2b9b9d5d3d943c3a673 + languageName: node + linkType: hard + "graphql@npm:^16.3.0": version: 16.8.1 resolution: "graphql@npm:16.8.1" @@ -14270,6 +14530,13 @@ __metadata: languageName: node linkType: hard +"natural-compare-lite@npm:^1.4.0": + version: 1.4.0 + resolution: "natural-compare-lite@npm:1.4.0" + checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225 + languageName: node + linkType: hard + "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -17994,7 +18261,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.x, semver@npm:^7.2.1, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.8, semver@npm:^7.5.3": +"semver@npm:7.x, semver@npm:^7.2.1, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3": version: 7.6.2 resolution: "semver@npm:7.6.2" bin: From 2d50956c51f70a32de21617289d2e7ef60b2dd86 Mon Sep 17 00:00:00 2001 From: Peyton-McKee Date: Sat, 25 May 2024 22:39:43 -0400 Subject: [PATCH 4/4] Apparently we have not been linting at all in the frontend??? --- .../change-requests.transformers.ts | 2 +- src/frontend/src/app/AppAuthenticated.tsx | 3 +- src/frontend/src/components/DetailDisplay.tsx | 2 +- src/frontend/src/components/TimeSlot.tsx | 2 +- .../BOMConfig/ManufacturerTable.tsx | 2 +- .../src/pages/CalendarPage/CalendarPage.tsx | 3 +- .../DesignReviewDetailPage.tsx | 2 +- .../DesignReviewSummaryModalAttendees.tsx | 4 +- .../DiffSection/DiffPanel.tsx | 49 +++-- .../DiffSection/DiffSectionCreate.tsx | 4 +- .../DiffSection/DiffSectionEdit.tsx | 4 +- .../ChangeRequestsTable.tsx | 3 +- .../EditReimbursementRequest.tsx | 2 +- .../FinanceComponents/ColumnHeader.tsx | 33 ++- .../PendingAdvisorListModal.tsx | 2 +- .../ReimbursementFormView.tsx | 2 +- .../ReimbursementProductTable.tsx | 4 +- .../ReimbursementRequestForm.tsx | 2 +- .../HomePage/OverdueWorkPackageAlerts.tsx | 71 +++---- src/frontend/src/pages/LoginPage/Login.tsx | 4 +- .../ProjectForm/ProjectCreateContainer.tsx | 6 +- .../ProjectForm/ProjectEditContainer.tsx | 4 +- .../BOM/BOMTableWrapper.tsx | 3 +- .../BOM/MaterialForm/MaterialForm.tsx | 2 +- .../ProjectViewContainer/ChangeRequestTab.tsx | 2 +- .../TaskList/TaskListDataGrid.tsx | 199 +++++++++--------- .../src/pages/ProjectsPage/ProjectsTable.tsx | 7 +- .../ActivateWorkPackageModal.tsx | 2 +- .../WorkPackageForm/WorkPackageFormView.tsx | 2 +- .../src/tests/app/AppAuthenticated.test.tsx | 6 +- .../ChangeRequestDetails.test.tsx | 10 +- .../ChangeRequestDetailsView.test.tsx | 10 +- .../DeleteChangeRequestView.test.tsx | 6 +- .../src/tests/pages/ErrorPage.test.tsx | 8 +- .../ProjectViewContainer.test.tsx | 21 +- .../ActivateWorkPackageModal.test.tsx | 2 +- .../StageGateWorkPackageModal.test.tsx | 2 +- .../WorkPackagePage.test.tsx | 11 +- .../WorkPackageDetails.test.tsx | 1 + .../WorkPackageViewContainer.test.tsx | 38 ++-- src/frontend/src/utils/diff-page.utils.ts | 33 ++- src/frontend/src/utils/form.ts | 10 +- 42 files changed, 279 insertions(+), 306 deletions(-) diff --git a/src/frontend/src/apis/transformers/change-requests.transformers.ts b/src/frontend/src/apis/transformers/change-requests.transformers.ts index 6ac2aa6633..3e7d8e20d9 100644 --- a/src/frontend/src/apis/transformers/change-requests.transformers.ts +++ b/src/frontend/src/apis/transformers/change-requests.transformers.ts @@ -29,7 +29,7 @@ export const changeRequestTransformer = (changeRequest: ChangeRequest | Standard } const output: ChangeRequest = data; - const workPackageProposedChanges = (changeRequest as StandardChangeRequest).workPackageProposedChanges; + const { workPackageProposedChanges } = changeRequest as StandardChangeRequest; if (workPackageProposedChanges && workPackageProposedChanges.startDate) { const scopeOutput = { ...data, diff --git a/src/frontend/src/app/AppAuthenticated.tsx b/src/frontend/src/app/AppAuthenticated.tsx index b3829b9928..7feccee090 100644 --- a/src/frontend/src/app/AppAuthenticated.tsx +++ b/src/frontend/src/app/AppAuthenticated.tsx @@ -44,9 +44,8 @@ const AppAuthenticated: React.FC = ({ userId, userRole }) if (isError) { if ((error as Error).message === 'Authentication Failed: Invalid JWT!') { return ; - } else { - return ; } + return ; } return userSettingsData.slackId || isGuest(userRole) ? ( diff --git a/src/frontend/src/components/DetailDisplay.tsx b/src/frontend/src/components/DetailDisplay.tsx index 4f0629411f..160eb870cb 100644 --- a/src/frontend/src/components/DetailDisplay.tsx +++ b/src/frontend/src/components/DetailDisplay.tsx @@ -18,7 +18,7 @@ const DetailDisplay: React.FC = ({ label, content, paddingRi return (
- + {label} {': '} diff --git a/src/frontend/src/components/TimeSlot.tsx b/src/frontend/src/components/TimeSlot.tsx index 3e228fd9e3..f998e69bb0 100644 --- a/src/frontend/src/components/TimeSlot.tsx +++ b/src/frontend/src/components/TimeSlot.tsx @@ -33,7 +33,7 @@ const TimeSlot: React.FC = ({ sx={{ height: small ? '25px' : '4.7vh', width: small ? '81px' : '12.2%', - backgroundColor: backgroundColor, + backgroundColor, cursor: onMouseEnter ? 'pointer' : undefined, borderStyle: 'solid', borderColor: selected ? '#ffff8c' : 'gray', diff --git a/src/frontend/src/pages/AdminToolsPage/BOMConfig/ManufacturerTable.tsx b/src/frontend/src/pages/AdminToolsPage/BOMConfig/ManufacturerTable.tsx index b11ff02088..3314e540f6 100644 --- a/src/frontend/src/pages/AdminToolsPage/BOMConfig/ManufacturerTable.tsx +++ b/src/frontend/src/pages/AdminToolsPage/BOMConfig/ManufacturerTable.tsx @@ -36,7 +36,7 @@ const ManufacturerTable: React.FC = () => { const handleDeleteManufacturer = async (manufacturerName: string) => { try { - await mutateAsync({ manufacturerName: manufacturerName }); + await mutateAsync({ manufacturerName }); toast.success(`Manufacturer: ${manufacturerName} Deleted Successfully!`); } catch (error: unknown) { if (error instanceof Error) { diff --git a/src/frontend/src/pages/CalendarPage/CalendarPage.tsx b/src/frontend/src/pages/CalendarPage/CalendarPage.tsx index 8a8feab541..1abd1b0d86 100644 --- a/src/frontend/src/pages/CalendarPage/CalendarPage.tsx +++ b/src/frontend/src/pages/CalendarPage/CalendarPage.tsx @@ -44,9 +44,8 @@ const CalendarPage = () => { confirmedDesignReviews.sort((designReview1, designReview2) => { if (designReview1.dateScheduled.getTime() === designReview2.dateScheduled.getTime()) { return designReview1.meetingTimes[0] - designReview2.meetingTimes[0]; - } else { - return designReview1.dateScheduled.getTime() - designReview2.dateScheduled.getTime(); } + return designReview1.dateScheduled.getTime() - designReview2.dateScheduled.getTime(); }); confirmedDesignReviews.forEach((designReview) => { diff --git a/src/frontend/src/pages/CalendarPage/DesignReviewDetailPage/DesignReviewDetailPage.tsx b/src/frontend/src/pages/CalendarPage/DesignReviewDetailPage/DesignReviewDetailPage.tsx index f89aa7b809..2dfdca509c 100644 --- a/src/frontend/src/pages/CalendarPage/DesignReviewDetailPage/DesignReviewDetailPage.tsx +++ b/src/frontend/src/pages/CalendarPage/DesignReviewDetailPage/DesignReviewDetailPage.tsx @@ -47,7 +47,7 @@ const DesignReviewDetailPage: React.FC = ({ designR const [requiredUsers, setRequiredUsers] = useState(designReview.requiredMembers.map(userToAutocompleteOption)); const [optionalUsers, setOptionalUsers] = useState(designReview.optionalMembers.map(userToAutocompleteOption)); const [date, setDate] = useState( - new Date(designReview.dateScheduled?.getTime() - designReview.dateScheduled?.getTimezoneOffset() * -60000) + new Date(designReview.dateScheduled.getTime() - designReview.dateScheduled.getTimezoneOffset() * -60000) ); const [showDeleteModal, setShowDeleteModal] = useState(false); const [startTime, setStateTime] = useState(designReview.meetingTimes[0] % 12); diff --git a/src/frontend/src/pages/CalendarPage/SummaryComponents/DesignReviewSummaryModalAttendees.tsx b/src/frontend/src/pages/CalendarPage/SummaryComponents/DesignReviewSummaryModalAttendees.tsx index c5ba35bed1..3a684d30d9 100644 --- a/src/frontend/src/pages/CalendarPage/SummaryComponents/DesignReviewSummaryModalAttendees.tsx +++ b/src/frontend/src/pages/CalendarPage/SummaryComponents/DesignReviewSummaryModalAttendees.tsx @@ -18,8 +18,8 @@ interface DesignReviewEditAttendeesProps { const DesignReviewSummaryModalAttendees: React.FC = ({ designReview }) => { const toast = useToast(); - const requiredMembers = designReview.requiredMembers; - const optionalMembers = designReview.optionalMembers; + const { requiredMembers } = designReview; + const { optionalMembers } = designReview; const currentUser = useCurrentUser(); const { isLoading: editDesignReviewIsLoading, mutateAsync: editDesignReview } = useEditDesignReview( diff --git a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffPanel.tsx b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffPanel.tsx index 794b7427c4..8a430ed0ff 100644 --- a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffPanel.tsx +++ b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffPanel.tsx @@ -23,7 +23,7 @@ const DiffPanel: React.FC = ({ const theme = useTheme(); const changeBullets: ChangeBullet[] = []; - for (var projectKey in projectProposedChanges) { + for (const projectKey in projectProposedChanges) { if (projectProposedChanges.hasOwnProperty(projectKey)) { changeBullets.push({ label: projectKey, @@ -32,7 +32,7 @@ const DiffPanel: React.FC = ({ } } - for (var workPackageKey in workPackageProposedChanges) { + for (let workPackageKey in workPackageProposedChanges) { if (workPackageProposedChanges.hasOwnProperty(workPackageKey)) { if (workPackageKey === 'duration') { workPackageKey = 'endDate'; @@ -42,7 +42,7 @@ const DiffPanel: React.FC = ({ new Date(workPackageProposedChanges!.startDate).getTimezoneOffset() * -6000 ); - const duration = workPackageProposedChanges.duration; + const { duration } = workPackageProposedChanges; const endDate = calculateEndDate(startDate, duration); changeBullets.push({ label: 'endDate', @@ -64,29 +64,28 @@ const DiffPanel: React.FC = ({ {detailText} ); - } else { - return ( - - {detailText.map((bullet) => { - const url = bullet.includes('http') ? bullet.split(': ')[1] : undefined; - return ( - - {url ? ( - <> - {bullet.split(': ')[0]}:{' '} - - {bullet.split(': ')[1]} - - - ) : ( - bullet - )} - - ); - })} - - ); } + return ( + + {detailText.map((bullet) => { + const url = bullet.includes('http') ? bullet.split(': ')[1] : undefined; + return ( + + {url ? ( + <> + {bullet.split(': ')[0]}:{' '} + + {bullet.split(': ')[1]} + + + ) : ( + bullet + )} + + ); + })} + + ); }; return ( diff --git a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionCreate.tsx b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionCreate.tsx index 560ddb93e1..b798805e8f 100644 --- a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionCreate.tsx +++ b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionCreate.tsx @@ -18,13 +18,13 @@ const DiffSectionCreate: React.FC = ({ projectProposedCh delete workPackageProposedChanges?.manager; if (isCreateProject) { - for (var projectKey in projectProposedChanges) { + for (const projectKey in projectProposedChanges) { if (projectProposedChanges.hasOwnProperty(projectKey)) { potentialChangeTypeMap.set(projectKey, PotentialChangeType.ADDED); } } } else { - for (var workPackageKey in workPackageProposedChanges) { + for (const workPackageKey in workPackageProposedChanges) { if (workPackageProposedChanges.hasOwnProperty(workPackageKey)) { potentialChangeTypeMap.set(workPackageKey, PotentialChangeType.ADDED); } diff --git a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionEdit.tsx b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionEdit.tsx index b6bd895eba..b9865ae24c 100644 --- a/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionEdit.tsx +++ b/src/frontend/src/pages/ChangeRequestDetailPage/DiffSection/DiffSectionEdit.tsx @@ -63,7 +63,7 @@ const DiffSectionEdit: React.FC = ({ const workPackageAsChanges = originalWorkPackageData ?? workPackageToProposedChangesPreview(workPackage); if (isOnProject) { - for (var projectKey in projectProposedChanges) { + for (const projectKey in projectProposedChanges) { if (projectProposedChanges.hasOwnProperty(projectKey)) { const originalValue = projectAsChanges![projectKey as keyof ProjectProposedChangesPreview]!; const proposedValue = projectProposedChanges[projectKey as keyof ProjectProposedChangesPreview]!; @@ -78,7 +78,7 @@ const DiffSectionEdit: React.FC = ({ } } } else { - for (var workPackageKey in workPackageProposedChanges) { + for (let workPackageKey in workPackageProposedChanges) { if (workPackageProposedChanges.hasOwnProperty(workPackageKey)) { let originalValue = workPackageAsChanges![workPackageKey as keyof WorkPackageProposedChangesPreview]!; let proposedValue = workPackageProposedChanges[workPackageKey as keyof WorkPackageProposedChangesPreview]!; diff --git a/src/frontend/src/pages/ChangeRequestsPage/ChangeRequestsTable.tsx b/src/frontend/src/pages/ChangeRequestsPage/ChangeRequestsTable.tsx index b5a755895b..220c0e4f1b 100644 --- a/src/frontend/src/pages/ChangeRequestsPage/ChangeRequestsTable.tsx +++ b/src/frontend/src/pages/ChangeRequestsPage/ChangeRequestsTable.tsx @@ -87,9 +87,8 @@ const ChangeRequestsTable: React.FC = () => { return wbs1.projectNumber - wbs2.projectNumber; } else if (wbs1.workPackageNumber !== wbs2.workPackageNumber) { return wbs1.workPackageNumber - wbs2.workPackageNumber; - } else { - return 0; } + return 0; } }; diff --git a/src/frontend/src/pages/FinancePage/EditReimbursementRequest/EditReimbursementRequest.tsx b/src/frontend/src/pages/FinancePage/EditReimbursementRequest/EditReimbursementRequest.tsx index eafa67c7af..5da325a80f 100644 --- a/src/frontend/src/pages/FinancePage/EditReimbursementRequest/EditReimbursementRequest.tsx +++ b/src/frontend/src/pages/FinancePage/EditReimbursementRequest/EditReimbursementRequest.tsx @@ -14,7 +14,7 @@ import ErrorPage from '../../ErrorPage'; import EditReimbursementRequestRenderedDefaultValues from './EditReimbursementRequestRenderedDefaultValues'; const EditReimbursementRequestPage: React.FC = () => { - const id = useParams<{ id: string }>().id; + const { id } = useParams<{ id: string }>(); const { isLoading: editReimbursementRequestIsLoading, mutateAsync: editReimbursementRequest } = useEditReimbursementRequest(id); diff --git a/src/frontend/src/pages/FinancePage/FinanceComponents/ColumnHeader.tsx b/src/frontend/src/pages/FinancePage/FinanceComponents/ColumnHeader.tsx index 35f6d5c769..f60e0744c7 100644 --- a/src/frontend/src/pages/FinancePage/FinanceComponents/ColumnHeader.tsx +++ b/src/frontend/src/pages/FinancePage/FinanceComponents/ColumnHeader.tsx @@ -33,24 +33,23 @@ const ColumnHeader = ({ {title} ); - } else { - return ( - - handleRequestSort(id)} - > - {title} - - - ); } + return ( + + handleRequestSort(id)} + > + {title} + + + ); }; export default ColumnHeader; diff --git a/src/frontend/src/pages/FinancePage/FinanceComponents/PendingAdvisorListModal.tsx b/src/frontend/src/pages/FinancePage/FinanceComponents/PendingAdvisorListModal.tsx index 37dbc1b4b7..b734bc3c15 100644 --- a/src/frontend/src/pages/FinancePage/FinanceComponents/PendingAdvisorListModal.tsx +++ b/src/frontend/src/pages/FinancePage/FinanceComponents/PendingAdvisorListModal.tsx @@ -68,7 +68,7 @@ const PendingAdvisorModal: React.FC = ({ open, saboNum } = useForm({ resolver: yupResolver(schema), defaultValues: { - saboNumbers: saboNumbers + saboNumbers } }); diff --git a/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementFormView.tsx b/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementFormView.tsx index 7bd04ab42d..d4033d3656 100644 --- a/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementFormView.tsx +++ b/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementFormView.tsx @@ -310,7 +310,7 @@ const ReimbursementRequestFormView: React.FC [...e.target.files].forEach((file) => { if (file.size < 1000000) { receiptPrepend({ - file: file, + file, name: file.name, googleFileId: '' }); diff --git a/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx b/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx index 8aaa06b6da..623a2dcd9f 100644 --- a/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx +++ b/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx @@ -74,9 +74,9 @@ const ReimbursementProductTable: React.FC = ({ const productReason = hasWbsNum ? wbsPipe(product.reason as WbsNumber) : (product.reason as string); if (uniqueWbsElementsWithProducts.has(productReason)) { const products = uniqueWbsElementsWithProducts.get(productReason); - products?.push({ ...product, index: index }); + products?.push({ ...product, index }); } else { - uniqueWbsElementsWithProducts.set(productReason, [{ ...product, index: index }]); + uniqueWbsElementsWithProducts.set(productReason, [{ ...product, index }]); } }); diff --git a/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementRequestForm.tsx b/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementRequestForm.tsx index fafaf59511..750d181949 100644 --- a/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementRequestForm.tsx +++ b/src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementRequestForm.tsx @@ -147,7 +147,7 @@ const ReimbursementRequestForm: React.FC = ({ const { data: userSecureSettings, isLoading: checkSecureSettingsIsLoading } = useCurrentUserSecureSettings(); // checks to make sure none of the secure settings fields are empty, indicating not properly set - const hasSecureSettingsSet = Object.values(userSecureSettings ?? {}).every((x) => x !== '') ? true : false; + const hasSecureSettingsSet = Object.values(userSecureSettings ?? {}).every((x) => x !== ''); const toast = useToast(); const history = useHistory(); diff --git a/src/frontend/src/pages/HomePage/OverdueWorkPackageAlerts.tsx b/src/frontend/src/pages/HomePage/OverdueWorkPackageAlerts.tsx index 979cc0ba70..09097088aa 100644 --- a/src/frontend/src/pages/HomePage/OverdueWorkPackageAlerts.tsx +++ b/src/frontend/src/pages/HomePage/OverdueWorkPackageAlerts.tsx @@ -23,44 +23,41 @@ const OverdueWorkPackageAlerts: React.FC = () => { // If there are no overdue work packages, don't display anything if (!userOverdueWorkPackages || userOverdueWorkPackages.length === 0) { return null; - } else { - return ( - - - - - {userOverdueWorkPackages.length > 1 ? 'Overdue Work Packages:' : 'Overdue Work Package:'} - - - {userOverdueWorkPackages.map((wp) => ( - - {wbsPipe(wp.wbsNum)} - {wp.name} - - {'Due: ' + datePipe(wp.endDate)} - - history.push(`${routes.PROJECTS}/${wbsPipe(wp.wbsNum)}`)} - > - Create Change Request - - - ))} - - - - - ); } + return ( + + + + {userOverdueWorkPackages.length > 1 ? 'Overdue Work Packages:' : 'Overdue Work Package:'} + + {userOverdueWorkPackages.map((wp) => ( + + {wbsPipe(wp.wbsNum)} - {wp.name} + + {'Due: ' + datePipe(wp.endDate)} + + history.push(`${routes.PROJECTS}/${wbsPipe(wp.wbsNum)}`)} + > + Create Change Request + + + ))} + + + + + ); }; export default OverdueWorkPackageAlerts; diff --git a/src/frontend/src/pages/LoginPage/Login.tsx b/src/frontend/src/pages/LoginPage/Login.tsx index 4b6e27324f..f81b2944e2 100644 --- a/src/frontend/src/pages/LoginPage/Login.tsx +++ b/src/frontend/src/pages/LoginPage/Login.tsx @@ -62,7 +62,7 @@ const Login = () => { theme.toggleTheme(); } if (authedUser.organizations.length > 0) { - const defaultOrganization = authedUser.organizations[0]; + const [defaultOrganization] = authedUser.organizations; organizationContext.selectOrganization(defaultOrganization); } redirectAfterLogin(); @@ -79,7 +79,7 @@ const Login = () => { theme.toggleTheme(); } if (authedUser.organizations.length > 0) { - const defaultOrganization = authedUser.organizations[0]; + const [defaultOrganization] = authedUser.organizations; organizationContext.selectOrganization(defaultOrganization); } redirectAfterLogin(); diff --git a/src/frontend/src/pages/ProjectDetailPage/ProjectForm/ProjectCreateContainer.tsx b/src/frontend/src/pages/ProjectDetailPage/ProjectForm/ProjectCreateContainer.tsx index 22fca70518..41ec69082a 100644 --- a/src/frontend/src/pages/ProjectDetailPage/ProjectForm/ProjectCreateContainer.tsx +++ b/src/frontend/src/pages/ProjectDetailPage/ProjectForm/ProjectCreateContainer.tsx @@ -89,16 +89,16 @@ const ProjectCreateContainer: React.FC = () => { links, leadId: leadId ? parseInt(leadId) : undefined, managerId: managerId ? parseInt(managerId) : undefined, - carNumber: carNumber + carNumber }; const changeRequestPayload: CreateStandardChangeRequestPayload = { wbsNum: { // TODO change this to use the car model when we add it to the schema - carNumber: carNumber, + carNumber, projectNumber: 0, workPackageNumber: 0 }, - type: type, + type, what, why, proposedSolutions: [], diff --git a/src/frontend/src/pages/ProjectDetailPage/ProjectForm/ProjectEditContainer.tsx b/src/frontend/src/pages/ProjectDetailPage/ProjectForm/ProjectEditContainer.tsx index 60adf71ce0..9b6e39aec2 100644 --- a/src/frontend/src/pages/ProjectDetailPage/ProjectForm/ProjectEditContainer.tsx +++ b/src/frontend/src/pages/ProjectDetailPage/ProjectForm/ProjectEditContainer.tsx @@ -118,7 +118,7 @@ const ProjectEditContainer: React.FC = ({ project, ex }; const changeRequestPayload: CreateStandardChangeRequestPayload = { wbsNum: project.wbsNum, - type: type, + type, what, why, proposedSolutions: [], @@ -135,7 +135,7 @@ const ProjectEditContainer: React.FC = ({ project, ex const onSubmit = async (data: ProjectFormInput) => { const { name, budget, summary, links, descriptionBullets } = data; - const crId = data.crId; + const { crId } = data; try { const payload: EditSingleProjectPayload = { diff --git a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTableWrapper.tsx b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTableWrapper.tsx index b367921550..1680be58b8 100644 --- a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTableWrapper.tsx +++ b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTableWrapper.tsx @@ -239,9 +239,8 @@ const BOMTableWrapper: React.FC = ({ project, hideColumn, colSpan: ({ row }) => { if (row.id.includes('assembly')) { return 2; - } else { - return 1; } + return 1; }, hide: hideColumn[4] }, diff --git a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/MaterialForm/MaterialForm.tsx b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/MaterialForm/MaterialForm.tsx index 8350291adf..f863bfd802 100644 --- a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/MaterialForm/MaterialForm.tsx +++ b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/MaterialForm/MaterialForm.tsx @@ -129,7 +129,7 @@ const MaterialForm: React.FC = ({ submitText, onSubmit, defau const onSubmitWrapper = (data: MaterialFormInput): void => { const price = Math.round(data.price * 100); const subtotal = parseFloat((data.quantity * price).toFixed(2)); - onSubmit({ ...data, subtotal: subtotal, price: price, quantity: new Decimal(data.quantity) }); + onSubmit({ ...data, subtotal, price, quantity: new Decimal(data.quantity) }); }; const createManufacturerWrapper = async (manufacturerName: string): Promise => { diff --git a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/ChangeRequestTab.tsx b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/ChangeRequestTab.tsx index 99bc70071f..9f8a4ffcb2 100644 --- a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/ChangeRequestTab.tsx +++ b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/ChangeRequestTab.tsx @@ -14,7 +14,7 @@ const ChangeRequestTab = ({ project }: { project: Project }) => { if (crIsLoading || !changeRequests) return ; if (crIsError) return ; - const wbsNum = project.wbsNum; + const { wbsNum } = project; const unReviewedChangeRequests = changeRequests .filter((cr: ChangeRequest) => !cr.dateReviewed && equalsWbsNumber(wbsNum, cr.wbsNum)) diff --git a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/TaskListDataGrid.tsx b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/TaskListDataGrid.tsx index 71a3202a01..d29e78e277 100644 --- a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/TaskListDataGrid.tsx +++ b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/TaskList/TaskListDataGrid.tsx @@ -142,113 +142,111 @@ const TaskListDataGrid: React.FC = ({ /> ); actions.push(} label="Delete" onClick={deleteCreateTask} />); + } else if (params.id === currentlyEditingId) { + actions.push( + } + label="Save" + onClick={() => { + editTask({ + taskId: params.row.taskId, + notes: params.row.notes, + title, + deadline, + assignees: assignees.map((assignee: UserPreview) => assignee.userId), + priority + }); + setDisabled(false); + setTitle(''); + setDeadline(new Date()); + setPriority(TaskPriority.High); + setAssignees([]); + }} + /> + ); + actions.push( + } + label="cancel" + onClick={() => { + setDisabled(false); + setCurrentlyEditingId(undefined); + setTitle(''); + setDeadline(new Date()); + setPriority(TaskPriority.High); + setAssignees([]); + }} + /> + ); } else { - if (params.id === currentlyEditingId) { - actions.push( - } - label="Save" - onClick={() => { - editTask({ - taskId: params.row.taskId, - notes: params.row.notes, - title: title, - deadline: deadline, - assignees: assignees.map((assignee: UserPreview) => assignee.userId), - priority: priority - }); - setDisabled(false); - setTitle(''); - setDeadline(new Date()); - setPriority(TaskPriority.High); - setAssignees([]); - }} - /> - ); - actions.push( - } - label="cancel" - onClick={() => { - setDisabled(false); - setCurrentlyEditingId(undefined); - setTitle(''); - setDeadline(new Date()); - setPriority(TaskPriority.High); - setAssignees([]); - }} - /> - ); - } else { - if (status === TaskStatus.DONE || status === TaskStatus.IN_BACKLOG) { - actions.push( - } - label="Move to In Progress" - onClick={moveToInProgress(params.row.taskId)} - showInMenu - disabled={!editTaskPermissions(params.row.task)} - /> - ); - } else if (status === TaskStatus.IN_PROGRESS) { - actions.push( - } - label="Move to Backlog" - onClick={moveToBacklog(params.row.taskId)} - showInMenu - disabled={!editTaskPermissions(params.row.task)} - /> - ); - actions.push( - } - label="Move to Done" - onClick={moveToDone(params.row.taskId)} - showInMenu - disabled={!editTaskPermissions(params.row.task)} - /> - ); - } + if (status === TaskStatus.DONE || status === TaskStatus.IN_BACKLOG) { actions.push( } - label="Edit" + icon={} + label="Move to In Progress" + onClick={moveToInProgress(params.row.taskId)} showInMenu - disabled={!editTaskPermissions(params.row.task) || addTask} - onClick={() => { - setTitle(params.row.title); - setDeadline(params.row.deadline); - setPriority(params.row.priority); - setAssignees(params.row.assignees); - setCurrentlyEditingId(params.id); - setDisabled(true); - }} + disabled={!editTaskPermissions(params.row.task)} /> ); + } else if (status === TaskStatus.IN_PROGRESS) { actions.push( } - label="Delete" - onClick={deleteRow(params.row.taskId)} + icon={} + label="Move to Backlog" + onClick={moveToBacklog(params.row.taskId)} showInMenu disabled={!editTaskPermissions(params.row.task)} /> ); actions.push( } - label="notes" - onClick={() => { - setSelectedTask(params.row.task); - setModalShow(true); - }} + icon={} + label="Move to Done" + onClick={moveToDone(params.row.taskId)} + showInMenu + disabled={!editTaskPermissions(params.row.task)} /> ); } + actions.push( + } + label="Edit" + showInMenu + disabled={!editTaskPermissions(params.row.task) || addTask} + onClick={() => { + setTitle(params.row.title); + setDeadline(params.row.deadline); + setPriority(params.row.priority); + setAssignees(params.row.assignees); + setCurrentlyEditingId(params.id); + setDisabled(true); + }} + /> + ); + actions.push( + } + label="Delete" + onClick={deleteRow(params.row.taskId)} + showInMenu + disabled={!editTaskPermissions(params.row.task)} + /> + ); + actions.push( + } + label="notes" + onClick={() => { + setSelectedTask(params.row.task); + setModalShow(true); + }} + /> + ); } return actions; }; @@ -318,17 +316,17 @@ const TaskListDataGrid: React.FC = ({ assignees: task.assignees, notes: task.notes, taskId: task.taskId, - task: task + task }; }); if (addTask && currentlyEditingId === undefined) { rows.unshift({ id: -1, - title: title, - deadline: deadline, - priority: priority, - assignees: assignees, + title, + deadline, + priority, + assignees, taskId: '-1', notes: '', task: { @@ -350,17 +348,16 @@ const TaskListDataGrid: React.FC = ({ if (row.id === currentlyEditingId) { return { id: row.id, - title: title, - deadline: deadline, - priority: priority, - assignees: assignees, + title, + deadline, + priority, + assignees, taskId: row.taskId, notes: row.notes, task: row.task }; - } else { - return row; } + return row; }); } diff --git a/src/frontend/src/pages/ProjectsPage/ProjectsTable.tsx b/src/frontend/src/pages/ProjectsPage/ProjectsTable.tsx index f31c213f22..98a51f9138 100644 --- a/src/frontend/src/pages/ProjectsPage/ProjectsTable.tsx +++ b/src/frontend/src/pages/ProjectsPage/ProjectsTable.tsx @@ -52,9 +52,8 @@ const ProjectsTable: React.FC = () => { return param1.value.projectNumber - param2.value.projectNumber; } else if (param1.value.workPackageNumber !== param2.value.workPackageNumber) { return param1.value.workPackageNumber - param2.value.workPackageNumber; - } else { - return 0; } + return 0; } }; @@ -203,7 +202,7 @@ const ProjectsTable: React.FC = () => { components={{ Toolbar: TableCustomToolbar, Row: (props: GridRowProps & { row: Project }) => { - const wbsNum = props.row.wbsNum; + const { wbsNum } = props.row; return ( { } }} onFilterModelChange={(filterModel: GridFilterModel) => { - const filterItems = filterModel.items[0]; + const [filterItems] = filterModel.items; if (filterItems) localStorage.setItem('projectsTableFilter', JSON.stringify(filterItems)); }} initialState={{ diff --git a/src/frontend/src/pages/WorkPackageDetailPage/ActivateWorkPackageModalContainer/ActivateWorkPackageModal.tsx b/src/frontend/src/pages/WorkPackageDetailPage/ActivateWorkPackageModalContainer/ActivateWorkPackageModal.tsx index 056c7e117a..23a3ec90e1 100644 --- a/src/frontend/src/pages/WorkPackageDetailPage/ActivateWorkPackageModalContainer/ActivateWorkPackageModal.tsx +++ b/src/frontend/src/pages/WorkPackageDetailPage/ActivateWorkPackageModalContainer/ActivateWorkPackageModal.tsx @@ -52,7 +52,7 @@ const ActivateWorkPackageModal: React.FC = ({ } const defaultValues: FormInput = { - startDate: startDate, + startDate, confirmDetails: false }; diff --git a/src/frontend/src/pages/WorkPackageForm/WorkPackageFormView.tsx b/src/frontend/src/pages/WorkPackageForm/WorkPackageFormView.tsx index 301f7926aa..bbbdfa108e 100644 --- a/src/frontend/src/pages/WorkPackageForm/WorkPackageFormView.tsx +++ b/src/frontend/src/pages/WorkPackageForm/WorkPackageFormView.tsx @@ -121,7 +121,7 @@ const WorkPackageFormView: React.FC = ({ startDate: transformDate(startDate), duration, blockedBy: blockedByWbsNums, - descriptionBullets: descriptionBullets, + descriptionBullets, stage: stage as WorkPackageStage, links: [] }; diff --git a/src/frontend/src/tests/app/AppAuthenticated.test.tsx b/src/frontend/src/tests/app/AppAuthenticated.test.tsx index 627f705b6a..4f75e3a004 100644 --- a/src/frontend/src/tests/app/AppAuthenticated.test.tsx +++ b/src/frontend/src/tests/app/AppAuthenticated.test.tsx @@ -46,9 +46,9 @@ describe.skip('App Authenticated', () => { it('renders nav links', () => { renderComponent(); - expect(screen.getByText('Home')).not.toBeInTheDocument(); - expect(screen.getByText('Projects')).not.toBeInTheDocument(); - expect(screen.getByText('Change Requests')).not.toBeInTheDocument(); + expect(screen.queryByText('Home')).not.toBeInTheDocument(); + expect(screen.queryByText('Projects')).not.toBeInTheDocument(); + expect(screen.queryByText('Change Requests')).not.toBeInTheDocument(); }); it('can navigate to projects page', () => { diff --git a/src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetails.test.tsx b/src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetails.test.tsx index 629c84129b..5f59dbfe8b 100644 --- a/src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetails.test.tsx +++ b/src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetails.test.tsx @@ -16,7 +16,7 @@ import { exampleGuestUser, exampleMemberUser } from '../../test-support/test-data/users.stub'; -import { render, screen, routerWrapperBuilder, act, fireEvent } from '../../test-support/test-utils'; +import { render, screen, routerWrapperBuilder, fireEvent } from '../../test-support/test-utils'; import { mockUseQueryResult, mockAuth } from '../../test-support/test-data/test-utils.stub'; import { useSingleChangeRequest } from '../../../hooks/change-requests.hooks'; import { useAuth } from '../../../hooks/auth.hooks'; @@ -97,9 +97,7 @@ describe.skip('change request details container', () => { mockAuthHook(exampleAdminUser); renderComponent(); - act(() => { - fireEvent.click(screen.getByText('Implement Change Request')); - }); + fireEvent.click(screen.getByText('Implement Change Request')); expect(screen.getByText('Create New Project')).not.toHaveAttribute('disabled'); expect(screen.getByText('Create New Work Package')).not.toHaveAttribute('disabled'); }); @@ -109,9 +107,7 @@ describe.skip('change request details container', () => { mockAuthHook(exampleGuestUser); renderComponent(); - act(() => { - fireEvent.click(screen.getByText('Implement Change Request')); - }); + fireEvent.click(screen.getByText('Implement Change Request')); expect(screen.getByText('Create New Project')).toHaveAttribute('disabled'); expect(screen.getByText('Create New Work Package')).toHaveAttribute('disabled'); }); diff --git a/src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetailsView.test.tsx b/src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetailsView.test.tsx index 76b16999f8..d3a6138366 100644 --- a/src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetailsView.test.tsx +++ b/src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetailsView.test.tsx @@ -3,7 +3,7 @@ * See the LICENSE file in the repository root folder for details. */ -import { routerWrapperBuilder, fireEvent, render, screen, act } from '../../test-support/test-utils'; +import { routerWrapperBuilder, fireEvent, render, screen } from '../../test-support/test-utils'; import { ChangeRequest, Project, User } from 'shared'; import { exampleStandardChangeRequest } from '../../test-support/test-data/change-requests.stub'; import ChangeRequestDetailsView from '../../../pages/ChangeRequestDetailPage/ChangeRequestDetailsView'; @@ -75,9 +75,7 @@ describe('Implement change request permission tests', () => { mockAllUsersHook(false, false, []); mockUseLogUserInHook(false, false); renderComponent(exampleStandardChangeRequest); - act(() => { - fireEvent.click(screen.getByText(actionBtnText)); - }); + fireEvent.click(screen.getByText(actionBtnText)); expect(screen.getByText(newPrjBtnText)).toHaveAttribute('aria-disabled'); expect(screen.getByText(newWPBtnText)).toHaveAttribute('aria-disabled'); }); @@ -87,9 +85,7 @@ describe('Implement change request permission tests', () => { mockAllUsersHook(false, false, []); mockUseLogUserInHook(false, false); renderComponent(exampleStandardChangeRequest, true); - act(() => { - fireEvent.click(screen.getByText(actionBtnText)); - }); + fireEvent.click(screen.getByText(actionBtnText)); expect(screen.getByText(newPrjBtnText)).not.toHaveAttribute('aria-disabled'); expect(screen.getByText(newWPBtnText)).not.toHaveAttribute('aria-disabled'); }); diff --git a/src/frontend/src/tests/pages/ChangeRequestDetailPage/DeleteChangeRequestView.test.tsx b/src/frontend/src/tests/pages/ChangeRequestDetailPage/DeleteChangeRequestView.test.tsx index 7b384d088b..88adf08d4a 100644 --- a/src/frontend/src/tests/pages/ChangeRequestDetailPage/DeleteChangeRequestView.test.tsx +++ b/src/frontend/src/tests/pages/ChangeRequestDetailPage/DeleteChangeRequestView.test.tsx @@ -38,11 +38,11 @@ const renderComponent = (modalShow: boolean) => { describe('delete change request page test suite', () => { it('renders text correctly', () => { renderComponent(true); - expect(screen.queryByText(`Delete Change Request #${exampleStandardChangeRequest.crId}`)).toBeInTheDocument(); + expect(screen.getByText(`Delete Change Request #${exampleStandardChangeRequest.crId}`)).toBeInTheDocument(); expect( - screen.queryByText(`Are you sure you want to delete Change Request #${exampleStandardChangeRequest.crId}?`) + screen.getByText(`Are you sure you want to delete Change Request #${exampleStandardChangeRequest.crId}?`) ).toBeInTheDocument(); - expect(screen.queryByText(`This action cannot be undone!`)).toBeInTheDocument(); + expect(screen.getByText(`This action cannot be undone!`)).toBeInTheDocument(); }); it("doesn't display modal", () => { diff --git a/src/frontend/src/tests/pages/ErrorPage.test.tsx b/src/frontend/src/tests/pages/ErrorPage.test.tsx index a0ec3313b8..3a2ffb9c07 100644 --- a/src/frontend/src/tests/pages/ErrorPage.test.tsx +++ b/src/frontend/src/tests/pages/ErrorPage.test.tsx @@ -3,14 +3,14 @@ * See the LICENSE file in the repository root folder for details. */ -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import ErrorPage from '../../pages/ErrorPage'; describe('error page', () => { it('renders everything', () => { - const { getByText } = render(); + render(); - expect(getByText('Oops, sorry!')).toBeInTheDocument(); - expect(getByText('There was an error loading the page.')).toBeInTheDocument(); + expect(screen.getByText('Oops, sorry!')).toBeInTheDocument(); + expect(screen.getByText('There was an error loading the page.')).toBeInTheDocument(); }); }); diff --git a/src/frontend/src/tests/pages/ProjectDetailPage/ProjectViewContainer.test.tsx b/src/frontend/src/tests/pages/ProjectDetailPage/ProjectViewContainer.test.tsx index 0eecdf5e40..2b68b38345 100644 --- a/src/frontend/src/tests/pages/ProjectDetailPage/ProjectViewContainer.test.tsx +++ b/src/frontend/src/tests/pages/ProjectDetailPage/ProjectViewContainer.test.tsx @@ -3,7 +3,7 @@ * See the LICENSE file in the repository root folder for details. */ -import { render, screen, routerWrapperBuilder, fireEvent, act } from '../../test-support/test-utils'; +import { render, screen, routerWrapperBuilder, fireEvent } from '../../test-support/test-utils'; import { exampleProject1 } from '../../test-support/test-data/projects.stub'; import { mockAuth } from '../../test-support/test-data/test-utils.stub'; import { exampleAdminUser, exampleGuestUser } from '../../test-support/test-data/users.stub'; @@ -34,10 +34,10 @@ describe('Rendering Project View Container', () => { vi.spyOn(userHooks, 'useCurrentUser').mockReturnValue(exampleAdminUser); vi.spyOn(userHooks, 'useUsersFavoriteProjects').mockReturnValue(mockUseUsersFavoriteProjects()); vi.spyOn(wpHooks, 'useGetManyWorkPackages').mockReturnValue(mockManyWorkPackages(exampleAllWorkPackages)); - renderComponent(); }); it('renders the provided project', () => { + renderComponent(); expect(screen.getAllByText('1.1.0 - Impact Attenuator').length).toEqual(1); expect(screen.getByText('Details')).toBeInTheDocument(); expect(screen.getByText('Work Packages')).toBeInTheDocument(); @@ -45,31 +45,33 @@ describe('Rendering Project View Container', () => { }); it('disables the buttons for guest users', () => { + renderComponent(); vi.spyOn(userHooks, 'useCurrentUser').mockReturnValue(exampleGuestUser); - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + fireEvent.click(screen.getByText('Actions')); expect(screen.getByText('Edit')).toHaveAttribute('aria-disabled', 'true'); expect(screen.getByText('Request Change')).toHaveAttribute('aria-disabled', 'true'); }); it('enables the buttons for admin users', () => { - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + renderComponent(); + fireEvent.click(screen.getByText('Actions')); expect(screen.getByText('Edit')).not.toHaveAttribute('aria-disabled', 'true'); expect(screen.getByText('Request Change')).not.toHaveAttribute('aria-disabled', 'true'); }); describe('Work Package Preview', () => { it('renders the work package names', () => { + renderComponent(); + exampleProject1.workPackages.forEach((wp) => { expect(screen.getByText(wp.name)).toBeInTheDocument(); }); }); it('renders the work package statuses', () => { + renderComponent(); + // should be the same as textMap in the WorkPackageStageChip component const statusLabels: Record = { [WorkPackageStage.Research]: 'Research', @@ -80,7 +82,8 @@ describe('Rendering Project View Container', () => { }; exampleProject1.workPackages.forEach((wp) => { - if (wp.stage) expect(screen.getByText(statusLabels[wp.stage])).toBeInTheDocument(); + if (!wp.stage) return; + expect(screen.getByText(statusLabels[wp.stage])).toBeInTheDocument(); }); }); }); diff --git a/src/frontend/src/tests/pages/WorkPackageDetailPage/ActivateWorkPackageModalContainer/ActivateWorkPackageModal.test.tsx b/src/frontend/src/tests/pages/WorkPackageDetailPage/ActivateWorkPackageModalContainer/ActivateWorkPackageModal.test.tsx index 08103db740..68cd396414 100644 --- a/src/frontend/src/tests/pages/WorkPackageDetailPage/ActivateWorkPackageModalContainer/ActivateWorkPackageModal.test.tsx +++ b/src/frontend/src/tests/pages/WorkPackageDetailPage/ActivateWorkPackageModalContainer/ActivateWorkPackageModal.test.tsx @@ -42,7 +42,7 @@ describe('activate work package modal test suite', () => { it('renders all the info', () => { renderComponent(true); - expect(screen.queryByText(`Activate #${wbsPipe(exampleWbs1)}`)).toBeInTheDocument(); + expect(screen.getByText(`Activate #${wbsPipe(exampleWbs1)}`)).toBeInTheDocument(); expect(screen.getByText(/Date/)).toBeInTheDocument(); expect(screen.getByText(/WP details/)).toBeInTheDocument(); diff --git a/src/frontend/src/tests/pages/WorkPackageDetailPage/StageGateWorkPackageModalContainer/StageGateWorkPackageModal.test.tsx b/src/frontend/src/tests/pages/WorkPackageDetailPage/StageGateWorkPackageModalContainer/StageGateWorkPackageModal.test.tsx index 8db60e154d..2b415b2208 100644 --- a/src/frontend/src/tests/pages/WorkPackageDetailPage/StageGateWorkPackageModalContainer/StageGateWorkPackageModal.test.tsx +++ b/src/frontend/src/tests/pages/WorkPackageDetailPage/StageGateWorkPackageModalContainer/StageGateWorkPackageModal.test.tsx @@ -38,7 +38,7 @@ describe('stage gate work package modal test suite', () => { it('renders the info if the modal is shown', () => { renderComponent(true); - expect(screen.queryByText(`Stage Gate #${wbsPipe(exampleWbs1)}`)).toBeInTheDocument(); + expect(screen.getByText(`Stage Gate #${wbsPipe(exampleWbs1)}`)).toBeInTheDocument(); expect(screen.getByText(/done/)).toBeInTheDocument(); expect(screen.getAllByRole('radio').length).toBe(2); expect(screen.getByText('Cancel')).toBeInTheDocument(); diff --git a/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackagePage.test.tsx b/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackagePage.test.tsx index f7d73711fb..c8225e0b15 100644 --- a/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackagePage.test.tsx +++ b/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackagePage.test.tsx @@ -5,7 +5,7 @@ import { UseQueryResult } from 'react-query'; import { AuthenticatedUser, WorkPackage } from 'shared'; -import { render, screen, routerWrapperBuilder, act, fireEvent } from '../../test-support/test-utils'; +import { render, screen, routerWrapperBuilder, fireEvent } from '../../test-support/test-utils'; import { Auth } from '../../../utils/types'; import { useGetManyWorkPackages, useSingleWorkPackage } from '../../../hooks/work-packages.hooks'; import { useAuth } from '../../../hooks/auth.hooks'; @@ -110,9 +110,7 @@ describe('work package container', () => { mockGetBlockingWorkPackagesHook(false, false, [exampleDesignWorkPackage]); renderComponent(); - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + fireEvent.click(screen.getByText('Actions')); expect(screen.getByText('Edit')).toBeEnabled(); }); @@ -123,9 +121,8 @@ describe('work package container', () => { mockGetBlockingWorkPackagesHook(false, false, [exampleDesignWorkPackage]); renderComponent(); - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + fireEvent.click(screen.getByText('Actions')); + expect(screen.getByText('Edit')).toHaveAttribute('aria-disabled'); }); }); diff --git a/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageDetails.test.tsx b/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageDetails.test.tsx index 539122603a..65894f67b1 100644 --- a/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageDetails.test.tsx +++ b/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageDetails.test.tsx @@ -1,3 +1,4 @@ +/* eslint-disable testing-library/no-container */ /* * This file is part of NER's FinishLine and licensed under GNU AGPLv3. * See the LICENSE file in the repository root folder for details. diff --git a/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageViewContainer.test.tsx b/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageViewContainer.test.tsx index 22da8ebed8..8b411d02a3 100644 --- a/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageViewContainer.test.tsx +++ b/src/frontend/src/tests/pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageViewContainer.test.tsx @@ -3,7 +3,7 @@ * See the LICENSE file in the repository root folder for details. */ -import { render, screen, routerWrapperBuilder, act, fireEvent } from '../../../test-support/test-utils'; +import { render, screen, routerWrapperBuilder, fireEvent } from '../../../test-support/test-utils'; import { exampleResearchWorkPackage, exampleDesignWorkPackage } from '../../../test-support/test-data/work-packages.stub'; import WorkPackageViewContainer from '../../../../pages/WorkPackageDetailPage/WorkPackageViewContainer/WorkPackageViewContainer'; import * as wpHooks from '../../../../hooks/work-packages.hooks'; @@ -58,11 +58,11 @@ describe.skip('work package container view', () => { renderComponent(); expect(screen.getByText('Actions')).toBeInTheDocument(); - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + + fireEvent.click(screen.getByText('Actions')); + expect(screen.getByText('Edit')).toBeInTheDocument(); - expect(screen.queryByText('Activate')).toBeInTheDocument(); + expect(screen.getByText('Activate')).toBeInTheDocument(); expect(screen.queryByText('Stage Gate')).not.toBeInTheDocument(); }); @@ -70,47 +70,43 @@ describe.skip('work package container view', () => { renderComponent(exampleResearchWorkPackage); expect(screen.getByText('Actions')).toBeInTheDocument(); - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + + fireEvent.click(screen.getByText('Actions')); + expect(screen.getByText('Edit')).toBeInTheDocument(); expect(screen.queryByText('Activate')).not.toBeInTheDocument(); - expect(screen.queryByText('Stage Gate')).toBeInTheDocument(); + expect(screen.getByText('Stage Gate')).toBeInTheDocument(); }); it('disables edit button when not allowed', () => { renderComponent(exampleDesignWorkPackage, false); - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + fireEvent.click(screen.getByText('Actions')); + expect(screen.getByText('Edit')).toHaveAttribute('aria-disabled'); }); it('disables activate button when not allowed', () => { renderComponent(exampleDesignWorkPackage, true, false); - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + fireEvent.click(screen.getByText('Actions')); + expect(screen.getByText('Activate')).toHaveAttribute('aria-disabled'); }); it('disables stage gate button when not allowed', () => { renderComponent(exampleResearchWorkPackage, true, true, false); - act(() => { - fireEvent.click(screen.getByText('Actions')); - }); + fireEvent.click(screen.getByText('Actions')); + expect(screen.getByText('Stage Gate')).toHaveAttribute('aria-disabled'); }); it('disables request change button when not allowed', () => { renderComponent(exampleResearchWorkPackage, true, true, true, false); - act(() => { - fireEvent.click(screen.getByText(/Actions/)); - }); + fireEvent.click(screen.getByText(/Actions/)); + expect(screen.getByText('Request Change')).toHaveAttribute('aria-disabled'); }); }); diff --git a/src/frontend/src/utils/diff-page.utils.ts b/src/frontend/src/utils/diff-page.utils.ts index fbc3b24b4a..281d0993d4 100644 --- a/src/frontend/src/utils/diff-page.utils.ts +++ b/src/frontend/src/utils/diff-page.utils.ts @@ -51,22 +51,20 @@ export const changeBulletDetailText = (changeBullet: ChangeBullet): string | str return fullNamePipe(detail); } else if (detail.length === 0) { return 'None'; - } else { - // detail is a non-empty array - const testVal = detail[0]; - - if (typeof testVal === 'string') { - return detail as string[]; - } else if ('teamName' in testVal) { - return (detail as TeamPreview[]).map((team) => team.teamName); - } else if ('id' in testVal) { - return (detail as DescriptionBullet[]).map((bullet) => bullet.detail); - } else if ('carNumber' in testVal) { - return (detail as WbsNumber[]).map(wbsPipe); - } else { - return (detail as Link[]).map((link) => `${link.linkType.name}: ${link.url}`); - } } + // detail is a non-empty array + const [testVal] = detail; + + if (typeof testVal === 'string') { + return detail as string[]; + } else if ('teamName' in testVal) { + return (detail as TeamPreview[]).map((team) => team.teamName); + } else if ('id' in testVal) { + return (detail as DescriptionBullet[]).map((bullet) => bullet.detail); + } else if ('carNumber' in testVal) { + return (detail as WbsNumber[]).map(wbsPipe); + } + return (detail as Link[]).map((link) => `${link.linkType.name}: ${link.url}`); }; export enum PotentialChangeType { @@ -109,7 +107,7 @@ export const valueChanged = (original: ProposedChangeValue, proposed: ProposedCh if (original.length === 0) return proposed.length !== 0; if (proposed.length === 0) return original.length !== 0; - const testVal = original[0]; + const [testVal] = original; if (testVal === undefined) return proposed[0] !== undefined; if (proposed[0] === undefined) return testVal !== undefined; @@ -126,9 +124,8 @@ export const valueChanged = (original: ProposedChangeValue, proposed: ProposedCh (original as DescriptionBullet[]).map((bullet) => bullet.detail).join() !== (proposed as DescriptionBullet[]).map((bullet) => bullet.detail).join() ); - } else { - return (original as Link[]).map((link) => link.url).join() !== (proposed as Link[]).map((link) => link.url).join(); } + return (original as Link[]).map((link) => link.url).join() !== (proposed as Link[]).map((link) => link.url).join(); }; export const projectToProposedChangesPreview = (project: Project | undefined): ProjectProposedChangesPreview | undefined => { diff --git a/src/frontend/src/utils/form.ts b/src/frontend/src/utils/form.ts index 82ce9edeed..8518b8e59e 100644 --- a/src/frontend/src/utils/form.ts +++ b/src/frontend/src/utils/form.ts @@ -22,7 +22,7 @@ export const bulletsToObject = (bullets: DescriptionBullet[]): DescriptionBullet */ export const rulesToObject = (rules: string[]) => rules.map((rule, bulletId) => { - return { bulletId: bulletId, detail: rule }; + return { bulletId, detail: rule }; }); // transforms the bullets made by react-hook-forms to the objects needed for the payload to the backend @@ -70,10 +70,10 @@ export enum WPFormType { */ export const generateUUID = () => { // Public Domain/MIT - var d = new Date().getTime(); //Timestamp - var d2 = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0; //Time in microseconds since page-load or 0 if unsupported - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - var r = Math.random() * 16; //random number between 0 and 16 + let d = new Date().getTime(); //Timestamp + let d2 = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0; //Time in microseconds since page-load or 0 if unsupported + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + let r = Math.random() * 16; //random number between 0 and 16 if (d > 0) { //Use timestamp until depleted r = (d + r) % 16 | 0;