style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									12005d197c
								
							
						
					
					
						commit
						45e85233a3
					
				
					 5 changed files with 98 additions and 63 deletions
				
			
		|  | @ -1,9 +1,9 @@ | ||||||
| import pluginVue from 'eslint-plugin-vue'; | import pluginVue from "eslint-plugin-vue"; | ||||||
| import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'; | import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript"; | ||||||
| import pluginVitest from '@vitest/eslint-plugin'; | import pluginVitest from "@vitest/eslint-plugin"; | ||||||
| import pluginPlaywright from 'eslint-plugin-playwright'; | import pluginPlaywright from "eslint-plugin-playwright"; | ||||||
| import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'; | import skipFormatting from "@vue/eslint-config-prettier/skip-formatting"; | ||||||
| import rootConfig from '../eslint.config'; | import rootConfig from "../eslint.config"; | ||||||
| 
 | 
 | ||||||
| // To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
 | // To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
 | ||||||
| // Import { configureVueProject } from '@vue/eslint-config-typescript'
 | // Import { configureVueProject } from '@vue/eslint-config-typescript'
 | ||||||
|  | @ -12,29 +12,36 @@ import rootConfig from '../eslint.config'; | ||||||
| 
 | 
 | ||||||
| const vueConfig = defineConfigWithVueTs( | const vueConfig = defineConfigWithVueTs( | ||||||
|     { |     { | ||||||
|         name: 'app/files-to-lint', |         name: "app/files-to-lint", | ||||||
|         files: ['**/*.{ts,mts,tsx,vue}'], |         files: ["**/*.{ts,mts,tsx,vue}"], | ||||||
|         rules: { |         rules: { | ||||||
|             'no-useless-assignment': 'off', // Depend on `no-unused-vars` to catch this
 |             "no-useless-assignment": "off", // Depend on `no-unused-vars` to catch this
 | ||||||
|         }, |         }, | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     { |     { | ||||||
|         name: 'app/files-to-ignore', |         name: "app/files-to-ignore", | ||||||
|         ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**', 'prettier.config.js', '**/test-results/**', '**/playwright-report/**'], |         ignores: [ | ||||||
|  |             "**/dist/**", | ||||||
|  |             "**/dist-ssr/**", | ||||||
|  |             "**/coverage/**", | ||||||
|  |             "prettier.config.js", | ||||||
|  |             "**/test-results/**", | ||||||
|  |             "**/playwright-report/**", | ||||||
|  |         ], | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     pluginVue.configs['flat/essential'], |     pluginVue.configs["flat/essential"], | ||||||
|     vueTsConfigs.recommended, |     vueTsConfigs.recommended, | ||||||
| 
 | 
 | ||||||
|     { |     { | ||||||
|         ...pluginVitest.configs.recommended, |         ...pluginVitest.configs.recommended, | ||||||
|         files: ['src/**/__tests__/*'], |         files: ["src/**/__tests__/*"], | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     { |     { | ||||||
|         ...pluginPlaywright.configs['flat/recommended'], |         ...pluginPlaywright.configs["flat/recommended"], | ||||||
|         files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'], |         files: ["e2e/**/*.{test,spec}.{js,ts,jsx,tsx}"], | ||||||
|     }, |     }, | ||||||
|     skipFormatting, |     skipFormatting, | ||||||
| ); | ); | ||||||
|  |  | ||||||
|  | @ -29,13 +29,21 @@ function assignmentQueryKey(classid: string, assignmentNumber: number): Assignme | ||||||
| 
 | 
 | ||||||
| type AssignmentSubmissionsQueryKey = ["assignment-submissions", string, number, boolean]; | type AssignmentSubmissionsQueryKey = ["assignment-submissions", string, number, boolean]; | ||||||
| 
 | 
 | ||||||
| function assignmentSubmissionsQueryKey(classid: string, assignmentNumber: number, full: boolean): AssignmentSubmissionsQueryKey { | function assignmentSubmissionsQueryKey( | ||||||
|  |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): AssignmentSubmissionsQueryKey { | ||||||
|     return ["assignment-submissions", classid, assignmentNumber, full]; |     return ["assignment-submissions", classid, assignmentNumber, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type AssignmentQuestionsQueryKey = ["assignment-questions", string, number, boolean]; | type AssignmentQuestionsQueryKey = ["assignment-questions", string, number, boolean]; | ||||||
| 
 | 
 | ||||||
| function assignmentQuestionsQueryKey(classid: string, assignmentNumber: number, full: boolean): AssignmentQuestionsQueryKey { | function assignmentQuestionsQueryKey( | ||||||
|  |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): AssignmentQuestionsQueryKey { | ||||||
|     return ["assignment-questions", classid, assignmentNumber, full]; |     return ["assignment-questions", classid, assignmentNumber, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -50,7 +58,7 @@ export async function invalidateAllAssignmentKeys( | ||||||
|         keys.map(async (key) => { |         keys.map(async (key) => { | ||||||
|             const queryKey = [key, classid, assignmentNumber].filter((arg) => arg !== undefined); |             const queryKey = [key, classid, assignmentNumber].filter((arg) => arg !== undefined); | ||||||
|             return queryClient.invalidateQueries({ queryKey: queryKey }); |             return queryClient.invalidateQueries({ queryKey: queryKey }); | ||||||
|         }) |         }), | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     await queryClient.invalidateQueries({ queryKey: ["assignments", classid].filter((arg) => arg !== undefined) }); |     await queryClient.invalidateQueries({ queryKey: ["assignments", classid].filter((arg) => arg !== undefined) }); | ||||||
|  |  | ||||||
|  | @ -60,7 +60,7 @@ export async function invalidateAllClassKeys(queryClient: QueryClient, classid?: | ||||||
|         keys.map(async (key) => { |         keys.map(async (key) => { | ||||||
|             const queryKey = [key, classid].filter((arg) => arg !== undefined); |             const queryKey = [key, classid].filter((arg) => arg !== undefined); | ||||||
|             return queryClient.invalidateQueries({ queryKey: queryKey }); |             return queryClient.invalidateQueries({ queryKey: queryKey }); | ||||||
|         }) |         }), | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     await queryClient.invalidateQueries({ queryKey: ["classes"] }); |     await queryClient.invalidateQueries({ queryKey: ["classes"] }); | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import { GroupController, type GroupResponse, type GroupsResponse } from '@/controllers/groups'; | import { GroupController, type GroupResponse, type GroupsResponse } from "@/controllers/groups"; | ||||||
| import type { QuestionsResponse } from '@/controllers/questions'; | import type { QuestionsResponse } from "@/controllers/questions"; | ||||||
| import type { SubmissionsResponse } from '@/controllers/submissions'; | import type { SubmissionsResponse } from "@/controllers/submissions"; | ||||||
| import type { GroupDTO } from '@dwengo-1/common/interfaces/group'; | import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; | ||||||
| import { | import { | ||||||
|     QueryClient, |     QueryClient, | ||||||
|     useMutation, |     useMutation, | ||||||
|  | @ -9,32 +9,42 @@ import { | ||||||
|     useQuery, |     useQuery, | ||||||
|     useQueryClient, |     useQueryClient, | ||||||
|     type UseQueryReturnType, |     type UseQueryReturnType, | ||||||
| } from '@tanstack/vue-query'; | } from "@tanstack/vue-query"; | ||||||
| import { computed, type MaybeRefOrGetter, toValue } from 'vue'; | import { computed, type MaybeRefOrGetter, toValue } from "vue"; | ||||||
| import { invalidateAllSubmissionKeys } from './submissions'; | import { invalidateAllSubmissionKeys } from "./submissions"; | ||||||
| 
 | 
 | ||||||
| type GroupsQueryKey = ['groups', string, number, boolean]; | type GroupsQueryKey = ["groups", string, number, boolean]; | ||||||
| 
 | 
 | ||||||
| export function groupsQueryKey(classid: string, assignmentNumber: number, full: boolean): GroupsQueryKey { | export function groupsQueryKey(classid: string, assignmentNumber: number, full: boolean): GroupsQueryKey { | ||||||
|     return ['groups', classid, assignmentNumber, full]; |     return ["groups", classid, assignmentNumber, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type GroupQueryKey = ['group', string, number, number]; | type GroupQueryKey = ["group", string, number, number]; | ||||||
| 
 | 
 | ||||||
| function groupQueryKey(classid: string, assignmentNumber: number, groupNumber: number): GroupQueryKey { | function groupQueryKey(classid: string, assignmentNumber: number, groupNumber: number): GroupQueryKey { | ||||||
|     return ['group', classid, assignmentNumber, groupNumber]; |     return ["group", classid, assignmentNumber, groupNumber]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type GroupSubmissionsQueryKey = ['group-submissions', string, number, number, boolean]; | type GroupSubmissionsQueryKey = ["group-submissions", string, number, number, boolean]; | ||||||
| 
 | 
 | ||||||
| function groupSubmissionsQueryKey(classid: string, assignmentNumber: number, groupNumber: number, full: boolean): GroupSubmissionsQueryKey { | function groupSubmissionsQueryKey( | ||||||
|     return ['group-submissions', classid, assignmentNumber, groupNumber, full]; |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     groupNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): GroupSubmissionsQueryKey { | ||||||
|  |     return ["group-submissions", classid, assignmentNumber, groupNumber, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type GroupQuestionsQueryKey = ['group-questions', string, number, number, boolean]; | type GroupQuestionsQueryKey = ["group-questions", string, number, number, boolean]; | ||||||
| 
 | 
 | ||||||
| function groupQuestionsQueryKey(classid: string, assignmentNumber: number, groupNumber: number, full: boolean): GroupQuestionsQueryKey { | function groupQuestionsQueryKey( | ||||||
|     return ['group-questions', classid, assignmentNumber, groupNumber, full]; |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     groupNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): GroupQuestionsQueryKey { | ||||||
|  |     return ["group-questions", classid, assignmentNumber, groupNumber, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function invalidateAllGroupKeys( | export async function invalidateAllGroupKeys( | ||||||
|  | @ -43,7 +53,7 @@ export async function invalidateAllGroupKeys( | ||||||
|     assignmentNumber?: number, |     assignmentNumber?: number, | ||||||
|     groupNumber?: number, |     groupNumber?: number, | ||||||
| ): Promise<void> { | ): Promise<void> { | ||||||
|     const keys = ['group', 'group-submissions', 'group-questions']; |     const keys = ["group", "group-submissions", "group-questions"]; | ||||||
|     await Promise.all( |     await Promise.all( | ||||||
|         keys.map(async (key) => { |         keys.map(async (key) => { | ||||||
|             const queryKey = [key, classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined); |             const queryKey = [key, classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined); | ||||||
|  | @ -52,7 +62,7 @@ export async function invalidateAllGroupKeys( | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     await queryClient.invalidateQueries({ |     await queryClient.invalidateQueries({ | ||||||
|         queryKey: ['groups', classid, assignmentNumber].filter((arg) => arg !== undefined), |         queryKey: ["groups", classid, assignmentNumber].filter((arg) => arg !== undefined), | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -119,9 +129,9 @@ export function useCreateGroupMutation(): UseMutationReturnType< | ||||||
|     return useMutation({ |     return useMutation({ | ||||||
|         mutationFn: async ({ cid, an, data }) => new GroupController(cid, an).createGroup(data), |         mutationFn: async ({ cid, an, data }) => new GroupController(cid, an).createGroup(data), | ||||||
|         onSuccess: async (response) => { |         onSuccess: async (response) => { | ||||||
|             const cid = typeof response.group.class === 'string' ? response.group.class : response.group.class.id; |             const cid = typeof response.group.class === "string" ? response.group.class : response.group.class.id; | ||||||
|             const an = |             const an = | ||||||
|                 typeof response.group.assignment === 'number' |                 typeof response.group.assignment === "number" | ||||||
|                     ? response.group.assignment |                     ? response.group.assignment | ||||||
|                     : response.group.assignment.id; |                     : response.group.assignment.id; | ||||||
| 
 | 
 | ||||||
|  | @ -142,9 +152,9 @@ export function useDeleteGroupMutation(): UseMutationReturnType< | ||||||
|     return useMutation({ |     return useMutation({ | ||||||
|         mutationFn: async ({ cid, an, gn }) => new GroupController(cid, an).deleteGroup(gn), |         mutationFn: async ({ cid, an, gn }) => new GroupController(cid, an).deleteGroup(gn), | ||||||
|         onSuccess: async (response) => { |         onSuccess: async (response) => { | ||||||
|             const cid = typeof response.group.class === 'string' ? response.group.class : response.group.class.id; |             const cid = typeof response.group.class === "string" ? response.group.class : response.group.class.id; | ||||||
|             const an = |             const an = | ||||||
|                 typeof response.group.assignment === 'number' |                 typeof response.group.assignment === "number" | ||||||
|                     ? response.group.assignment |                     ? response.group.assignment | ||||||
|                     : response.group.assignment.id; |                     : response.group.assignment.id; | ||||||
|             const gn = response.group.groupNumber; |             const gn = response.group.groupNumber; | ||||||
|  | @ -166,9 +176,9 @@ export function useUpdateGroupMutation(): UseMutationReturnType< | ||||||
|     return useMutation({ |     return useMutation({ | ||||||
|         mutationFn: async ({ cid, an, gn, data }) => new GroupController(cid, an).updateGroup(gn, data), |         mutationFn: async ({ cid, an, gn, data }) => new GroupController(cid, an).updateGroup(gn, data), | ||||||
|         onSuccess: async (response) => { |         onSuccess: async (response) => { | ||||||
|             const cid = typeof response.group.class === 'string' ? response.group.class : response.group.class.id; |             const cid = typeof response.group.class === "string" ? response.group.class : response.group.class.id; | ||||||
|             const an = |             const an = | ||||||
|                 typeof response.group.assignment === 'number' |                 typeof response.group.assignment === "number" | ||||||
|                     ? response.group.assignment |                     ? response.group.assignment | ||||||
|                     : response.group.assignment.id; |                     : response.group.assignment.id; | ||||||
|             const gn = response.group.groupNumber; |             const gn = response.group.groupNumber; | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| import { SubmissionController, type SubmissionResponse, type SubmissionsResponse } from '@/controllers/submissions'; | import { SubmissionController, type SubmissionResponse, type SubmissionsResponse } from "@/controllers/submissions"; | ||||||
| import type { SubmissionDTO } from '@dwengo-1/common/interfaces/submission'; | import type { SubmissionDTO } from "@dwengo-1/common/interfaces/submission"; | ||||||
| import { | import { | ||||||
|     QueryClient, |     QueryClient, | ||||||
|     useMutation, |     useMutation, | ||||||
|  | @ -7,19 +7,29 @@ import { | ||||||
|     useQueryClient, |     useQueryClient, | ||||||
|     type UseMutationReturnType, |     type UseMutationReturnType, | ||||||
|     type UseQueryReturnType, |     type UseQueryReturnType, | ||||||
| } from '@tanstack/vue-query'; | } from "@tanstack/vue-query"; | ||||||
| import { computed, toValue, type MaybeRefOrGetter } from 'vue'; | import { computed, toValue, type MaybeRefOrGetter } from "vue"; | ||||||
| 
 | 
 | ||||||
| type SubmissionsQueryKey = ['submissions', string, number, number, boolean]; | type SubmissionsQueryKey = ["submissions", string, number, number, boolean]; | ||||||
| 
 | 
 | ||||||
| function submissionsQueryKey(classid: string, assignmentNumber: number, groupNumber: number, full: boolean): SubmissionsQueryKey { | function submissionsQueryKey( | ||||||
|     return ['submissions', classid, assignmentNumber, groupNumber, full]; |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     groupNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): SubmissionsQueryKey { | ||||||
|  |     return ["submissions", classid, assignmentNumber, groupNumber, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type SubmissionQueryKey = ['submission', string, number, number, number]; | type SubmissionQueryKey = ["submission", string, number, number, number]; | ||||||
| 
 | 
 | ||||||
| function submissionQueryKey(classid: string, assignmentNumber: number, groupNumber: number, submissionNumber: number): SubmissionQueryKey { | function submissionQueryKey( | ||||||
|     return ['submission', classid, assignmentNumber, groupNumber, submissionNumber]; |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     groupNumber: number, | ||||||
|  |     submissionNumber: number, | ||||||
|  | ): SubmissionQueryKey { | ||||||
|  |     return ["submission", classid, assignmentNumber, groupNumber, submissionNumber]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function invalidateAllSubmissionKeys( | export async function invalidateAllSubmissionKeys( | ||||||
|  | @ -29,7 +39,7 @@ export async function invalidateAllSubmissionKeys( | ||||||
|     groupNumber?: number, |     groupNumber?: number, | ||||||
|     submissionNumber?: number, |     submissionNumber?: number, | ||||||
| ): Promise<void> { | ): Promise<void> { | ||||||
|     const keys = ['submission']; |     const keys = ["submission"]; | ||||||
| 
 | 
 | ||||||
|     await Promise.all( |     await Promise.all( | ||||||
|         keys.map(async (key) => { |         keys.map(async (key) => { | ||||||
|  | @ -37,17 +47,17 @@ export async function invalidateAllSubmissionKeys( | ||||||
|                 (arg) => arg !== undefined, |                 (arg) => arg !== undefined, | ||||||
|             ); |             ); | ||||||
|             return queryClient.invalidateQueries({ queryKey: queryKey }); |             return queryClient.invalidateQueries({ queryKey: queryKey }); | ||||||
|         }) |         }), | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     await queryClient.invalidateQueries({ |     await queryClient.invalidateQueries({ | ||||||
|         queryKey: ['submissions', classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined), |         queryKey: ["submissions", classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined), | ||||||
|     }); |     }); | ||||||
|     await queryClient.invalidateQueries({ |     await queryClient.invalidateQueries({ | ||||||
|         queryKey: ['group-submissions', classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined), |         queryKey: ["group-submissions", classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined), | ||||||
|     }); |     }); | ||||||
|     await queryClient.invalidateQueries({ |     await queryClient.invalidateQueries({ | ||||||
|         queryKey: ['assignment-submissions', classid, assignmentNumber].filter((arg) => arg !== undefined), |         queryKey: ["assignment-submissions", classid, assignmentNumber].filter((arg) => arg !== undefined), | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -135,8 +145,8 @@ export function useCreateSubmissionMutation(): UseMutationReturnType< | ||||||
|                 const cls = response.submission.group.class; |                 const cls = response.submission.group.class; | ||||||
|                 const assignment = response.submission.group.assignment; |                 const assignment = response.submission.group.assignment; | ||||||
| 
 | 
 | ||||||
|                 const cid = typeof cls === 'string' ? cls : cls.id; |                 const cid = typeof cls === "string" ? cls : cls.id; | ||||||
|                 const an = typeof assignment === 'number' ? assignment : assignment.id; |                 const an = typeof assignment === "number" ? assignment : assignment.id; | ||||||
|                 const gn = response.submission.group.groupNumber; |                 const gn = response.submission.group.groupNumber; | ||||||
| 
 | 
 | ||||||
|                 await invalidateAllSubmissionKeys(queryClient, cid, an, gn); |                 await invalidateAllSubmissionKeys(queryClient, cid, an, gn); | ||||||
|  | @ -162,8 +172,8 @@ export function useDeleteSubmissionMutation(): UseMutationReturnType< | ||||||
|                 const cls = response.submission.group.class; |                 const cls = response.submission.group.class; | ||||||
|                 const assignment = response.submission.group.assignment; |                 const assignment = response.submission.group.assignment; | ||||||
| 
 | 
 | ||||||
|                 const cid = typeof cls === 'string' ? cls : cls.id; |                 const cid = typeof cls === "string" ? cls : cls.id; | ||||||
|                 const an = typeof assignment === 'number' ? assignment : assignment.id; |                 const an = typeof assignment === "number" ? assignment : assignment.id; | ||||||
|                 const gn = response.submission.group.groupNumber; |                 const gn = response.submission.group.groupNumber; | ||||||
| 
 | 
 | ||||||
|                 await invalidateAllSubmissionKeys(queryClient, cid, an, gn); |                 await invalidateAllSubmissionKeys(queryClient, cid, an, gn); | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Lint Action
						Lint Action