From 0b9533425b4f4499ab827a3d738a789aeb02f9b7 Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Sun, 27 Oct 2024 17:43:51 +0100 Subject: [PATCH] Setup new eslint configuration + needed fixes for errors --- .vscode/settings.json | 1 + CONTRIBUTING.md | 7 +- .../card/CardOrgApplicationVote.vue | 9 +- .../components/card/CardTopicSelection.vue | 1 + .../components/dropdown/DropdownCreate.vue | 2 +- frontend/components/dropdown/DropdownInfo.vue | 2 +- .../components/dropdown/DropdownLanguage.vue | 2 +- .../components/dropdown/DropdownTheme.vue | 2 +- .../dropdown/DropdownUserOptions.vue | 2 +- .../grid/GridGitHubContributors.vue | 12 +- frontend/components/media/MediaMap.vue | 3 +- frontend/components/menu/MenuItemLabel.vue | 4 +- frontend/components/menu/MenuSearchResult.vue | 1 - frontend/components/modal/ModalSharePage.vue | 1 + .../components/modal/qr-code/ModalQRCode.vue | 5 +- .../components/sidebar/left/SidebarLeft.vue | 2 + frontend/composables/fetch.ts | 2 +- frontend/composables/put.ts | 6 +- frontend/composables/useAuth.ts | 2 +- frontend/composables/useFormCheckboxRadio.ts | 1 + frontend/composables/useFormSetup.ts | 1 + frontend/{.eslintrc.js => eslint.config.mjs} | 66 +-- frontend/layouts/auth.vue | 3 +- frontend/modules.ts | 3 +- frontend/package.json | 8 +- frontend/pages/groups/create.vue | 31 +- .../organizations/[id]/groups/[id]/about.vue | 10 +- frontend/pages/resources/create.vue | 31 +- frontend/stores/event.ts | 2 +- frontend/stores/organization.ts | 2 +- frontend/tailwind.config.ts | 2 +- frontend/tests/page-objects/HomePage.ts | 2 +- frontend/tests/specs/home-page.spec.ts | 2 +- frontend/types/content/resource.d.ts | 3 +- frontend/yarn.lock | 515 +++++++++++++++--- 35 files changed, 559 insertions(+), 189 deletions(-) rename frontend/{.eslintrc.js => eslint.config.mjs} (80%) diff --git a/.vscode/settings.json b/.vscode/settings.json index fd1fc0f20..2e37f3f36 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { "eslint.validate": ["javascript", "typescript", "vue"], + "eslint.useFlatConfig": true, "typescript.tsdk": "./frontend/node_modules/typescript/lib" } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0595818a9..9b07c6a98 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -326,11 +326,12 @@ exit ### Frontend -Please check the formatting of your code using Prettier before pull requests with the following command: +Please check the formatting of your code using Prettier and run the static type check with eslint before pull requests with the following command: ```bash # Within ./frontend: -yarn prettier . --check --config ../.prettierrc --ignore-path ../.prettierignore +yarn format +yarn lint ``` You can further run the following commands for TypeScript type checks on the frontend: @@ -338,7 +339,7 @@ You can further run the following commands for TypeScript type checks on the fro ```bash # Within ./frontend: yarn run postinstall -yarn nuxi typecheck +yarn typecheck ``` > [!NOTE] diff --git a/frontend/components/card/CardOrgApplicationVote.vue b/frontend/components/card/CardOrgApplicationVote.vue index 75cc54266..fcae4242d 100644 --- a/frontend/components/card/CardOrgApplicationVote.vue +++ b/frontend/components/card/CardOrgApplicationVote.vue @@ -93,14 +93,9 @@ export interface Props { */ export interface Emits { /** - * The up vote casted event. + * The up and down vote casted events. */ - (event: "up-vote"): void; - - /** - * The down vote casted event. - */ - (event: "down-vote"): void; + (event: "up-vote" | "down-vote"): void; } defineEmits(); diff --git a/frontend/components/card/CardTopicSelection.vue b/frontend/components/card/CardTopicSelection.vue index 4009db825..f6b84cd36 100644 --- a/frontend/components/card/CardTopicSelection.vue +++ b/frontend/components/card/CardTopicSelection.vue @@ -255,6 +255,7 @@ const selectedTopicTags = computed(() => { const topics = computed((): TopicsTag[] => { return [ + // eslint-disable-next-line vue/no-side-effects-in-computed-properties ...selectedTopicTags.value.sort((a, b) => a.value.localeCompare(b.value)), ...GLOBAL_TOPICS.filter((topic) => !isActiveTopic(topic.value)).sort( (a, b) => a.value.localeCompare(b.value) diff --git a/frontend/components/dropdown/DropdownCreate.vue b/frontend/components/dropdown/DropdownCreate.vue index 6fb271aa6..cbb870dc3 100644 --- a/frontend/components/dropdown/DropdownCreate.vue +++ b/frontend/components/dropdown/DropdownCreate.vue @@ -12,7 +12,7 @@