From efd3a0a8fc4249272fed56bc051ec9ed82b39459 Mon Sep 17 00:00:00 2001 From: Josh Habdas Date: Thu, 25 Apr 2024 13:18:06 -0400 Subject: [PATCH 1/3] fix: parse tsx files in addition to jsx --- web-ui/eslint.config.js | 24 ++++++++++------ web-ui/package.json | 2 ++ web-ui/yarn.lock | 63 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 77 insertions(+), 12 deletions(-) diff --git a/web-ui/eslint.config.js b/web-ui/eslint.config.js index 44efababae..799fc1efdf 100644 --- a/web-ui/eslint.config.js +++ b/web-ui/eslint.config.js @@ -1,12 +1,17 @@ -import globals from "globals"; -import reactHooksPlugin from "eslint-plugin-react-hooks"; -import reactPlugin from "eslint-plugin-react"; -import vitestPlugin from "eslint-plugin-vitest"; +import globals from 'globals'; +import reactHooksPlugin from 'eslint-plugin-react-hooks'; +import reactPlugin from 'eslint-plugin-react'; +import vitestPlugin from 'eslint-plugin-vitest'; +import tseslint from 'typescript-eslint'; +/** + * @type {import('eslint').Linter.FlatConfig[]} + */ export default [ { - files: ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"], + files: ['src/**/*.js', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.tsx'], languageOptions: { + parser: tseslint.parser, parserOptions: { ecmaFeatures: { jsx: true @@ -15,22 +20,23 @@ export default [ globals: { ...globals.browser, ...globals.node, - ...vitestPlugin.environments.env.globals, + ...vitestPlugin.environments.env.globals, HttpResponse: false, snapshot: false, - waitForSnapshot: false, + waitForSnapshot: false } }, plugins: { react: reactPlugin, 'react-hooks': reactHooksPlugin, + '@typescript-eslint': tseslint.plugin, vitest: vitestPlugin }, rules: { // Override default rules here. 'react-hooks/exhaustive-deps': 'warn', ...vitestPlugin.configs.recommended.rules, - 'vitest/expect-expect': 'off', + 'vitest/expect-expect': 'off' } } -]; \ No newline at end of file +]; diff --git a/web-ui/package.json b/web-ui/package.json index eae2093aca..0c29bcc59e 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -99,6 +99,8 @@ "prop-types": "^15.8.1", "react-test-renderer": "^18.2.0", "storybook": "^8.0.4", + "typescript": "^5.4.5", + "typescript-eslint": "^7.7.1", "vite": "^5.2.6", "vite-tsconfig-paths": "^4.3.2", "vitest": "^1.4.0", diff --git a/web-ui/yarn.lock b/web-ui/yarn.lock index cce3bb8b12..891db9abbe 100644 --- a/web-ui/yarn.lock +++ b/web-ui/yarn.lock @@ -1363,7 +1363,7 @@ dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.6.1": +"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.6.1": version "4.10.0" resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== @@ -3102,6 +3102,34 @@ resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd" integrity sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g== +"@typescript-eslint/eslint-plugin@7.7.1": + version "7.7.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.1.tgz#50a9044e3e5fe76b22caf64fb7fc1f97614bdbfd" + integrity sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q== + dependencies: + "@eslint-community/regexpp" "^4.10.0" + "@typescript-eslint/scope-manager" "7.7.1" + "@typescript-eslint/type-utils" "7.7.1" + "@typescript-eslint/utils" "7.7.1" + "@typescript-eslint/visitor-keys" "7.7.1" + debug "^4.3.4" + graphemer "^1.4.0" + ignore "^5.3.1" + natural-compare "^1.4.0" + semver "^7.6.0" + ts-api-utils "^1.3.0" + +"@typescript-eslint/parser@7.7.1": + version "7.7.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.7.1.tgz#f940e9f291cdca40c46cb75916217d3a42d6ceea" + integrity sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw== + dependencies: + "@typescript-eslint/scope-manager" "7.7.1" + "@typescript-eslint/types" "7.7.1" + "@typescript-eslint/typescript-estree" "7.7.1" + "@typescript-eslint/visitor-keys" "7.7.1" + debug "^4.3.4" + "@typescript-eslint/scope-manager@7.7.1": version "7.7.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.7.1.tgz#07fe59686ca843f66e3e2b5c151522bc38effab2" @@ -3110,6 +3138,16 @@ "@typescript-eslint/types" "7.7.1" "@typescript-eslint/visitor-keys" "7.7.1" +"@typescript-eslint/type-utils@7.7.1": + version "7.7.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.7.1.tgz#2f8094edca3bebdaad009008929df645ed9c8743" + integrity sha512-ZksJLW3WF7o75zaBPScdW1Gbkwhd/lyeXGf1kQCxJaOeITscoSl0MjynVvCzuV5boUz/3fOI06Lz8La55mu29Q== + dependencies: + "@typescript-eslint/typescript-estree" "7.7.1" + "@typescript-eslint/utils" "7.7.1" + debug "^4.3.4" + ts-api-utils "^1.3.0" + "@typescript-eslint/types@7.7.1": version "7.7.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.7.1.tgz#f903a651fb004c75add08e4e9e207f169d4b98d7" @@ -3129,7 +3167,7 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@^7.7.1": +"@typescript-eslint/utils@7.7.1", "@typescript-eslint/utils@^7.7.1": version "7.7.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.7.1.tgz#5d161f2b4a55e1bc38b634bebb921e4bd4e4a16e" integrity sha512-QUvBxPEaBXf41ZBbaidKICgVL8Hin0p6prQDu6bbetWo39BKbWJxRsErOzMNT1rXvTll+J7ChrbmMCXM9rsvOQ== @@ -5979,6 +6017,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + graphql@^16.8.1: version "16.8.1" resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07" @@ -6295,7 +6338,7 @@ ieee754@^1.1.13: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^5.2.0: +ignore@^5.2.0, ignore@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== @@ -10175,6 +10218,20 @@ typed-array-length@^1.0.6: is-typed-array "^1.1.13" possible-typed-array-names "^1.0.0" +typescript-eslint@^7.7.1: + version "7.7.1" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-7.7.1.tgz#16f82e83bb0955af02f258cb7a9de59e1bfb8706" + integrity sha512-ykEBfa3xx3odjZy6GRED4SCPrjo0rgHwstLlEgLX4EMEuv7QeIDSmfV+S6Kk+XkbsYn4BDEcPvsci1X26lRpMQ== + dependencies: + "@typescript-eslint/eslint-plugin" "7.7.1" + "@typescript-eslint/parser" "7.7.1" + "@typescript-eslint/utils" "7.7.1" + +typescript@^5.4.5: + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== + ufo@^1.3.2, ufo@^1.4.0: version "1.5.3" resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.5.3.tgz#3325bd3c977b6c6cd3160bf4ff52989adc9d3344" From 3db90950643d4229504118dfc2c306d176bd421b Mon Sep 17 00:00:00 2001 From: Josh Habdas Date: Thu, 25 Apr 2024 15:18:14 -0400 Subject: [PATCH 2/3] docs: update running tests --- docs/getting-started/running/index.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/running/index.md b/docs/getting-started/running/index.md index 1e4e71e91f..4fe4f2bf03 100644 --- a/docs/getting-started/running/index.md +++ b/docs/getting-started/running/index.md @@ -63,10 +63,14 @@ To run the UI tests, use the following command: yarn --cwd web-ui test ``` -Or simply `cd` to the `web-ui` directory and run `yarn test`. +Or simply `cd` to the `web-ui` directory and run `yarn test`. Tests using Snapshots are likely to fail with component updates. Those which fail to meet their Snapshot will be marked as failed. You can update the Snapshot by running the following command: + +```shell +yarn --cwd web-ui test -u +``` # Running the Server ## Running Tests -To skip building the UI when running unit tests in the Server application add the environment variable `SKIP_WEB_UI=true` to your system or run configuration. \ No newline at end of file +To skip building the UI when running unit tests in the Server application add the environment variable `SKIP_WEB_UI=true` to your system or run configuration. From 9e65f522f85f7d8e5fa0c599ca7ea8dbd12ae921 Mon Sep 17 00:00:00 2001 From: Josh Habdas Date: Fri, 26 Apr 2024 12:44:22 -0400 Subject: [PATCH 3/3] docs: add yarn test tui usage --- docs/getting-started/running/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/getting-started/running/index.md b/docs/getting-started/running/index.md index 4fe4f2bf03..949442df63 100644 --- a/docs/getting-started/running/index.md +++ b/docs/getting-started/running/index.md @@ -66,9 +66,11 @@ yarn --cwd web-ui test Or simply `cd` to the `web-ui` directory and run `yarn test`. Tests using Snapshots are likely to fail with component updates. Those which fail to meet their Snapshot will be marked as failed. You can update the Snapshot by running the following command: ```shell -yarn --cwd web-ui test -u +yarn --cwd web-ui test -u # or simply `yarn test` followed by `u` ``` +Testing Library is installed in the UI project. You can find more information about Testing Library [here](https://testing-library.com/docs/react-testing-library/intro/). + # Running the Server ## Running Tests