Skip to content

Commit c55a80a

Browse files
authored
Merge pull request #2247 from objectcomputing/fix/eslint-errors-typescript
fix: parse tsx files with the tseslint parser
2 parents d38c511 + 9e65f52 commit c55a80a

File tree

4 files changed

+85
-14
lines changed

4 files changed

+85
-14
lines changed

docs/getting-started/running/index.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,16 @@ To run the UI tests, use the following command:
6363
yarn --cwd web-ui test
6464
```
6565

66-
Or simply `cd` to the `web-ui` directory and run `yarn test`.
66+
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:
67+
68+
```shell
69+
yarn --cwd web-ui test -u # or simply `yarn test` followed by `u`
70+
```
71+
72+
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/).
6773

6874
# Running the Server
6975

7076
## Running Tests
7177

72-
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.
78+
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.

web-ui/eslint.config.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import globals from "globals";
2-
import reactHooksPlugin from "eslint-plugin-react-hooks";
3-
import reactPlugin from "eslint-plugin-react";
4-
import vitestPlugin from "eslint-plugin-vitest";
1+
import globals from 'globals';
2+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
3+
import reactPlugin from 'eslint-plugin-react';
4+
import vitestPlugin from 'eslint-plugin-vitest';
5+
import tseslint from 'typescript-eslint';
56

7+
/**
8+
* @type {import('eslint').Linter.FlatConfig[]}
9+
*/
610
export default [
711
{
8-
files: ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"],
12+
files: ['src/**/*.js', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.tsx'],
913
languageOptions: {
14+
parser: tseslint.parser,
1015
parserOptions: {
1116
ecmaFeatures: {
1217
jsx: true
@@ -15,22 +20,23 @@ export default [
1520
globals: {
1621
...globals.browser,
1722
...globals.node,
18-
...vitestPlugin.environments.env.globals,
23+
...vitestPlugin.environments.env.globals,
1924
HttpResponse: false,
2025
snapshot: false,
21-
waitForSnapshot: false,
26+
waitForSnapshot: false
2227
}
2328
},
2429
plugins: {
2530
react: reactPlugin,
2631
'react-hooks': reactHooksPlugin,
32+
'@typescript-eslint': tseslint.plugin,
2733
vitest: vitestPlugin
2834
},
2935
rules: {
3036
// Override default rules here.
3137
'react-hooks/exhaustive-deps': 'warn',
3238
...vitestPlugin.configs.recommended.rules,
33-
'vitest/expect-expect': 'off',
39+
'vitest/expect-expect': 'off'
3440
}
3541
}
36-
];
42+
];

web-ui/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
"prop-types": "^15.8.1",
100100
"react-test-renderer": "^18.2.0",
101101
"storybook": "^8.0.4",
102+
"typescript": "^5.4.5",
103+
"typescript-eslint": "^7.7.1",
102104
"vite": "^5.2.6",
103105
"vite-tsconfig-paths": "^4.3.2",
104106
"vitest": "^1.4.0",

web-ui/yarn.lock

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@
13631363
dependencies:
13641364
eslint-visitor-keys "^3.3.0"
13651365

1366-
"@eslint-community/regexpp@^4.6.1":
1366+
"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.6.1":
13671367
version "4.10.0"
13681368
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63"
13691369
integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==
@@ -3102,6 +3102,34 @@
31023102
resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd"
31033103
integrity sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==
31043104

3105+
"@typescript-eslint/eslint-plugin@7.7.1":
3106+
version "7.7.1"
3107+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.1.tgz#50a9044e3e5fe76b22caf64fb7fc1f97614bdbfd"
3108+
integrity sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q==
3109+
dependencies:
3110+
"@eslint-community/regexpp" "^4.10.0"
3111+
"@typescript-eslint/scope-manager" "7.7.1"
3112+
"@typescript-eslint/type-utils" "7.7.1"
3113+
"@typescript-eslint/utils" "7.7.1"
3114+
"@typescript-eslint/visitor-keys" "7.7.1"
3115+
debug "^4.3.4"
3116+
graphemer "^1.4.0"
3117+
ignore "^5.3.1"
3118+
natural-compare "^1.4.0"
3119+
semver "^7.6.0"
3120+
ts-api-utils "^1.3.0"
3121+
3122+
"@typescript-eslint/parser@7.7.1":
3123+
version "7.7.1"
3124+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.7.1.tgz#f940e9f291cdca40c46cb75916217d3a42d6ceea"
3125+
integrity sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw==
3126+
dependencies:
3127+
"@typescript-eslint/scope-manager" "7.7.1"
3128+
"@typescript-eslint/types" "7.7.1"
3129+
"@typescript-eslint/typescript-estree" "7.7.1"
3130+
"@typescript-eslint/visitor-keys" "7.7.1"
3131+
debug "^4.3.4"
3132+
31053133
"@typescript-eslint/scope-manager@7.7.1":
31063134
version "7.7.1"
31073135
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.7.1.tgz#07fe59686ca843f66e3e2b5c151522bc38effab2"
@@ -3110,6 +3138,16 @@
31103138
"@typescript-eslint/types" "7.7.1"
31113139
"@typescript-eslint/visitor-keys" "7.7.1"
31123140

3141+
"@typescript-eslint/type-utils@7.7.1":
3142+
version "7.7.1"
3143+
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.7.1.tgz#2f8094edca3bebdaad009008929df645ed9c8743"
3144+
integrity sha512-ZksJLW3WF7o75zaBPScdW1Gbkwhd/lyeXGf1kQCxJaOeITscoSl0MjynVvCzuV5boUz/3fOI06Lz8La55mu29Q==
3145+
dependencies:
3146+
"@typescript-eslint/typescript-estree" "7.7.1"
3147+
"@typescript-eslint/utils" "7.7.1"
3148+
debug "^4.3.4"
3149+
ts-api-utils "^1.3.0"
3150+
31133151
"@typescript-eslint/types@7.7.1":
31143152
version "7.7.1"
31153153
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.7.1.tgz#f903a651fb004c75add08e4e9e207f169d4b98d7"
@@ -3129,7 +3167,7 @@
31293167
semver "^7.6.0"
31303168
ts-api-utils "^1.3.0"
31313169

3132-
"@typescript-eslint/utils@^7.7.1":
3170+
"@typescript-eslint/utils@7.7.1", "@typescript-eslint/utils@^7.7.1":
31333171
version "7.7.1"
31343172
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.7.1.tgz#5d161f2b4a55e1bc38b634bebb921e4bd4e4a16e"
31353173
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,
59796017
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
59806018
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
59816019

6020+
graphemer@^1.4.0:
6021+
version "1.4.0"
6022+
resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6"
6023+
integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==
6024+
59826025
graphql@^16.8.1:
59836026
version "16.8.1"
59846027
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07"
@@ -6295,7 +6338,7 @@ ieee754@^1.1.13:
62956338
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
62966339
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
62976340

6298-
ignore@^5.2.0:
6341+
ignore@^5.2.0, ignore@^5.3.1:
62996342
version "5.3.1"
63006343
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef"
63016344
integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==
@@ -10175,6 +10218,20 @@ typed-array-length@^1.0.6:
1017510218
is-typed-array "^1.1.13"
1017610219
possible-typed-array-names "^1.0.0"
1017710220

10221+
typescript-eslint@^7.7.1:
10222+
version "7.7.1"
10223+
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-7.7.1.tgz#16f82e83bb0955af02f258cb7a9de59e1bfb8706"
10224+
integrity sha512-ykEBfa3xx3odjZy6GRED4SCPrjo0rgHwstLlEgLX4EMEuv7QeIDSmfV+S6Kk+XkbsYn4BDEcPvsci1X26lRpMQ==
10225+
dependencies:
10226+
"@typescript-eslint/eslint-plugin" "7.7.1"
10227+
"@typescript-eslint/parser" "7.7.1"
10228+
"@typescript-eslint/utils" "7.7.1"
10229+
10230+
typescript@^5.4.5:
10231+
version "5.4.5"
10232+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
10233+
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==
10234+
1017810235
ufo@^1.3.2, ufo@^1.4.0:
1017910236
version "1.5.3"
1018010237
resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.5.3.tgz#3325bd3c977b6c6cd3160bf4ff52989adc9d3344"

0 commit comments

Comments
 (0)