diff --git a/eslint.config.ts b/eslint.config.ts index 30e8fe2f..68e264b8 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -71,7 +71,7 @@ export default [ 'init-declarations': 'off', '@typescript-eslint/init-declarations': 'off', 'max-params': 'off', - '@typescript-eslint/max-params': ['error', { max: 6 }], + '@typescript-eslint/max-params': 'off', '@typescript-eslint/member-ordering': 'error', '@typescript-eslint/method-signature-style': 'off', // Don't care about TypeScript strict mode. '@typescript-eslint/naming-convention': [ @@ -87,6 +87,7 @@ export default [ modifiers: ['const'], format: ['camelCase', 'UPPER_CASE'], trailingUnderscore: 'allow', + leadingUnderscore: 'allow', }, { // Enforce that private members are prefixed with an underscore diff --git a/frontend/src/queries/submissions.ts b/frontend/src/queries/submissions.ts index 812e5fe5..6e218003 100644 --- a/frontend/src/queries/submissions.ts +++ b/frontend/src/queries/submissions.ts @@ -1,20 +1,22 @@ -import { SubmissionController, type SubmissionResponse } from "@/controllers/submissions"; -import type { SubmissionDTO } from "@dwengo-1/common/interfaces/submission"; +import { SubmissionController, type SubmissionResponse } from '@/controllers/submissions'; +import type { SubmissionDTO } from '@dwengo-1/common/interfaces/submission'; import { QueryClient, useMutation, + type UseMutationReturnType, useQuery, useQueryClient, - type UseMutationReturnType, type UseQueryReturnType, -} from "@tanstack/vue-query"; -import { computed, toValue, type MaybeRefOrGetter } from "vue"; -import { LEARNING_PATH_KEY } from "@/queries/learning-paths.ts"; -import { LEARNING_OBJECT_KEY } from "@/queries/learning-objects.ts"; -import type { Language } from "@dwengo-1/common/util/language"; +} from '@tanstack/vue-query'; +import { computed, type MaybeRefOrGetter, toValue } from 'vue'; +import { LEARNING_PATH_KEY } from '@/queries/learning-paths.ts'; +import { LEARNING_OBJECT_KEY } from '@/queries/learning-objects.ts'; +import { Language } from '@dwengo-1/common/util/language'; export const SUBMISSION_KEY = "submissions"; +type SubmissionQueryKey = ["submission", string, Language | undefined, number, string, number, number, number]; + function submissionQueryKey( hruid: string, language: Language, @@ -23,7 +25,7 @@ function submissionQueryKey( assignmentNumber: number, groupNumber: number, submissionNumber: number, -) { +): SubmissionQueryKey { return ["submission", hruid, language, version, classid, assignmentNumber, groupNumber, submissionNumber]; } @@ -39,19 +41,21 @@ export async function invalidateAllSubmissionKeys( ): Promise { const keys = ["submission"]; - for (const key of keys) { - const queryKey = [ - key, - hruid, - language, - version, - classid, - assignmentNumber, - groupNumber, - submissionNumber, - ].filter((arg) => arg !== undefined); - await queryClient.invalidateQueries({ queryKey: queryKey }); - } + await Promise.all( + keys.map(async (key) => { + const queryKey = [ + key, + hruid, + language, + version, + classid, + assignmentNumber, + groupNumber, + submissionNumber, + ].filter((arg) => arg !== undefined); + return queryClient.invalidateQueries({ queryKey: queryKey }); + }) + ) await queryClient.invalidateQueries({ queryKey: ["submissions", hruid, language, version, classid, assignmentNumber, groupNumber].filter( diff --git a/frontend/src/utils/array-utils.ts b/frontend/src/utils/array-utils.ts index cba3291e..9a4ce828 100644 --- a/frontend/src/utils/array-utils.ts +++ b/frontend/src/utils/array-utils.ts @@ -1,4 +1,4 @@ -export function copyArrayWith(index: number, newValue: T, array: T[]) { +export function copyArrayWith(index: number, newValue: T, array: T[]): T[] { const copy = [...array]; copy[index] = newValue; return copy; diff --git a/frontend/src/utils/deep-equals.ts b/frontend/src/utils/deep-equals.ts index 2edc1be2..4434f911 100644 --- a/frontend/src/utils/deep-equals.ts +++ b/frontend/src/utils/deep-equals.ts @@ -3,7 +3,7 @@ export function deepEquals(a: T, b: T): boolean { return true; } - if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) { + if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) { return false; } diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index 953e70d1..2abb753e 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -1,20 +1,20 @@ @@ -46,7 +44,7 @@ hide-default-footer :no-data-text="t('noSubmissionsYet')" > -