diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index f1741f7d..db4f52bc 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -11,8 +11,12 @@ ], "rules": { "vue/multi-word-component-names": "off", - "vue/no-reserved-component-names": "warn", - "vue/no-mutating-props": "warn" + "vue/no-mutating-props": [ + "error", + { + "shallowOnly": true + } + ] // no-undef is already included in // @vue/eslint-config-typescript }, diff --git a/frontend/src/components/settings/Themes.vue b/frontend/src/components/settings/Themes.vue index d440336c..d8c523a7 100644 --- a/frontend/src/components/settings/Themes.vue +++ b/frontend/src/components/settings/Themes.vue @@ -16,6 +16,7 @@ defineProps<{ }>(); const emit = defineEmits<{ + // eslint-disable-next-line @typescript-eslint/no-unused-vars (e: "update:theme", val: string | null): void; }>(); diff --git a/frontend/src/i18n/index.ts b/frontend/src/i18n/index.ts index c5127f47..f6ee97a6 100644 --- a/frontend/src/i18n/index.ts +++ b/frontend/src/i18n/index.ts @@ -114,17 +114,17 @@ export function detectLocale() { } // TODO: was this really necessary? -function removeEmpty(obj: Record): void { - Object.keys(obj) - .filter((k) => obj[k] !== null && obj[k] !== undefined && obj[k] !== "") // Remove undef. and null and empty.string. - .reduce( - (newObj, k) => - typeof obj[k] === "object" - ? Object.assign(newObj, { [k]: removeEmpty(obj[k]) }) // Recurse. - : Object.assign(newObj, { [k]: obj[k] }), // Copy value. - {} - ); -} +// function removeEmpty(obj: Record): void { +// Object.keys(obj) +// .filter((k) => obj[k] !== null && obj[k] !== undefined && obj[k] !== "") // Remove undef. and null and empty.string. +// .reduce( +// (newObj, k) => +// typeof obj[k] === "object" +// ? Object.assign(newObj, { [k]: removeEmpty(obj[k]) }) // Recurse. +// : Object.assign(newObj, { [k]: obj[k] }), // Copy value. +// {} +// ); +// } export const rtlLanguages = ["he", "ar"]; diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 111fa167..4766b1b1 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -12,7 +12,7 @@ import Shares from "@/views/settings/Shares.vue"; import Errors from "@/views/Errors.vue"; import { useAuthStore } from "@/stores/auth"; import { baseURL, name } from "@/utils/constants"; -import { i18n, isRtl, rtlLanguages } from "@/i18n"; +import i18n from "@/i18n"; import { recaptcha, loginPage } from "@/utils/constants"; import { login, validateLogin } from "@/utils/auth"; @@ -177,13 +177,7 @@ const router = createRouter({ }); router.beforeResolve(async (to, from, next) => { - let title; - try { - title = i18n.global.t(titles[to.name as keyof typeof titles]); - } catch (error) { - console.error(error); - } - // const title = titles[to.name]; + const title = i18n.global.t(titles[to.name as keyof typeof titles]); document.title = title + " - " + name; const authStore = useAuthStore(); diff --git a/frontend/src/stores/auth.ts b/frontend/src/stores/auth.ts index d29f2a31..459141ad 100644 --- a/frontend/src/stores/auth.ts +++ b/frontend/src/stores/auth.ts @@ -1,5 +1,5 @@ import { defineStore } from "pinia"; -import i18n, { detectLocale, setLocale } from "@/i18n"; +import { detectLocale, setLocale } from "@/i18n"; import { cloneDeep } from "lodash-es"; export const useAuthStore = defineStore("auth", { diff --git a/frontend/src/views/settings/Profile.vue b/frontend/src/views/settings/Profile.vue index 68e0cf22..590af69e 100644 --- a/frontend/src/views/settings/Profile.vue +++ b/frontend/src/views/settings/Profile.vue @@ -82,7 +82,6 @@ import { users as api } from "@/api"; import Languages from "@/components/settings/Languages.vue"; import { computed, inject, onMounted, ref } from "vue"; import { useI18n } from "vue-i18n"; -import i18n, { rtlLanguages } from "@/i18n"; const layoutStore = useLayoutStore(); const authStore = useAuthStore();