diff --git a/eslint.config.js b/eslint.config.js index 0c85068eb6..10ede1d9cf 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -52,12 +52,19 @@ module.exports = [ "no-prototype-builtins": "error", "no-empty": "error", "no-var": "error", + "no-unused-vars": "off", // disable the base rule for @typescript-eslint/no-unused-vars "prefer-const": "error", "prettier/prettier": "error", "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-require-imports": "off", "@typescript-eslint/ban-ts-comment": "error", "@typescript-eslint/no-inferrable-types": "error", + "@typescript-eslint/no-empty-object-type": [ + "error", + { allowInterfaces: "with-single-extends" }, + ], + // for now set this to warn because to much errors in catch blocks, need to decide if we want to us default option 'caughtErrors: all' for 'catch' blocks + "@typescript-eslint/no-unused-vars": "warn", "vue/no-v-text-v-html-on-component": "error", "vue/no-v-html": "error", "vue/html-self-closing": [ diff --git a/src/components/base/BaseInput/BaseInput.vue b/src/components/base/BaseInput/BaseInput.vue index 965d4ef63d..abdb6fc31c 100644 --- a/src/components/base/BaseInput/BaseInput.vue +++ b/src/components/base/BaseInput/BaseInput.vue @@ -109,7 +109,9 @@ export default { // this.$emit("input", event); }, handleBlur(event) { - this.validationModel && this.validationModel.$touch(); + if (this.validationModel) { + this.validationModel.$touch(); + } this.$emit("blur", event); }, handleFocus(event) { diff --git a/src/components/copy-result-modal/CopyResultModal.vue b/src/components/copy-result-modal/CopyResultModal.vue index 7a1652da07..a80d8477c4 100644 --- a/src/components/copy-result-modal/CopyResultModal.vue +++ b/src/components/copy-result-modal/CopyResultModal.vue @@ -212,9 +212,9 @@ export default { let found = false; items.forEach((item) => { if (found) return; - item.elements.find((e) => types.includes(e.type)) - ? (found = true) - : null; + if (item.elements.find((e) => types.includes(e.type))) { + found = true; + } }); return found; }, diff --git a/src/components/icons/material/index.ts b/src/components/icons/material/index.ts index ea97167935..4c4828536c 100644 --- a/src/components/icons/material/index.ts +++ b/src/components/icons/material/index.ts @@ -27,6 +27,7 @@ import { mdiCalendar, mdiCalendarOutline, mdiCardAccountDetailsOutline, + mdiChat, mdiChatOutline, mdiCheck, mdiCheckAll, @@ -104,6 +105,7 @@ import { mdiPalette, mdiPause, mdiPencilOutline, + mdiPhone, mdiPlay, mdiPlaylistEdit, mdiPlaySpeed, @@ -168,6 +170,7 @@ export { mdiCalendar, mdiCalendarOutline, mdiCardAccountDetailsOutline, + mdiChat, mdiChatOutline, mdiCheck, mdiCheckAll, @@ -245,6 +248,7 @@ export { mdiPalette, mdiPause, mdiPencilOutline, + mdiPhone, mdiPlay, mdiPlaylistEdit, mdiPlaySpeed, diff --git a/src/components/lern-store/LernstoreDetailView.vue b/src/components/lern-store/LernstoreDetailView.vue index 52c6a832cb..1178796fce 100644 --- a/src/components/lern-store/LernstoreDetailView.vue +++ b/src/components/lern-store/LernstoreDetailView.vue @@ -333,8 +333,8 @@ export default { this.window.height = window.innerHeight; }, goBack() { - if (window.history.length > 1) { - this.$router && this.$router.back(); + if (window.history.length > 1 && this.$router) { + this.$router.back(); } else { window.close(); } diff --git a/src/components/molecules/ApplicationErrorRouting.vue b/src/components/molecules/ApplicationErrorRouting.vue index 83e7a410e1..5cc1f2c0db 100644 --- a/src/components/molecules/ApplicationErrorRouting.vue +++ b/src/components/molecules/ApplicationErrorRouting.vue @@ -28,7 +28,9 @@ export default defineComponent({ watch( () => applicationErrorModule.getStatusCode, (to) => { - to !== null ? routeToErrorPage() : null; + if (to !== null) { + routeToErrorPage(); + } }, { immediate: true } ); diff --git a/src/components/organisms/DataTable/BackendDataTable.vue b/src/components/organisms/DataTable/BackendDataTable.vue index 81c612616f..439463b54f 100644 --- a/src/components/organisms/DataTable/BackendDataTable.vue +++ b/src/components/organisms/DataTable/BackendDataTable.vue @@ -244,9 +244,11 @@ export default { ); }, set(state) { - state - ? this.selectAllRowsOfAllPages() - : this.unselectAllRowsOfAllPages(); + if (state) { + this.selectAllRowsOfAllPages(); + } else { + this.unselectAllRowsOfAllPages(); + } }, }, currentPageSelectionState: { diff --git a/src/components/organisms/administration/ImportUsers.vue b/src/components/organisms/administration/ImportUsers.vue index 75ba31c881..91b891eba8 100644 --- a/src/components/organisms/administration/ImportUsers.vue +++ b/src/components/organisms/administration/ImportUsers.vue @@ -441,7 +441,9 @@ export default { }, watch: { dialogEdit(val) { - val || this.closeEdit(); + if (!val) { + this.closeEdit(); + } }, searchFirstName() { this.searchApi(); diff --git a/src/store/calendar.js b/src/store/calendar.js index 7d1f887a70..26e502b877 100644 --- a/src/store/calendar.js +++ b/src/store/calendar.js @@ -7,6 +7,7 @@ import { $axios } from "@/utils/api"; const calendarModule = mergeDeep(base, { actions: { removeDate: async function (ctx, payload) { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions (await $axios.delete("/v1/" + baseUrl + "/" + payload.id)).data; }, }, diff --git a/src/store/tasks.unit.ts b/src/store/tasks.unit.ts index 500a5f0e2d..a8c7278915 100644 --- a/src/store/tasks.unit.ts +++ b/src/store/tasks.unit.ts @@ -472,8 +472,9 @@ describe("task store", () => { tasksModule.courseFilter = ["Mathe"]; const spy = mockTaskFilter("byCourseNames", []); - tasksModule.openTasksForStudentIsEmpty; + const result = tasksModule.openTasksForStudentIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.courseFilter); spy.mockRestore(); @@ -483,8 +484,9 @@ describe("task store", () => { const tasksModule = new TasksModule({}); const spy = mockTaskFilter("byOpenForStudent", []); - tasksModule.openTasksForStudentIsEmpty; + const result = tasksModule.openTasksForStudentIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); spy.mockRestore(); }); @@ -538,8 +540,9 @@ describe("task store", () => { tasksModule.substituteFilter = true; const spy = mockTaskFilter("filterSubstituteForTeacher", []); - tasksModule.openTasksForTeacherIsEmpty; + const result = tasksModule.openTasksForTeacherIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.substituteFilter); spy.mockRestore(); @@ -550,8 +553,9 @@ describe("task store", () => { tasksModule.courseFilter = ["Mathe"]; const spy = mockTaskFilter("byCourseNames", []); - tasksModule.openTasksForTeacherIsEmpty; + const result = tasksModule.openTasksForTeacherIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.courseFilter); spy.mockRestore(); @@ -561,8 +565,9 @@ describe("task store", () => { const tasksModule = new TasksModule({}); const spy = mockTaskFilter("byOpenForTeacher", []); - tasksModule.openTasksForTeacherIsEmpty; + const result = tasksModule.openTasksForTeacherIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); spy.mockRestore(); }); @@ -621,8 +626,9 @@ describe("task store", () => { tasksModule.courseFilter = ["Mathe"]; const spy = mockTaskFilter("byCourseNames", []); - tasksModule.completedTasksForStudentIsEmpty; + const result = tasksModule.completedTasksForStudentIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.courseFilter); spy.mockRestore(); @@ -632,8 +638,9 @@ describe("task store", () => { const tasksModule = new TasksModule({}); const spy = mockTaskFilter("byCompletedForStudent", []); - tasksModule.completedTasksForStudentIsEmpty; + const result = tasksModule.completedTasksForStudentIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); spy.mockRestore(); }); @@ -686,8 +693,9 @@ describe("task store", () => { tasksModule.substituteFilter = true; const spy = mockTaskFilter("filterSubstituteForTeacher", []); - tasksModule.draftsForTeacherIsEmpty; + const result = tasksModule.draftsForTeacherIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.substituteFilter); spy.mockRestore(); @@ -698,8 +706,9 @@ describe("task store", () => { tasksModule.courseFilter = ["Mathe"]; const spy = mockTaskFilter("byCourseNames", []); - tasksModule.draftsForTeacherIsEmpty; + const result = tasksModule.draftsForTeacherIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.courseFilter); spy.mockRestore(); @@ -709,8 +718,9 @@ describe("task store", () => { const tasksModule = new TasksModule({}); const spy = mockTaskFilter("byDraftForTeacher", []); - tasksModule.draftsForTeacherIsEmpty; + const result = tasksModule.draftsForTeacherIsEmpty; + expect(result).toBe(false); expect(spy).toHaveBeenCalledTimes(1); spy.mockRestore(); }); @@ -769,8 +779,13 @@ describe("task store", () => { tasksModule.courseFilter = ["Mathe"]; const spy = mockTaskFilter("byCourseNames", []); - tasksModule.getOpenTasksForStudent; + const result = tasksModule.getOpenTasksForStudent; + expect(result).toEqual({ + overdue: [], + noDueDate: [], + withDueDate: [], + }); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.courseFilter); spy.mockRestore(); @@ -780,8 +795,13 @@ describe("task store", () => { const tasksModule = new TasksModule({}); const spy = mockTaskFilter("byOpenForStudent", []); - tasksModule.getOpenTasksForStudent; + const result = tasksModule.getOpenTasksForStudent; + expect(result).toEqual({ + overdue: [], + noDueDate: [], + withDueDate: [], + }); expect(spy).toHaveBeenCalledTimes(1); spy.mockRestore(); }); @@ -814,7 +834,12 @@ describe("task store", () => { tasksModule.courseFilter = ["Mathe"]; const spy = mockTaskFilter("byCourseNames", []); - tasksModule.getCompletedTasksForStudent; + const result = tasksModule.getCompletedTasksForStudent; + + expect(result).toEqual({ + submitted: [], + graded: [], + }); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.courseFilter); @@ -845,8 +870,13 @@ describe("task store", () => { tasksModule.substituteFilter = true; const spy = mockTaskFilter("filterSubstituteForTeacher", []); - tasksModule.getOpenTasksForTeacher; + const result = tasksModule.getOpenTasksForTeacher; + expect(result).toEqual({ + overdue: [], + noDueDate: [], + withDueDate: [], + }); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.substituteFilter); spy.mockRestore(); @@ -857,8 +887,13 @@ describe("task store", () => { tasksModule.courseFilter = ["Mathe"]; const spy = mockTaskFilter("byCourseNames", []); - tasksModule.getOpenTasksForTeacher; + const result = tasksModule.getOpenTasksForTeacher; + expect(result).toEqual({ + overdue: [], + noDueDate: [], + withDueDate: [], + }); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.courseFilter); spy.mockRestore(); @@ -868,8 +903,13 @@ describe("task store", () => { const tasksModule = new TasksModule({}); const spy = mockTaskFilter("byOpenForTeacher", []); - tasksModule.getOpenTasksForTeacher; + const result = tasksModule.getOpenTasksForTeacher; + expect(result).toEqual({ + overdue: [], + noDueDate: [], + withDueDate: [], + }); expect(spy).toHaveBeenCalledTimes(1); spy.mockRestore(); }); @@ -902,8 +942,9 @@ describe("task store", () => { tasksModule.substituteFilter = true; const spy = mockTaskFilter("filterSubstituteForTeacher", []); - tasksModule.getDraftTasksForTeacher; + const result = tasksModule.getDraftTasksForTeacher; + expect(result).toEqual([]); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.substituteFilter); spy.mockRestore(); @@ -914,8 +955,9 @@ describe("task store", () => { tasksModule.courseFilter = ["Mathe"]; const spy = mockTaskFilter("byCourseNames", []); - tasksModule.getDraftTasksForTeacher; + const result = tasksModule.getDraftTasksForTeacher; + expect(result).toEqual([]); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledWith(tasksModule.courseFilter); spy.mockRestore(); @@ -925,8 +967,9 @@ describe("task store", () => { const tasksModule = new TasksModule({}); const spy = mockTaskFilter("byDraftForTeacher", []); - tasksModule.getDraftTasksForTeacher; + const result = tasksModule.getDraftTasksForTeacher; + expect(result).toEqual([]); expect(spy).toHaveBeenCalledTimes(1); spy.mockRestore(); }); diff --git a/src/themes/brb/components/templates/impressum.vue b/src/themes/brb/components/templates/impressum.vue index 4bc39d8403..78bd6e3c85 100644 --- a/src/themes/brb/components/templates/impressum.vue +++ b/src/themes/brb/components/templates/impressum.vue @@ -206,7 +206,6 @@ import { mdiChat, mdiEmailOutline, mdiPhone } from "@icons/material"; import { defineComponent } from "vue"; -// eslint-disable-next-line vue/require-direct-export export default defineComponent({ setup() { return {