Skip to content

Commit

Permalink
fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NFriedo committed Oct 7, 2024
1 parent 3ec3885 commit 6399785
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 31 deletions.
7 changes: 7 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
4 changes: 3 additions & 1 deletion src/components/base/BaseInput/BaseInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/copy-result-modal/CopyResultModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down
4 changes: 4 additions & 0 deletions src/components/icons/material/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
mdiCalendar,
mdiCalendarOutline,
mdiCardAccountDetailsOutline,
mdiChat,
mdiChatOutline,
mdiCheck,
mdiCheckAll,
Expand Down Expand Up @@ -104,6 +105,7 @@ import {
mdiPalette,
mdiPause,
mdiPencilOutline,
mdiPhone,
mdiPlay,
mdiPlaylistEdit,
mdiPlaySpeed,
Expand Down Expand Up @@ -168,6 +170,7 @@ export {
mdiCalendar,
mdiCalendarOutline,
mdiCardAccountDetailsOutline,
mdiChat,
mdiChatOutline,
mdiCheck,
mdiCheckAll,
Expand Down Expand Up @@ -245,6 +248,7 @@ export {
mdiPalette,
mdiPause,
mdiPencilOutline,
mdiPhone,
mdiPlay,
mdiPlaylistEdit,
mdiPlaySpeed,
Expand Down
4 changes: 2 additions & 2 deletions src/components/lern-store/LernstoreDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/molecules/ApplicationErrorRouting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default defineComponent({
watch(
() => applicationErrorModule.getStatusCode,
(to) => {
to !== null ? routeToErrorPage() : null;
if (to !== null) {
routeToErrorPage();
}
},
{ immediate: true }
);
Expand Down
8 changes: 5 additions & 3 deletions src/components/organisms/DataTable/BackendDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,11 @@ export default {
);
},
set(state) {
state
? this.selectAllRowsOfAllPages()
: this.unselectAllRowsOfAllPages();
if (state) {
this.selectAllRowsOfAllPages();
} else {
this.unselectAllRowsOfAllPages();
}
},
},
currentPageSelectionState: {
Expand Down
4 changes: 3 additions & 1 deletion src/components/organisms/administration/ImportUsers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ export default {
},
watch: {
dialogEdit(val) {
val || this.closeEdit();
if (!val) {
this.closeEdit();
}
},
searchFirstName() {
this.searchApi();
Expand Down
1 change: 1 addition & 0 deletions src/store/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
},
Expand Down
81 changes: 62 additions & 19 deletions src/store/tasks.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
});
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
});
Expand Down Expand Up @@ -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();
Expand All @@ -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();
});
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
});
Expand Down Expand Up @@ -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();
Expand All @@ -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();
});
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
});
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
});
Expand Down
1 change: 0 additions & 1 deletion src/themes/brb/components/templates/impressum.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6399785

Please sign in to comment.