From d99ff6653d05db9e632b267251bb8e66916e1de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Tue, 2 Mar 2021 14:26:37 +0100 Subject: [PATCH] lint fix --- packages/client/src/store/notification.js | 47 +++++++++++++---------- packages/client/src/utils/transition.js | 4 +- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/packages/client/src/store/notification.js b/packages/client/src/store/notification.js index b3a8ffefc3..d69a39080e 100644 --- a/packages/client/src/store/notification.js +++ b/packages/client/src/store/notification.js @@ -3,29 +3,29 @@ import { writable } from "svelte/store" const NOTIFICATION_TIMEOUT = 3000 const createNotificationStore = () => { - const timeoutIds = new Set(); + const timeoutIds = new Set() const _notifications = writable([], () => { - return () => { - // clear all the timers - timeoutIds.forEach(timeoutId => { - clearTimeout(timeoutId); - }); - _notifications.set([]); - } - }); + return () => { + // clear all the timers + timeoutIds.forEach(timeoutId => { + clearTimeout(timeoutId) + }) + _notifications.set([]) + } + }) const send = (message, type = "default") => { - let _id = id(); + let _id = id() _notifications.update(state => { return [...state, { id: _id, type, message }] - }); - const timeoutId = setTimeout(() => { - _notifications.update(state => { - return state.filter(({ id }) => id !== _id); - }); - }, NOTIFICATION_TIMEOUT); - timeoutIds.add(timeoutId); - } + }) + const timeoutId = setTimeout(() => { + _notifications.update(state => { + return state.filter(({ id }) => id !== _id) + }) + }, NOTIFICATION_TIMEOUT) + timeoutIds.add(timeoutId) + } const { subscribe } = _notifications @@ -40,7 +40,12 @@ const createNotificationStore = () => { } function id() { - return '_' + Math.random().toString(36).substr(2, 9); -}; + return ( + "_" + + Math.random() + .toString(36) + .substr(2, 9) + ) +} -export const notificationStore = createNotificationStore() \ No newline at end of file +export const notificationStore = createNotificationStore() diff --git a/packages/client/src/utils/transition.js b/packages/client/src/utils/transition.js index d0e1489c96..3814c1fc65 100644 --- a/packages/client/src/utils/transition.js +++ b/packages/client/src/utils/transition.js @@ -11,6 +11,6 @@ const transitions = new Map([ ]) export default function transition(node, { type, options = {} }) { - const { tn, opt } = transitions.get(type) || { tn: () => {}, opt: {}} + const { tn, opt } = transitions.get(type) || { tn: () => {}, opt: {} } return tn(node, { ...opt, ...options }) -} \ No newline at end of file +}