From d2ef68d65e74dfe7e6cec2d3c4f867145665592c Mon Sep 17 00:00:00 2001 From: gusrb3164 Date: Sun, 3 Apr 2022 00:12:11 +0900 Subject: [PATCH] style: fix code style by eslint --- src/AlertContainer.tsx | 11 ++++++----- src/Icon.tsx | 10 +++++----- src/alert.ts | 6 +++--- src/index.ts | 6 +++--- src/type.ts | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/AlertContainer.tsx b/src/AlertContainer.tsx index 5e0e9a8..3ab039d 100644 --- a/src/AlertContainer.tsx +++ b/src/AlertContainer.tsx @@ -1,6 +1,7 @@ -import React, { CSSProperties, useCallback, useEffect, useState } from 'react'; -import Icon from './Icon'; -import { AlertDetail } from './type'; +import React, { useCallback, useEffect, useState } from "react"; +import type { CSSProperties } from "react"; +import Icon from "./Icon"; +import type { AlertDetail } from "./type"; interface Props { floatingTime?: number; @@ -20,10 +21,10 @@ export const AlertContainer: React.VFC = ({ floatingTime = 3000, alertSty }, []); useEffect(() => { - window.addEventListener('toastAlert', handler as any); + window.addEventListener("toastAlert", handler as any); return () => { - window.removeEventListener('toastAlert', handler as any); + window.removeEventListener("toastAlert", handler as any); }; }, []); diff --git a/src/Icon.tsx b/src/Icon.tsx index 5220451..655dac4 100644 --- a/src/Icon.tsx +++ b/src/Icon.tsx @@ -1,13 +1,13 @@ -import React from 'react'; -import { AlertType } from './type'; +import React from "react"; +import type { AlertType } from "./type"; const Icon: React.VFC<{ type: AlertType }> = ({ type }) => { switch (type) { - case 'success': + case "success": return ; - case 'warning': + case "warning": return ; - case 'error': + case "error": return ; default: return ; diff --git a/src/alert.ts b/src/alert.ts index 8b4cb45..626636b 100644 --- a/src/alert.ts +++ b/src/alert.ts @@ -1,9 +1,9 @@ -import { AlertDetail } from './type'; +import type { AlertDetail } from "./type"; export const alert = (detail: AlertDetail) => { window.dispatchEvent( - new CustomEvent('toastAlert', { + new CustomEvent("toastAlert", { detail, - }), + }) ); }; diff --git a/src/index.ts b/src/index.ts index 40dd9d5..67e4945 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ -export { AlertContainer } from './AlertContainer'; -export { alert } from './alert'; -export { AlertType, AlertDetail } from './type'; +export { AlertContainer } from "./AlertContainer"; +export { alert } from "./alert"; +export type { AlertType, AlertDetail } from "./type"; diff --git a/src/type.ts b/src/type.ts index c1e793b..450b895 100644 --- a/src/type.ts +++ b/src/type.ts @@ -1,2 +1,2 @@ -export type AlertType = 'success' | 'warning' | 'error' | 'info'; +export type AlertType = "success" | "warning" | "error" | "info"; export type AlertDetail = { message: string; type: AlertType };