فهرست منبع

notifications elint fixes

Olivier Massot 1 سال پیش
والد
کامیت
28f7124db2
3فایلهای تغییر یافته به همراه21 افزوده شده و 21 حذف شده
  1. 2 0
      .eslintrc.cjs
  2. 18 21
      components/Layout/Header/Notification.vue
  3. 1 0
      regex_pattern.txt

+ 2 - 0
.eslintrc.cjs

@@ -42,5 +42,7 @@ module.exports = {
     useRoute: 'readonly',
     useI18n: 'readonly',
     onMounted: 'readonly',
+    onUnmounted: 'readonly',
+    watch: 'readonly',
   },
 }

+ 18 - 21
components/Layout/Header/Notification.vue

@@ -17,8 +17,8 @@
 
   <v-menu
     v-if="btn !== null"
-    :activator="btn"
     v-model="isOpen"
+    :activator="btn"
     location="bottom left"
   >
     <v-card max-width="400">
@@ -42,8 +42,8 @@
               <v-icon
                 v-if="notification.link"
                 icon="mdi:mdi-download"
-                @click="download(notification.link)"
                 class="pt-4"
+                @click="download(notification.link)"
               />
             </template>
           </v-list-item>
@@ -72,10 +72,9 @@
           class="theme-primary"
           style="width: 100%; height: 52px"
         >
-          <v-list-item-title
-            class="text-body-2"
-            v-text="$t('all_notification')"
-          />
+          <v-list-item-title class="text-body-2">
+            <span v-text="$t('all_notification')" />
+          </v-list-item-title>
         </v-list-item>
       </v-card-actions>
     </v-card>
@@ -83,23 +82,22 @@
 </template>
 
 <script setup lang="ts">
+import { computed, ref } from 'vue'
+import type { ComputedRef, Ref } from 'vue'
+import { useRepo } from 'pinia-orm'
 import { NOTIFICATION_TYPE } from '~/types/enum/enums'
 import Notification from '~/models/Core/Notification'
 import NotificationUsers from '~/models/Core/NotificationUsers'
 import { useAccessProfileStore } from '~/stores/accessProfile'
-import { computed, ref } from '@vue/reactivity'
-import type { ComputedRef, Ref } from '@vue/reactivity'
 import { useEntityFetch } from '~/composables/data/useEntityFetch'
 import type { AnyJson, Pagination } from '~/types/data'
 import { useEntityManager } from '~/composables/data/useEntityManager'
 import UrlUtils from '~/services/utils/urlUtils'
-import { useRepo } from 'pinia-orm'
 import NotificationRepository from '~/stores/repositories/NotificationRepository'
 
 const accessProfileStore = useAccessProfileStore()
 
-const loading: Ref<Boolean> = ref(true)
-const isOpen: Ref<Boolean> = ref(false)
+const isOpen: Ref<boolean> = ref(false)
 const page: Ref<number> = ref(1)
 
 const i18n = useI18n()
@@ -115,7 +113,7 @@ const query: ComputedRef<AnyJson> = computed(() => {
   return { page: page.value }
 })
 
-let {
+const {
   data: collection,
   pending,
   refresh,
@@ -146,7 +144,7 @@ const pagination: ComputedRef<Pagination> = computed(() => {
 
 const notificationUrl = UrlUtils.join(
   runtimeConfig.baseUrlAdminLegacy,
-  '#/notifications/list/',
+  '#/notifications/list/'
 )
 
 /**
@@ -188,15 +186,14 @@ const getMessage = (notification: Notification) => {
   switch (notification.type) {
     case NOTIFICATION_TYPE.FILE:
       return `${i18n.t('your_file')} ${notification.message?.fileName} ${i18n.t(
-        'is_ready_to_be_downloaded',
+        'is_ready_to_be_downloaded'
       )}`
 
     case NOTIFICATION_TYPE.MESSAGE:
       if (notification.message?.action)
-        return `${i18n.t('your_message')} ${notification.message
-          ?.fileName} ${i18n.t('is_ready_to_be')} ${
-          notification.message.action
-        }`
+        return `${i18n.t('your_message')} ${
+          notification.message?.fileName
+        } ${i18n.t('is_ready_to_be')} ${notification.message.action}`
 
       return `${i18n.t('your_message')} ${
         notification.message?.about ?? ''
@@ -215,7 +212,7 @@ const getMessage = (notification: Notification) => {
 /**
  * Dès la fermeture du menu, on indique que les notifications non lues, le sont.
  */
-const unwatch = watch(isOpen, (newValue, oldValue) => {
+const unwatch = watch(isOpen, (newValue, _) => {
   if (!newValue) {
     markNotificationsAsRead()
   }
@@ -247,7 +244,7 @@ const markNotificationAsRead = (notification: Notification) => {
  */
 const markNotificationsAsRead = () => {
   unreadNotification.value.map((notification: Notification) => {
-    markNotificationAsRead(notification)
+    return markNotificationAsRead(notification)
   })
 }
 
@@ -270,7 +267,7 @@ const download = (link: string) => {
     'api',
     String(accessProfileStore.id),
     String(accessProfileStore.switchId || ''),
-    path,
+    path
   )
 
   window.open(url)

+ 1 - 0
regex_pattern.txt

@@ -0,0 +1 @@
+(?!typo3/).*