From 9d672e3cf33327225309b8df8cb497dccf8d54cf Mon Sep 17 00:00:00 2001 From: Walidoux Date: Tue, 12 Apr 2022 14:47:21 +0000 Subject: [PATCH] refactor: remove useless config for absolute paths and improve components exports --- components/Head/CommonHead.tsx | 6 ++---- components/Head/NextHead.tsx | 7 ++----- pages/_document.tsx | 2 +- tsconfig.json | 6 +----- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/components/Head/CommonHead.tsx b/components/Head/CommonHead.tsx index 42575ce..ef02ddf 100644 --- a/components/Head/CommonHead.tsx +++ b/components/Head/CommonHead.tsx @@ -1,9 +1,9 @@ // eslint-disable-next-line @next/next/no-document-import-in-page import { Head } from 'next/document' -import { projectConfig } from '@/utils/config' +import { projectConfig } from 'utils/config' -const CommonHead = (): JSX.Element => { +export const CommonHead = (): JSX.Element => { return ( {/* Link Tags */} @@ -62,5 +62,3 @@ const CommonHead = (): JSX.Element => { ) } - -export default CommonHead diff --git a/components/Head/NextHead.tsx b/components/Head/NextHead.tsx index e541ef4..f729405 100644 --- a/components/Head/NextHead.tsx +++ b/components/Head/NextHead.tsx @@ -1,6 +1,6 @@ import Head from 'next/head' -import { projectConfig } from '@/utils/config' +import { projectConfig } from 'utils/config' interface HeadProps { longName?: string @@ -10,8 +10,7 @@ interface HeadProps { const NextHead: React.FC = (props) => { const { longName = projectConfig.longName, - shortName = projectConfig.shortName, - children + shortName = projectConfig.shortName } = props return ( @@ -23,8 +22,6 @@ const NextHead: React.FC = (props) => { - - {children} ) } diff --git a/pages/_document.tsx b/pages/_document.tsx index e7dc22d..9ca66ec 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -1,6 +1,6 @@ import Document, { Html, Main, NextScript } from 'next/document' -import CommonHead from '@/components/Head/CommonHead' +import { CommonHead } from 'components/Head/CommonHead' class MyDocument extends Document { render(): JSX.Element { diff --git a/tsconfig.json b/tsconfig.json index 8e6aaba..084b589 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,11 +17,7 @@ "resolveJsonModule": true, "moduleResolution": "node", "lib": ["dom", "dom.iterable", "esnext"], - "forceConsistentCasingInFileNames": true, - "paths": { - "@/components/*": ["components/*"], - "@/utils/*": ["utils/*"] - } + "forceConsistentCasingInFileNames": true }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "exclude": ["dist", ".next", "out", "next.config.js"]