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 { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
||||
import pluginVitest from '@vitest/eslint-plugin';
|
||||
import pluginPlaywright from 'eslint-plugin-playwright';
|
||||
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
||||
import rootConfig from '../eslint.config';
|
||||
import pluginVue from "eslint-plugin-vue";
|
||||
import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript";
|
||||
import pluginVitest from "@vitest/eslint-plugin";
|
||||
import pluginPlaywright from "eslint-plugin-playwright";
|
||||
import skipFormatting from "@vue/eslint-config-prettier/skip-formatting";
|
||||
import rootConfig from "../eslint.config";
|
||||
|
||||
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
||||
// Import { configureVueProject } from '@vue/eslint-config-typescript'
|
||||
|
@ -12,29 +12,36 @@ import rootConfig from '../eslint.config';
|
|||
|
||||
const vueConfig = defineConfigWithVueTs(
|
||||
{
|
||||
name: 'app/files-to-lint',
|
||||
files: ['**/*.{ts,mts,tsx,vue}'],
|
||||
name: "app/files-to-lint",
|
||||
files: ["**/*.{ts,mts,tsx,vue}"],
|
||||
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',
|
||||
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**', 'prettier.config.js', '**/test-results/**', '**/playwright-report/**'],
|
||||
name: "app/files-to-ignore",
|
||||
ignores: [
|
||||
"**/dist/**",
|
||||
"**/dist-ssr/**",
|
||||
"**/coverage/**",
|
||||
"prettier.config.js",
|
||||
"**/test-results/**",
|
||||
"**/playwright-report/**",
|
||||
],
|
||||
},
|
||||
|
||||
pluginVue.configs['flat/essential'],
|
||||
pluginVue.configs["flat/essential"],
|
||||
vueTsConfigs.recommended,
|
||||
|
||||
{
|
||||
...pluginVitest.configs.recommended,
|
||||
files: ['src/**/__tests__/*'],
|
||||
files: ["src/**/__tests__/*"],
|
||||
},
|
||||
|
||||
{
|
||||
...pluginPlaywright.configs['flat/recommended'],
|
||||
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
|
||||
...pluginPlaywright.configs["flat/recommended"],
|
||||
files: ["e2e/**/*.{test,spec}.{js,ts,jsx,tsx}"],
|
||||
},
|
||||
skipFormatting,
|
||||
);
|
||||
|
|
|
@ -29,13 +29,21 @@ function assignmentQueryKey(classid: string, assignmentNumber: number): Assignme
|
|||
|
||||
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];
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
|
@ -50,7 +58,7 @@ export async function invalidateAllAssignmentKeys(
|
|||
keys.map(async (key) => {
|
||||
const queryKey = [key, classid, assignmentNumber].filter((arg) => arg !== undefined);
|
||||
return queryClient.invalidateQueries({ queryKey: queryKey });
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
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) => {
|
||||
const queryKey = [key, classid].filter((arg) => arg !== undefined);
|
||||
return queryClient.invalidateQueries({ queryKey: queryKey });
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
await queryClient.invalidateQueries({ queryKey: ["classes"] });
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GroupController, type GroupResponse, type GroupsResponse } from '@/controllers/groups';
|
||||
import type { QuestionsResponse } from '@/controllers/questions';
|
||||
import type { SubmissionsResponse } from '@/controllers/submissions';
|
||||
import type { GroupDTO } from '@dwengo-1/common/interfaces/group';
|
||||
import { GroupController, type GroupResponse, type GroupsResponse } from "@/controllers/groups";
|
||||
import type { QuestionsResponse } from "@/controllers/questions";
|
||||
import type { SubmissionsResponse } from "@/controllers/submissions";
|
||||
import type { GroupDTO } from "@dwengo-1/common/interfaces/group";
|
||||
import {
|
||||
QueryClient,
|
||||
useMutation,
|
||||
|
@ -9,32 +9,42 @@ import {
|
|||
useQuery,
|
||||
useQueryClient,
|
||||
type UseQueryReturnType,
|
||||
} from '@tanstack/vue-query';
|
||||
import { computed, type MaybeRefOrGetter, toValue } from 'vue';
|
||||
import { invalidateAllSubmissionKeys } from './submissions';
|
||||
} from "@tanstack/vue-query";
|
||||
import { computed, type MaybeRefOrGetter, toValue } from "vue";
|
||||
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 {
|
||||
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 {
|
||||
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 {
|
||||
return ['group-submissions', classid, assignmentNumber, groupNumber, full];
|
||||
function groupSubmissionsQueryKey(
|
||||
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 {
|
||||
return ['group-questions', classid, assignmentNumber, groupNumber, full];
|
||||
function groupQuestionsQueryKey(
|
||||
classid: string,
|
||||
assignmentNumber: number,
|
||||
groupNumber: number,
|
||||
full: boolean,
|
||||
): GroupQuestionsQueryKey {
|
||||
return ["group-questions", classid, assignmentNumber, groupNumber, full];
|
||||
}
|
||||
|
||||
export async function invalidateAllGroupKeys(
|
||||
|
@ -43,7 +53,7 @@ export async function invalidateAllGroupKeys(
|
|||
assignmentNumber?: number,
|
||||
groupNumber?: number,
|
||||
): Promise<void> {
|
||||
const keys = ['group', 'group-submissions', 'group-questions'];
|
||||
const keys = ["group", "group-submissions", "group-questions"];
|
||||
await Promise.all(
|
||||
keys.map(async (key) => {
|
||||
const queryKey = [key, classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined);
|
||||
|
@ -52,7 +62,7 @@ export async function invalidateAllGroupKeys(
|
|||
);
|
||||
|
||||
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({
|
||||
mutationFn: async ({ cid, an, data }) => new GroupController(cid, an).createGroup(data),
|
||||
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 =
|
||||
typeof response.group.assignment === 'number'
|
||||
typeof response.group.assignment === "number"
|
||||
? response.group.assignment
|
||||
: response.group.assignment.id;
|
||||
|
||||
|
@ -142,9 +152,9 @@ export function useDeleteGroupMutation(): UseMutationReturnType<
|
|||
return useMutation({
|
||||
mutationFn: async ({ cid, an, gn }) => new GroupController(cid, an).deleteGroup(gn),
|
||||
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 =
|
||||
typeof response.group.assignment === 'number'
|
||||
typeof response.group.assignment === "number"
|
||||
? response.group.assignment
|
||||
: response.group.assignment.id;
|
||||
const gn = response.group.groupNumber;
|
||||
|
@ -166,9 +176,9 @@ export function useUpdateGroupMutation(): UseMutationReturnType<
|
|||
return useMutation({
|
||||
mutationFn: async ({ cid, an, gn, data }) => new GroupController(cid, an).updateGroup(gn, data),
|
||||
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 =
|
||||
typeof response.group.assignment === 'number'
|
||||
typeof response.group.assignment === "number"
|
||||
? response.group.assignment
|
||||
: response.group.assignment.id;
|
||||
const gn = response.group.groupNumber;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { SubmissionController, type SubmissionResponse, type SubmissionsResponse } from '@/controllers/submissions';
|
||||
import type { SubmissionDTO } from '@dwengo-1/common/interfaces/submission';
|
||||
import { SubmissionController, type SubmissionResponse, type SubmissionsResponse } from "@/controllers/submissions";
|
||||
import type { SubmissionDTO } from "@dwengo-1/common/interfaces/submission";
|
||||
import {
|
||||
QueryClient,
|
||||
useMutation,
|
||||
|
@ -7,19 +7,29 @@ import {
|
|||
useQueryClient,
|
||||
type UseMutationReturnType,
|
||||
type UseQueryReturnType,
|
||||
} from '@tanstack/vue-query';
|
||||
import { computed, toValue, type MaybeRefOrGetter } from 'vue';
|
||||
} from "@tanstack/vue-query";
|
||||
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 {
|
||||
return ['submissions', classid, assignmentNumber, groupNumber, full];
|
||||
function submissionsQueryKey(
|
||||
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 {
|
||||
return ['submission', classid, assignmentNumber, groupNumber, submissionNumber];
|
||||
function submissionQueryKey(
|
||||
classid: string,
|
||||
assignmentNumber: number,
|
||||
groupNumber: number,
|
||||
submissionNumber: number,
|
||||
): SubmissionQueryKey {
|
||||
return ["submission", classid, assignmentNumber, groupNumber, submissionNumber];
|
||||
}
|
||||
|
||||
export async function invalidateAllSubmissionKeys(
|
||||
|
@ -29,7 +39,7 @@ export async function invalidateAllSubmissionKeys(
|
|||
groupNumber?: number,
|
||||
submissionNumber?: number,
|
||||
): Promise<void> {
|
||||
const keys = ['submission'];
|
||||
const keys = ["submission"];
|
||||
|
||||
await Promise.all(
|
||||
keys.map(async (key) => {
|
||||
|
@ -37,17 +47,17 @@ export async function invalidateAllSubmissionKeys(
|
|||
(arg) => arg !== undefined,
|
||||
);
|
||||
return queryClient.invalidateQueries({ queryKey: queryKey });
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ['submissions', classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined),
|
||||
queryKey: ["submissions", classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined),
|
||||
});
|
||||
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({
|
||||
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 assignment = response.submission.group.assignment;
|
||||
|
||||
const cid = typeof cls === 'string' ? cls : cls.id;
|
||||
const an = typeof assignment === 'number' ? assignment : assignment.id;
|
||||
const cid = typeof cls === "string" ? cls : cls.id;
|
||||
const an = typeof assignment === "number" ? assignment : assignment.id;
|
||||
const gn = response.submission.group.groupNumber;
|
||||
|
||||
await invalidateAllSubmissionKeys(queryClient, cid, an, gn);
|
||||
|
@ -162,8 +172,8 @@ export function useDeleteSubmissionMutation(): UseMutationReturnType<
|
|||
const cls = response.submission.group.class;
|
||||
const assignment = response.submission.group.assignment;
|
||||
|
||||
const cid = typeof cls === 'string' ? cls : cls.id;
|
||||
const an = typeof assignment === 'number' ? assignment : assignment.id;
|
||||
const cid = typeof cls === "string" ? cls : cls.id;
|
||||
const an = typeof assignment === "number" ? assignment : assignment.id;
|
||||
const gn = response.submission.group.groupNumber;
|
||||
|
||||
await invalidateAllSubmissionKeys(queryClient, cid, an, gn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue