From 2faf2e34331703b3bdea3eb487cb8799c8d65377 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 19 Sep 2023 18:13:57 +0200 Subject: refactor(build): replace paths aliases with relative paths Using paths aliases starting with "@" can be confusing and can lead to conflict with existings modules. I prefer to use relative paths to avoid extra configuration in tools because of these aliases. --- src/utils/hooks/use-article.tsx | 10 +++++----- src/utils/hooks/use-attributes.tsx | 2 +- src/utils/hooks/use-breadcrumb.tsx | 4 ++-- src/utils/hooks/use-comments.tsx | 4 ++-- src/utils/hooks/use-github-api.tsx | 2 +- src/utils/hooks/use-headings-tree.tsx | 2 +- src/utils/hooks/use-local-storage.tsx | 2 +- src/utils/hooks/use-pagination.tsx | 4 ++-- src/utils/hooks/use-prism.tsx | 4 ++-- src/utils/hooks/use-settings.tsx | 2 +- src/utils/hooks/use-update-ackee-options.tsx | 2 +- 11 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/utils/hooks') diff --git a/src/utils/hooks/use-article.tsx b/src/utils/hooks/use-article.tsx index e658407..f6512b2 100644 --- a/src/utils/hooks/use-article.tsx +++ b/src/utils/hooks/use-article.tsx @@ -1,9 +1,9 @@ -import { fetchAPI } from '@services/graphql/api'; -import { getArticleFromRawData } from '@services/graphql/articles'; -import { articleBySlugQuery } from '@services/graphql/articles.query'; -import { Article } from '@ts/types/app'; -import { RawArticle } from '@ts/types/raw-data'; import useSWR from 'swr'; +import { fetchAPI } from '../../services/graphql/api'; +import { getArticleFromRawData } from '../../services/graphql/articles'; +import { articleBySlugQuery } from '../../services/graphql/articles.query'; +import { Article } from '../../types/app'; +import { RawArticle } from '../../types/raw-data'; export type UseArticleConfig = { fallback?: Article; diff --git a/src/utils/hooks/use-attributes.tsx b/src/utils/hooks/use-attributes.tsx index 6d18048..35161ed 100644 --- a/src/utils/hooks/use-attributes.tsx +++ b/src/utils/hooks/use-attributes.tsx @@ -1,5 +1,5 @@ -import { fromKebabCaseToCamelCase } from '@utils/helpers/strings'; import { useCallback, useEffect } from 'react'; +import { fromKebabCaseToCamelCase } from '../helpers/strings'; export type useAttributesProps = { /** diff --git a/src/utils/hooks/use-breadcrumb.tsx b/src/utils/hooks/use-breadcrumb.tsx index 130ebf1..dcdf87f 100644 --- a/src/utils/hooks/use-breadcrumb.tsx +++ b/src/utils/hooks/use-breadcrumb.tsx @@ -1,7 +1,7 @@ -import { BreadcrumbItem } from '@components/molecules/nav/breadcrumb'; -import { slugify } from '@utils/helpers/strings'; import { useIntl } from 'react-intl'; import { BreadcrumbList } from 'schema-dts'; +import { BreadcrumbItem } from '../../components/molecules/nav/breadcrumb'; +import { slugify } from '../helpers/strings'; import useSettings from './use-settings'; export type useBreadcrumbProps = { diff --git a/src/utils/hooks/use-comments.tsx b/src/utils/hooks/use-comments.tsx index a695bd7..8281a86 100644 --- a/src/utils/hooks/use-comments.tsx +++ b/src/utils/hooks/use-comments.tsx @@ -1,6 +1,6 @@ -import { getAllComments } from '@services/graphql/comments'; -import { SingleComment } from '@ts/types/app'; import useSWR from 'swr'; +import { getAllComments } from '../../services/graphql/comments'; +import { SingleComment } from '../../types/app'; export type UseCommentsConfig = { contentId?: string | number; diff --git a/src/utils/hooks/use-github-api.tsx b/src/utils/hooks/use-github-api.tsx index edff974..56df01f 100644 --- a/src/utils/hooks/use-github-api.tsx +++ b/src/utils/hooks/use-github-api.tsx @@ -1,5 +1,5 @@ -import { SWRResult } from '@ts/types/swr'; import useSWR, { Fetcher } from 'swr'; +import { SWRResult } from '../../types/swr'; export type RepoData = { created_at: string; diff --git a/src/utils/hooks/use-headings-tree.tsx b/src/utils/hooks/use-headings-tree.tsx index f7ab452..0dc077e 100644 --- a/src/utils/hooks/use-headings-tree.tsx +++ b/src/utils/hooks/use-headings-tree.tsx @@ -1,5 +1,5 @@ -import { slugify } from '@utils/helpers/strings'; import { useCallback, useEffect, useMemo, useState } from 'react'; +import { slugify } from '../helpers/strings'; import { useMutationObserver } from './use-mutation-observer'; export type Heading = { diff --git a/src/utils/hooks/use-local-storage.tsx b/src/utils/hooks/use-local-storage.tsx index da0292b..1809e07 100644 --- a/src/utils/hooks/use-local-storage.tsx +++ b/src/utils/hooks/use-local-storage.tsx @@ -1,4 +1,4 @@ -import { LocalStorage } from '@services/local-storage'; +import { LocalStorage } from '../../services/local-storage'; import { Dispatch, SetStateAction, useEffect, useState } from 'react'; export type UseLocalStorageReturn = { diff --git a/src/utils/hooks/use-pagination.tsx b/src/utils/hooks/use-pagination.tsx index f17b6ff..f47a674 100644 --- a/src/utils/hooks/use-pagination.tsx +++ b/src/utils/hooks/use-pagination.tsx @@ -1,6 +1,6 @@ -import { GraphQLEdgesInput } from '@ts/types/graphql/generics'; -import { EdgesResponse, Search } from '@ts/types/graphql/queries'; import useSWRInfinite, { SWRInfiniteKeyLoader } from 'swr/infinite'; +import { GraphQLEdgesInput } from '../../types/graphql/generics'; +import { EdgesResponse, Search } from '../../types/graphql/queries'; export type UsePaginationProps = { /** diff --git a/src/utils/hooks/use-prism.tsx b/src/utils/hooks/use-prism.tsx index ef1a4c8..05790a3 100644 --- a/src/utils/hooks/use-prism.tsx +++ b/src/utils/hooks/use-prism.tsx @@ -17,7 +17,7 @@ const PRISM_PLUGINS = [ 'toolbar', ] as const; -export type PrismPlugin = typeof PRISM_PLUGINS[number]; +export type PrismPlugin = (typeof PRISM_PLUGINS)[number]; export type DefaultPrismPlugin = Extract< PrismPlugin, @@ -90,7 +90,7 @@ const loadPrismPlugins = async (plugins: PrismPlugin[]) => { for (const plugin of plugins) { try { if (plugin === 'color-scheme') { - await import(`@utils/plugins/prism-${plugin}`); + await import(`../plugins/prism-${plugin}`); } else { await import(`prismjs/plugins/${plugin}/prism-${plugin}.min.js`); } diff --git a/src/utils/hooks/use-settings.tsx b/src/utils/hooks/use-settings.tsx index a1d1a65..edb5b5e 100644 --- a/src/utils/hooks/use-settings.tsx +++ b/src/utils/hooks/use-settings.tsx @@ -1,5 +1,5 @@ -import { settings } from '@utils/config'; import { useRouter } from 'next/router'; +import { settings } from '../config'; export type BlogSettings = { /** diff --git a/src/utils/hooks/use-update-ackee-options.tsx b/src/utils/hooks/use-update-ackee-options.tsx index 7c1d98a..1901588 100644 --- a/src/utils/hooks/use-update-ackee-options.tsx +++ b/src/utils/hooks/use-update-ackee-options.tsx @@ -1,5 +1,5 @@ -import { useAckeeTracker } from '@utils/providers/ackee'; import { useEffect } from 'react'; +import { useAckeeTracker } from '../providers/ackee'; export type AckeeOptions = 'full' | 'partial'; -- cgit v1.2.3