Merge pull request #239 from Hexastack/238-issue-widget-imports-order

fix(widget): eslint imports order
This commit is contained in:
Med Marrouchi 2024-10-18 18:29:44 +01:00 committed by GitHub
commit 08b1deae50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 57 additions and 40 deletions

View File

@ -24,7 +24,8 @@
"unknown", // <- unknown "unknown", // <- unknown
"index", // <- index imports "index", // <- index imports
"internal", // <- Absolute 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", "newlines-between": "always",
"alphabetize": { "alphabetize": {

View File

@ -8,10 +8,11 @@
import { FC, PropsWithChildren } from 'react'; import { FC, PropsWithChildren } from 'react';
import CloseIcon from './icons/CloseIcon';
import { useColors } from '../providers/ColorProvider'; import { useColors } from '../providers/ColorProvider';
import { useSettings } from '../providers/SettingsProvider'; import { useSettings } from '../providers/SettingsProvider';
import { useWidget } from '../providers/WidgetProvider'; import { useWidget } from '../providers/WidgetProvider';
import CloseIcon from './icons/CloseIcon';
import './ChatHeader.scss'; import './ChatHeader.scss';
type ChatHeaderProps = PropsWithChildren; type ChatHeaderProps = PropsWithChildren;

View File

@ -8,13 +8,14 @@
import React, { PropsWithChildren } from 'react'; import React, { PropsWithChildren } from 'react';
import { useChat } from '../providers/ChatProvider';
import { useWidget } from '../providers/WidgetProvider';
import ChatHeader from './ChatHeader'; import ChatHeader from './ChatHeader';
import ConnectionLost from './ConnectionLost'; import ConnectionLost from './ConnectionLost';
import Messages from './Messages'; import Messages from './Messages';
import UserInput from './UserInput'; import UserInput from './UserInput';
import Webview from './Webview'; import Webview from './Webview';
import { useChat } from '../providers/ChatProvider';
import { useWidget } from '../providers/WidgetProvider';
import './ChatWindow.scss'; import './ChatWindow.scss';
type ChatWindowProps = PropsWithChildren<{ type ChatWindowProps = PropsWithChildren<{

View File

@ -8,11 +8,12 @@
import React from 'react'; import React from 'react';
import ConnectionIcon from './icons/ConnectionIcon';
import LoadingIcon from './icons/LoadingIcon';
import { useTranslation } from '../hooks/useTranslation'; import { useTranslation } from '../hooks/useTranslation';
import { useChat } from '../providers/ChatProvider'; import { useChat } from '../providers/ChatProvider';
import { useColors } from '../providers/ColorProvider'; import { useColors } from '../providers/ColorProvider';
import ConnectionIcon from './icons/ConnectionIcon';
import LoadingIcon from './icons/LoadingIcon';
import './ConnectionLost.scss'; import './ConnectionLost.scss';
const ConnectionLost: React.FC = () => { const ConnectionLost: React.FC = () => {

View File

@ -8,13 +8,14 @@
import React, { PropsWithChildren } from 'react'; 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 { useChat } from '../providers/ChatProvider';
import { useColors } from '../providers/ColorProvider'; import { useColors } from '../providers/ColorProvider';
import { useSocketLifecycle } from '../providers/SocketProvider'; import { useSocketLifecycle } from '../providers/SocketProvider';
import { useWidget, WidgetContextType } from '../providers/WidgetProvider'; import { useWidget, WidgetContextType } from '../providers/WidgetProvider';
import ChatWindow from './ChatWindow';
import CloseIcon from './icons/CloseIcon';
import OpenIcon from './icons/OpenIcon';
import './Launcher.scss'; import './Launcher.scss';
type LauncherProps = PropsWithChildren<{ type LauncherProps = PropsWithChildren<{

View File

@ -12,6 +12,10 @@ import 'dayjs/locale/fr';
import relativeTime from 'dayjs/plugin/relativeTime'; import relativeTime from 'dayjs/plugin/relativeTime';
import React, { PropsWithChildren, useState } from 'react'; 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 ChatIcon from './icons/ChatIcon';
import ButtonsMessage from './messages/ButtonMessage'; import ButtonsMessage from './messages/ButtonMessage';
import CarouselMessage from './messages/CarouselMessage'; import CarouselMessage from './messages/CarouselMessage';
@ -20,9 +24,6 @@ import GeolocationMessage from './messages/GeolocationMessage';
import ListMessage from './messages/ListMessage'; import ListMessage from './messages/ListMessage';
import TextMessage from './messages/TextMessage'; import TextMessage from './messages/TextMessage';
import MessageStatus from './MessageStatus'; import MessageStatus from './MessageStatus';
import { useChat } from '../providers/ChatProvider';
import { useColors } from '../providers/ColorProvider';
import { TMessage } from '../types/message.types';
import './Message.scss'; import './Message.scss';
dayjs.extend(relativeTime); dayjs.extend(relativeTime);

View File

@ -8,9 +8,10 @@
import React from 'react'; import React from 'react';
import CheckIcon from './icons/CheckIcon';
import { useColors } from '../providers/ColorProvider'; import { useColors } from '../providers/ColorProvider';
import { TMessage } from '../types/message.types'; import { TMessage } from '../types/message.types';
import CheckIcon from './icons/CheckIcon';
import './MessageStatus.scss'; import './MessageStatus.scss';
interface MessageStatusProps { interface MessageStatusProps {

View File

@ -8,14 +8,15 @@
import React, { PropsWithChildren, useEffect, useRef, useState } from "react"; import React, { PropsWithChildren, useEffect, useRef, useState } from "react";
import Message from "./Message";
import TypingMessage from "./messages/TypingMessage";
import { useChat } from "../providers/ChatProvider"; import { useChat } from "../providers/ChatProvider";
import { useColors } from "../providers/ColorProvider"; import { useColors } from "../providers/ColorProvider";
import { useWidget } from "../providers/WidgetProvider"; import { useWidget } from "../providers/WidgetProvider";
import "./Messages.scss";
import { TMessage } from "../types/message.types"; import { TMessage } from "../types/message.types";
import Message from "./Message";
import "./Messages.scss";
import TypingMessage from "./messages/TypingMessage";
type MessagesProps = PropsWithChildren<{ type MessagesProps = PropsWithChildren<{
Avatar?: () => JSX.Element; Avatar?: () => JSX.Element;
}>; }>;

View File

@ -8,6 +8,13 @@
import React, { useEffect, useRef, useState } from 'react'; 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 EmojiButton from './buttons/EmojiButton';
import FileButton from './buttons/FileButton'; import FileButton from './buttons/FileButton';
import LocationButton from './buttons/LocationButton'; import LocationButton from './buttons/LocationButton';
@ -16,12 +23,6 @@ import SendButton from './buttons/SendButton';
import CloseIcon from './icons/CloseIcon'; import CloseIcon from './icons/CloseIcon';
import FileInputIcon from './icons/FileInputIcon'; import FileInputIcon from './icons/FileInputIcon';
import Suggestions from './Suggestions'; 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'; import './UserInput.scss';

View File

@ -8,10 +8,11 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import BackIcon from './icons/BackIcon';
import { useTranslation } from '../hooks/useTranslation'; import { useTranslation } from '../hooks/useTranslation';
import { useChat } from '../providers/ChatProvider'; import { useChat } from '../providers/ChatProvider';
import { useColors } from '../providers/ColorProvider'; import { useColors } from '../providers/ColorProvider';
import BackIcon from './icons/BackIcon';
import './Webview.scss'; import './Webview.scss';
const Webview: React.FC = () => { const Webview: React.FC = () => {

View File

@ -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). * 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 { useColors } from '../../providers/ColorProvider'; import { Direction, TButton, TMessage } from "../../types/message.types";
import { TButton, Direction, TMessage } from '../../types/message.types'; import { processContent } from "../../utils/text";
import './CarouselMessage.scss';
import { processContent } from '../../utils/text'; import ButtonsMessage from "./ButtonMessage";
import "./CarouselMessage.scss";
interface Element { interface Element {
title: string; title: string;
@ -73,13 +74,13 @@ const CarouselMessage: React.FC<CarouselMessageProps> = ({
const items = messageCarousel.data.elements; const items = messageCarousel.data.elements;
const goToPrevious = () => { const goToPrevious = () => {
setActiveIndex( setActiveIndex(
(prevIndex) => (prevIndex + items.length - 1) % items.length, (prevIndex) => (prevIndex + items.length - 1) % items.length
); );
}; };
const goToNext = () => { const goToNext = () => {
setActiveIndex((prevIndex) => (prevIndex + 1) % items.length); setActiveIndex((prevIndex) => (prevIndex + 1) % items.length);
}; };
const colors = allColors[messageCarousel.direction || 'received']; const colors = allColors[messageCarousel.direction || "received"];
return ( return (
<div <div

View File

@ -8,10 +8,11 @@
import React from 'react'; import React from 'react';
import ButtonsMessage from './ButtonMessage';
import { useColors } from '../../providers/ColorProvider'; import { useColors } from '../../providers/ColorProvider';
import { TMessage } from '../../types/message.types'; import { TMessage } from '../../types/message.types';
import ButtonsMessage from './ButtonMessage';
import './ListMessage.scss'; import './ListMessage.scss';
interface ListMessageProps { interface ListMessageProps {

View File

@ -16,10 +16,6 @@ import React, {
useState, useState,
} from 'react'; } from 'react';
import { useConfig } from './ConfigProvider';
import { useSettings } from './SettingsProvider';
import { useSocket, useSubscribe } from './SocketProvider';
import { useWidget } from './WidgetProvider';
import { StdEventType } from '../types/chat-io-messages.types'; import { StdEventType } from '../types/chat-io-messages.types';
import { import {
Direction, Direction,
@ -33,6 +29,11 @@ import {
} from '../types/message.types'; } from '../types/message.types';
import { ConnectionState, OutgoingMessageState } from '../types/state.types'; import { ConnectionState, OutgoingMessageState } from '../types/state.types';
import { useConfig } from './ConfigProvider';
import { useSettings } from './SettingsProvider';
import { useSocket, useSubscribe } from './SocketProvider';
import { useWidget } from './WidgetProvider';
interface Participant { interface Participant {
id: string; id: string;
name: string; name: string;

View File

@ -8,10 +8,11 @@
import React, { createContext, ReactNode, useContext } from 'react'; import React, { createContext, ReactNode, useContext } from 'react';
import { useSettings } from './SettingsProvider';
import colors from '../constants/colors'; import colors from '../constants/colors';
import { ColorState } from '../types/colors.types'; import { ColorState } from '../types/colors.types';
import { useSettings } from './SettingsProvider';
const initialState: ColorState = colors['orange']; const initialState: ColorState = colors['orange'];
const ColorContext = createContext<{ const ColorContext = createContext<{
colors: ColorState; colors: ColorState;

View File

@ -14,11 +14,12 @@ import React, {
useState, useState,
} from 'react'; } from 'react';
import { useSubscribe } from './SocketProvider';
import { useTranslation } from '../hooks/useTranslation'; import { useTranslation } from '../hooks/useTranslation';
import { IMenuNode } from '../types/menu.type'; import { IMenuNode } from '../types/menu.type';
import { SessionStorage } from '../utils/sessionStorage'; import { SessionStorage } from '../utils/sessionStorage';
import { useSubscribe } from './SocketProvider';
type ChannelSettings = { type ChannelSettings = {
menu: IMenuNode[]; menu: IMenuNode[];
secret: string; secret: string;

View File

@ -14,9 +14,10 @@ import {
useRef, useRef,
} from 'react'; } from 'react';
import { useConfig } from './ConfigProvider';
import { getSocketIoClient, SocketIoClient } from '../utils/SocketIoClient'; import { getSocketIoClient, SocketIoClient } from '../utils/SocketIoClient';
import { useConfig } from './ConfigProvider';
interface socketContext { interface socketContext {
socket: SocketIoClient; socket: SocketIoClient;
} }

View File

@ -8,9 +8,10 @@
import React, { createContext, useContext, useState, ReactNode } from 'react'; import React, { createContext, useContext, useState, ReactNode } from 'react';
import { useConfig } from './ConfigProvider';
import { translations } from '../translations'; import { translations } from '../translations';
import { useConfig } from './ConfigProvider';
type Language = keyof typeof translations; type Language = keyof typeof translations;
interface TranslationContextProps { interface TranslationContextProps {