Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(client): force consistent-type-imports eslint rule #388

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions client/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,16 @@ export default tseslint.config(
...globals.browser
}
}
},
{
rules: {
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'separate-type-imports'
}
]
}
}
);
19 changes: 8 additions & 11 deletions client/src/api/httpClient.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
import { Testimonial } from '../interfaces/Testimonial';
import {
LoginFormMode,
LoginUser,
RegistrationUser,
UserData
} from '../interfaces/User';
import { Product } from '../interfaces/Product';
import { OidcClient } from '../interfaces/Auth';
import { ChatMessage } from '../interfaces/ChatMessage';
import type { AxiosInstance, AxiosRequestConfig } from 'axios';
import axios from 'axios';
import type { Testimonial } from '../interfaces/Testimonial';
import type { LoginUser, RegistrationUser, UserData } from '../interfaces/User';
import { LoginFormMode } from '../interfaces/User';
import type { Product } from '../interfaces/Product';
import type { OidcClient } from '../interfaces/Auth';
import type { ChatMessage } from '../interfaces/ChatMessage';
import { ApiUrl } from './ApiUrl';
import { makeApiRequest } from './makeApiRequest';

Expand Down
2 changes: 1 addition & 1 deletion client/src/api/makeApiRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AxiosRequestConfig } from 'axios';
import type { AxiosRequestConfig } from 'axios';
import { httpClient } from './httpClient';

