From 318cc29cb4671671a3abbb57673aaa39512d9ea8 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Fri, 18 Oct 2024 11:42:32 +0100 Subject: [PATCH] fix(widget): eslint imports order --- widget/.eslintrc.json | 3 ++- widget/src/components/ChatHeader.tsx | 3 ++- widget/src/components/ChatWindow.tsx | 5 +++-- widget/src/components/ConnectionLost.tsx | 5 +++-- widget/src/components/Launcher.tsx | 7 ++++--- widget/src/components/Message.tsx | 7 ++++--- widget/src/components/MessageStatus.tsx | 3 ++- widget/src/components/Messages.tsx | 7 ++++--- widget/src/components/UserInput.tsx | 13 +++++++------ widget/src/components/Webview.tsx | 3 ++- .../src/components/messages/CarouselMessage.tsx | 17 +++++++++-------- widget/src/components/messages/ListMessage.tsx | 3 ++- widget/src/providers/ChatProvider.tsx | 9 +++++---- widget/src/providers/ColorProvider.tsx | 3 ++- widget/src/providers/SettingsProvider.tsx | 3 ++- widget/src/providers/SocketProvider.tsx | 3 ++- widget/src/providers/TranslationProvider.tsx | 3 ++- 17 files changed, 57 insertions(+), 40 deletions(-) diff --git a/widget/.eslintrc.json b/widget/.eslintrc.json index 4421550..8bb6ee1 100644 --- a/widget/.eslintrc.json +++ b/widget/.eslintrc.json @@ -24,7 +24,8 @@ "unknown", // <- unknown "index", // <- index imports "internal", // <- Absolute imports - ["sibling", "parent"] // <- Relative imports, the sibling and parent types they can be mingled together + "parent", // <- Relative imports, the sibling and parent types they can be mingled together + "sibling" ], "newlines-between": "always", "alphabetize": { diff --git a/widget/src/components/ChatHeader.tsx b/widget/src/components/ChatHeader.tsx index dfccae5..d2c5a56 100644 --- a/widget/src/components/ChatHeader.tsx +++ b/widget/src/components/ChatHeader.tsx @@ -8,10 +8,11 @@ import { FC, PropsWithChildren } from 'react'; -import CloseIcon from './icons/CloseIcon'; import { useColors } from '../providers/ColorProvider'; import { useSettings } from '../providers/SettingsProvider'; import { useWidget } from '../providers/WidgetProvider'; + +import CloseIcon from './icons/CloseIcon'; import './ChatHeader.scss'; type ChatHeaderProps = PropsWithChildren; diff --git a/widget/src/components/ChatWindow.tsx b/widget/src/components/ChatWindow.tsx index ebad95d..4d7e529 100644 --- a/widget/src/components/ChatWindow.tsx +++ b/widget/src/components/ChatWindow.tsx @@ -8,13 +8,14 @@ import React, { PropsWithChildren } from 'react'; +import { useChat } from '../providers/ChatProvider'; +import { useWidget } from '../providers/WidgetProvider'; + import ChatHeader from './ChatHeader'; import ConnectionLost from './ConnectionLost'; import Messages from './Messages'; import UserInput from './UserInput'; import Webview from './Webview'; -import { useChat } from '../providers/ChatProvider'; -import { useWidget } from '../providers/WidgetProvider'; import './ChatWindow.scss'; type ChatWindowProps = PropsWithChildren<{ diff --git a/widget/src/components/ConnectionLost.tsx b/widget/src/components/ConnectionLost.tsx index e74cf04..48560e8 100644 --- a/widget/src/components/ConnectionLost.tsx +++ b/widget/src/components/ConnectionLost.tsx @@ -8,11 +8,12 @@ import React from 'react'; -import ConnectionIcon from './icons/ConnectionIcon'; -import LoadingIcon from './icons/LoadingIcon'; import { useTranslation } from '../hooks/useTranslation'; import { useChat } from '../providers/ChatProvider'; import { useColors } from '../providers/ColorProvider'; + +import ConnectionIcon from './icons/ConnectionIcon'; +import LoadingIcon from './icons/LoadingIcon'; import './ConnectionLost.scss'; const ConnectionLost: React.FC = () => { diff --git a/widget/src/components/Launcher.tsx b/widget/src/components/Launcher.tsx index e85cf5d..ad637b1 100644 --- a/widget/src/components/Launcher.tsx +++ b/widget/src/components/Launcher.tsx @@ -8,13 +8,14 @@ import React, { PropsWithChildren } from 'react'; -import ChatWindow from './ChatWindow'; -import CloseIcon from './icons/CloseIcon'; -import OpenIcon from './icons/OpenIcon'; import { useChat } from '../providers/ChatProvider'; import { useColors } from '../providers/ColorProvider'; import { useSocketLifecycle } from '../providers/SocketProvider'; import { useWidget, WidgetContextType } from '../providers/WidgetProvider'; + +import ChatWindow from './ChatWindow'; +import CloseIcon from './icons/CloseIcon'; +import OpenIcon from './icons/OpenIcon'; import './Launcher.scss'; type LauncherProps = PropsWithChildren<{ diff --git a/widget/src/components/Message.tsx b/widget/src/components/Message.tsx index 1ea4ea0..e05d59e 100644 --- a/widget/src/components/Message.tsx +++ b/widget/src/components/Message.tsx @@ -12,6 +12,10 @@ import 'dayjs/locale/fr'; import relativeTime from 'dayjs/plugin/relativeTime'; import React, { PropsWithChildren, useState } from 'react'; +import { useChat } from '../providers/ChatProvider'; +import { useColors } from '../providers/ColorProvider'; +import { TMessage } from '../types/message.types'; + import ChatIcon from './icons/ChatIcon'; import ButtonsMessage from './messages/ButtonMessage'; import CarouselMessage from './messages/CarouselMessage'; @@ -20,9 +24,6 @@ import GeolocationMessage from './messages/GeolocationMessage'; import ListMessage from './messages/ListMessage'; import TextMessage from './messages/TextMessage'; import MessageStatus from './MessageStatus'; -import { useChat } from '../providers/ChatProvider'; -import { useColors } from '../providers/ColorProvider'; -import { TMessage } from '../types/message.types'; import './Message.scss'; dayjs.extend(relativeTime); diff --git a/widget/src/components/MessageStatus.tsx b/widget/src/components/MessageStatus.tsx index a3967ec..c20a7e0 100644 --- a/widget/src/components/MessageStatus.tsx +++ b/widget/src/components/MessageStatus.tsx @@ -8,9 +8,10 @@ import React from 'react'; -import CheckIcon from './icons/CheckIcon'; import { useColors } from '../providers/ColorProvider'; import { TMessage } from '../types/message.types'; + +import CheckIcon from './icons/CheckIcon'; import './MessageStatus.scss'; interface MessageStatusProps { diff --git a/widget/src/components/Messages.tsx b/widget/src/components/Messages.tsx index cc87599..8cc36b0 100644 --- a/widget/src/components/Messages.tsx +++ b/widget/src/components/Messages.tsx @@ -8,14 +8,15 @@ import React, { PropsWithChildren, useEffect, useRef, useState } from "react"; -import Message from "./Message"; -import TypingMessage from "./messages/TypingMessage"; import { useChat } from "../providers/ChatProvider"; import { useColors } from "../providers/ColorProvider"; import { useWidget } from "../providers/WidgetProvider"; -import "./Messages.scss"; import { TMessage } from "../types/message.types"; +import Message from "./Message"; +import "./Messages.scss"; +import TypingMessage from "./messages/TypingMessage"; + type MessagesProps = PropsWithChildren<{ Avatar?: () => JSX.Element; }>; diff --git a/widget/src/components/UserInput.tsx b/widget/src/components/UserInput.tsx index 12f4055..f42d368 100644 --- a/widget/src/components/UserInput.tsx +++ b/widget/src/components/UserInput.tsx @@ -8,6 +8,13 @@ import React, { useEffect, useRef, useState } from 'react'; +import { useTranslation } from '../hooks/useTranslation'; +import { useChat } from '../providers/ChatProvider'; +import { useColors } from '../providers/ColorProvider'; +import { useSettings } from '../providers/SettingsProvider'; +import { TOutgoingMessageType } from '../types/message.types'; +import { OutgoingMessageState } from '../types/state.types'; + import EmojiButton from './buttons/EmojiButton'; import FileButton from './buttons/FileButton'; import LocationButton from './buttons/LocationButton'; @@ -16,12 +23,6 @@ import SendButton from './buttons/SendButton'; import CloseIcon from './icons/CloseIcon'; import FileInputIcon from './icons/FileInputIcon'; import Suggestions from './Suggestions'; -import { useTranslation } from '../hooks/useTranslation'; -import { useChat } from '../providers/ChatProvider'; -import { useColors } from '../providers/ColorProvider'; -import { useSettings } from '../providers/SettingsProvider'; -import { TOutgoingMessageType } from '../types/message.types'; -import { OutgoingMessageState } from '../types/state.types'; import './UserInput.scss'; diff --git a/widget/src/components/Webview.tsx b/widget/src/components/Webview.tsx index ddc815e..85ebce0 100644 --- a/widget/src/components/Webview.tsx +++ b/widget/src/components/Webview.tsx @@ -8,10 +8,11 @@ import React, { useEffect, useState } from 'react'; -import BackIcon from './icons/BackIcon'; import { useTranslation } from '../hooks/useTranslation'; import { useChat } from '../providers/ChatProvider'; import { useColors } from '../providers/ColorProvider'; + +import BackIcon from './icons/BackIcon'; import './Webview.scss'; const Webview: React.FC = () => { diff --git a/widget/src/components/messages/CarouselMessage.tsx b/widget/src/components/messages/CarouselMessage.tsx index e2489b9..a2953e0 100644 --- a/widget/src/components/messages/CarouselMessage.tsx +++ b/widget/src/components/messages/CarouselMessage.tsx @@ -6,13 +6,14 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ -import React, { useState } from 'react'; +import React, { useState } from "react"; -import ButtonsMessage from './ButtonMessage'; -import { useColors } from '../../providers/ColorProvider'; -import { TButton, Direction, TMessage } from '../../types/message.types'; -import './CarouselMessage.scss'; -import { processContent } from '../../utils/text'; +import { useColors } from "../../providers/ColorProvider"; +import { Direction, TButton, TMessage } from "../../types/message.types"; +import { processContent } from "../../utils/text"; + +import ButtonsMessage from "./ButtonMessage"; +import "./CarouselMessage.scss"; interface Element { title: string; @@ -73,13 +74,13 @@ const CarouselMessage: React.FC = ({ const items = messageCarousel.data.elements; const goToPrevious = () => { setActiveIndex( - (prevIndex) => (prevIndex + items.length - 1) % items.length, + (prevIndex) => (prevIndex + items.length - 1) % items.length ); }; const goToNext = () => { setActiveIndex((prevIndex) => (prevIndex + 1) % items.length); }; - const colors = allColors[messageCarousel.direction || 'received']; + const colors = allColors[messageCarousel.direction || "received"]; return (