export function makeApiRequest<T>(
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/auth/AdminLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from 'react';
import type { FC, PropsWithChildren } from 'react';

export const AdminLayout: FC<PropsWithChildren> = ({ children }) => {
return (
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/auth/AdminPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChangeEvent, FC, useEffect, useState } from 'react';
import { UserData } from '../../interfaces/User';
import type { ChangeEvent, FC } from 'react';
import { useEffect, useState } from 'react';
import type { UserData } from '../../interfaces/User';
import { getAdminStatus, searchUsers } from '../../api/httpClient';
import AdminLayout from './AdminLayout';

Expand Down
3 changes: 2 additions & 1 deletion client/src/pages/auth/AuthLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ReactNode, useRef, useEffect, FC } from 'react';
import type { ReactNode, FC } from 'react';
import { useRef, useEffect } from 'react';

type Props = {
children?: ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/auth/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';
import AuthLayout from './AuthLayout';

export const Dashboard: FC = () => {
Expand Down
11 changes: 6 additions & 5 deletions client/src/pages/auth/Login/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { AxiosRequestConfig } from 'axios';
import type { AxiosRequestConfig } from 'axios';
import getBrowserFingerprint from 'get-browser-fingerprint';
import { FC, FormEvent, useEffect, useState } from 'react';
import type { FC, FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import { OidcClient } from '../../../interfaces/Auth';
import type { OidcClient } from '../../../interfaces/Auth';
import { RoutePath } from '../../../router/RoutePath';
import {
getLdap,
Expand All @@ -12,13 +13,13 @@ import {
loadDomXsrfToken,
getOidcClient
} from '../../../api/httpClient';
import {
LoginFormMode,
import type {
LoginResponse,
LoginUser,
UserData,
RegistrationUser
} from '../../../interfaces/User';
import { LoginFormMode } from '../../../interfaces/User';
import AuthLayout from '../AuthLayout';
import showLdapResponse from './showLdapReponse';
import showLoginResponse from './showLoginReponse';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/auth/Login/showLdapReponse.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegistrationUser } from '../../../interfaces/User';
import type { RegistrationUser } from '../../../interfaces/User';
import showRegResponse from '../Register/showRegReponse';

export function showLdapResponse(ldapResponse: Array<RegistrationUser>) {
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/auth/Login/showLoginReponse.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import InnerHTML from 'dangerously-set-html-content';
import { LoginResponse } from '../../../interfaces/User';
import type { LoginResponse } from '../../../interfaces/User';

export function showLoginResponse({ email, ldapProfileLink }: LoginResponse) {
const fields = [
Expand Down
8 changes: 5 additions & 3 deletions client/src/pages/auth/LoginNew/LoginNew.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { AxiosRequestConfig } from 'axios';
import { FC, FormEvent, useState } from 'react';
import type { AxiosRequestConfig } from 'axios';
import type { FC, FormEvent } from 'react';
import { useState } from 'react';
import { Link } from 'react-router-dom';
import { RoutePath } from '../../../router/RoutePath';
import { getUserData } from '../../../api/httpClient';
import { LoginFormMode, LoginUser, UserData } from '../../../interfaces/User';
import type { LoginUser, UserData } from '../../../interfaces/User';
import { LoginFormMode } from '../../../interfaces/User';
import AuthLayout from '../AuthLayout';

const defaultLoginUser: LoginUser = {
Expand Down
9 changes: 5 additions & 4 deletions client/src/pages/auth/LoginNew/PasswordCheck.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { AxiosRequestConfig } from 'axios';
import { FC, FormEvent, useEffect, useState } from 'react';
import type { AxiosRequestConfig } from 'axios';
import type { FC, FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import { RoutePath } from '../../../router/RoutePath';
import { getUser, getUserData } from '../../../api/httpClient';
import {
LoginFormMode,
import type {
LoginResponse,
LoginUser,
UserData
} from '../../../interfaces/User';
import { LoginFormMode } from '../../../interfaces/User';
import AuthLayout from '../AuthLayout';

const defaultLoginUser: LoginUser = {
Expand Down
6 changes: 4 additions & 2 deletions client/src/pages/auth/Register/Register.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { FC, FormEvent, useState } from 'react';
import type { FC, FormEvent } from 'react';
import { useState } from 'react';
import { postUser } from '../../../api/httpClient';
import { RegistrationUser, LoginFormMode } from '../../../interfaces/User';
import type { RegistrationUser } from '../../../interfaces/User';
import { LoginFormMode } from '../../../interfaces/User';
import AuthLayout from '../AuthLayout';
import { Link } from 'react-router-dom';
import showRegResponse from './showRegReponse';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/auth/Register/showRegReponse.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import InnerHTML from 'dangerously-set-html-content';
import { RegistrationUser } from '../../../interfaces/User';
import type { RegistrationUser } from '../../../interfaces/User';

export function showRegResponse({
email,
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/chat/Chat.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';
import Header from '../main/Header/Header';
import ChatWidget from './ChatWidget';

Expand Down
12 changes: 3 additions & 9 deletions client/src/pages/chat/ChatWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import {
ChangeEvent,
FC,
KeyboardEvent,
useEffect,
useRef,
useState
} from 'react';
import type { ChangeEvent, FC, KeyboardEvent } from 'react';
import { useEffect, useRef, useState } from 'react';
import { queryChat } from '../../api/httpClient';
import { ChatMessage } from '../../interfaces/ChatMessage';
import type { ChatMessage } from '../../interfaces/ChatMessage';

const UnsafeComponent: FC<{ html: string }> = ({ html }) => {
return <div dangerouslySetInnerHTML={{ __html: html }} />;
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/main/Counts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';

export const Counts: FC = () => {
const counters = [
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/main/FAQ.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';

export const FAQ: FC = () => {
const FAQItems = [
Expand Down
3 changes: 2 additions & 1 deletion client/src/pages/main/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FC, FormEvent, useEffect, useState } from 'react';
import type { FC, FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import InnerHTML from 'dangerously-set-html-content';
import { postRender, postSubscriptions } from '../../api/httpClient';
Expand Down
3 changes: 2 additions & 1 deletion client/src/pages/main/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FC, useEffect } from 'react';
import type { FC } from 'react';
import { useEffect } from 'react';
import { Link } from 'react-router-dom';
import { goTo, postMetadata, getSpawnData } from '../../../api/httpClient';
import Nav from './Nav';
Expand Down
3 changes: 2 additions & 1 deletion client/src/pages/main/Header/Sign.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ChangeEvent, FC, useEffect, useState } from 'react';
import type { ChangeEvent, FC } from 'react';
import { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import { Buffer } from 'buffer';
import { fileTypeFromBuffer } from 'file-type/core';
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/main/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';

export const Hero: FC = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/main/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';
import Marketplace from '../marketplace/Marketplace';
import Counts from './Counts';
import Hero from './Hero';
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/main/Userprofile.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { FormEvent, useEffect, useState } from 'react';
import type { FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { Navigate } from 'react-router';
import {
getAdminStatus,
getUserDataById,
putUserData,
removeUserPhotoById
} from '../../api/httpClient';
import { UserData } from '../../interfaces/User';
import type { UserData } from '../../interfaces/User';
import { RoutePath } from '../../router/RoutePath';
import AuthLayout from '../auth/AuthLayout';

Expand Down
3 changes: 2 additions & 1 deletion client/src/pages/marketplace/DatePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FC, useState } from 'react';
import type { FC } from 'react';
import { useState } from 'react';
import DatePicker from 'react-datepicker';
import 'react-datepicker/dist/react-datepicker.css';

Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/marketplace/Marketplace.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChangeEvent, FC, MouseEvent, useEffect, useState } from 'react';
import { Product } from '../../interfaces/Product';
import type { ChangeEvent, FC, MouseEvent } from 'react';
import { useEffect, useState } from 'react';
import type { Product } from '../../interfaces/Product';
import {
getProducts,
getLatestProducts,
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/marketplace/Partners/Partners.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { FC, useEffect, useState } from 'react';
import type { FC } from 'react';
import { useEffect, useState } from 'react';
import { DOMParser } from 'xmldom';

import OwlCarousel from 'react-owl-carousel';
import 'owl.carousel/dist/assets/owl.carousel.css';
import 'owl.carousel/dist/assets/owl.theme.default.css';

import { searchPartners, partnerLogin } from '../../../api/httpClient';
import { Partner } from '../../../interfaces/Partner';
import type { Partner } from '../../../interfaces/Partner';

export const Partners: FC = () => {
const PARTNER_DEFAULT_USERNAME = 'walter100';
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/marketplace/ProductView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FC, useEffect } from 'react';
import { Product } from '../../interfaces/Product';
import type { FC } from 'react';
import { useEffect } from 'react';
import type { Product } from '../../interfaces/Product';
import { viewProduct } from '../../api/httpClient';

interface Props {
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/marketplace/Testimonials/Testimonials.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FC, useEffect, useState } from 'react';
import type { FC } from 'react';
import { useEffect, useState } from 'react';
import { getTestimonials, getTestimonialsCount } from '../../../api/httpClient';
import { Testimonial } from '../../../interfaces/Testimonial';
import type { Testimonial } from '../../../interfaces/Testimonial';
import OwlCarousel from 'react-owl-carousel';
import 'owl.carousel/dist/assets/owl.carousel.css';
import 'owl.carousel/dist/assets/owl.theme.default.css';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Dispatch, FC, FormEvent, useState } from 'react';
import type { Dispatch, FC, FormEvent } from 'react';
import { useState } from 'react';
import { postTestimonials } from '../../../api/httpClient';
import { Testimonial } from '../../../interfaces/Testimonial';
import type { Testimonial } from '../../../interfaces/Testimonial';

const defaultTestimonial: Testimonial = {
name: '',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from 'react';
import type { FC } from 'react';
import InnerHTML from 'dangerously-set-html-content';
import { Testimonial } from '../../../interfaces/Testimonial';
import type { Testimonial } from '../../../interfaces/Testimonial';

interface Props {
testimonials: Array<Testimonial>;
Expand Down
2 changes: 1 addition & 1 deletion client/src/router/AppRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import type { FC } from 'react';
import { Route, Routes, Navigate } from 'react-router-dom';
import { RoutePath } from './RoutePath';
import Main from '../pages/main/Main';
Expand Down