diff --git a/.oxlintrc.json b/.oxlintrc.json index 7faf157b..27e8a713 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -9,7 +9,19 @@ }, "rules": { "react/react-in-jsx-scope": "off", - "no-underscore-dangle": ["error", { "allow": ["_sum"] }] + "no-underscore-dangle": ["error", { "allow": ["_sum"] }], + "oxc/no-barrel-file": ["error", { "threshold": 0 }], + "no-restricted-imports": [ + "error", + { + "patterns": [ + { + "regex": "^@/components/(dashboard-card|footer|mdx-components|mobile-menu|share-button)$", + "message": "Import from the concrete component module instead of a barrel file." + } + ] + } + ] }, "ignorePatterns": [ "node_modules/**", diff --git a/components/article-dates/article-dates.tsx b/components/article-dates.tsx similarity index 96% rename from components/article-dates/article-dates.tsx rename to components/article-dates.tsx index 468828d9..56083a9c 100644 --- a/components/article-dates/article-dates.tsx +++ b/components/article-dates.tsx @@ -1,7 +1,7 @@ -type ArticleDatesProps = { +interface ArticleDatesProps { createDate: number; updateDate: number | null; -}; +} const formatDate = (timestamp: number) => new Date(timestamp).toLocaleDateString('en-us', { diff --git a/components/article-dates/index.ts b/components/article-dates/index.ts deleted file mode 100644 index 5cfa861b..00000000 --- a/components/article-dates/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { ArticleDates } from './article-dates'; diff --git a/components/article-meta/article-meta.tsx b/components/article-meta.tsx similarity index 98% rename from components/article-meta/article-meta.tsx rename to components/article-meta.tsx index 1c5fe9a8..c68603e5 100644 --- a/components/article-meta/article-meta.tsx +++ b/components/article-meta.tsx @@ -1,10 +1,10 @@ -type ArticleMetaProps = { +interface ArticleMetaProps { title: string; description: string; createDate: number; updateDate: number | null; keywords: string[]; -}; +} export function ArticleMeta(props: ArticleMetaProps) { const { title, description, createDate, updateDate, keywords } = props; diff --git a/components/article-meta/index.ts b/components/article-meta/index.ts deleted file mode 100644 index b74aed2d..00000000 --- a/components/article-meta/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { ArticleMeta } from './article-meta'; diff --git a/components/blog-post-preview/blog-post-preview.test.tsx b/components/blog-post-preview.test.tsx similarity index 100% rename from components/blog-post-preview/blog-post-preview.test.tsx rename to components/blog-post-preview.test.tsx diff --git a/components/blog-post-preview/blog-post-preview.tsx b/components/blog-post-preview.tsx similarity index 100% rename from components/blog-post-preview/blog-post-preview.tsx rename to components/blog-post-preview.tsx diff --git a/components/blog-post-preview/index.ts b/components/blog-post-preview/index.ts deleted file mode 100644 index ee538734..00000000 --- a/components/blog-post-preview/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './blog-post-preview'; diff --git a/components/blog-post-square-preview/blog-post-square-preview.tsx b/components/blog-post-square-preview.tsx similarity index 100% rename from components/blog-post-square-preview/blog-post-square-preview.tsx rename to components/blog-post-square-preview.tsx diff --git a/components/blog-post-square-preview/index.ts b/components/blog-post-square-preview/index.ts deleted file mode 100644 index 14de3cd3..00000000 --- a/components/blog-post-square-preview/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './blog-post-square-preview'; diff --git a/components/bookmark-section/bookmark-section.tsx b/components/bookmark-section.tsx similarity index 100% rename from components/bookmark-section/bookmark-section.tsx rename to components/bookmark-section.tsx diff --git a/components/bookmark-section/index.ts b/components/bookmark-section/index.ts deleted file mode 100644 index 655207a8..00000000 --- a/components/bookmark-section/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { BookmarkSection } from './bookmark-section'; diff --git a/components/categories/categories.test.tsx b/components/categories.test.tsx similarity index 100% rename from components/categories/categories.test.tsx rename to components/categories.test.tsx diff --git a/components/categories/categories.tsx b/components/categories.tsx similarity index 100% rename from components/categories/categories.tsx rename to components/categories.tsx diff --git a/components/categories/index.ts b/components/categories/index.ts deleted file mode 100644 index a8c829f2..00000000 --- a/components/categories/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './categories'; diff --git a/components/dashboard-card/index.ts b/components/dashboard-card/index.ts deleted file mode 100644 index 60f8a3c6..00000000 --- a/components/dashboard-card/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dashboard-card'; diff --git a/components/floating-reactions/floating-reactions.tsx b/components/floating-reactions.tsx similarity index 100% rename from components/floating-reactions/floating-reactions.tsx rename to components/floating-reactions.tsx diff --git a/components/floating-reactions/index.ts b/components/floating-reactions/index.ts deleted file mode 100644 index 56d398d5..00000000 --- a/components/floating-reactions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { FloatingReactions } from './floating-reactions'; diff --git a/components/footer-link/footer-link.tsx b/components/footer-link.tsx similarity index 100% rename from components/footer-link/footer-link.tsx rename to components/footer-link.tsx diff --git a/components/footer-link/index.ts b/components/footer-link/index.ts deleted file mode 100644 index 4b954664..00000000 --- a/components/footer-link/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './footer-link'; diff --git a/components/footer/index.ts b/components/footer/index.ts deleted file mode 100644 index a058eae0..00000000 --- a/components/footer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './footer'; diff --git a/components/header-link/header-link.tsx b/components/header-link.tsx similarity index 100% rename from components/header-link/header-link.tsx rename to components/header-link.tsx diff --git a/components/header-link/index.ts b/components/header-link/index.ts deleted file mode 100644 index 41b500d7..00000000 --- a/components/header-link/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './header-link'; diff --git a/components/header/header.tsx b/components/header.tsx similarity index 100% rename from components/header/header.tsx rename to components/header.tsx diff --git a/components/header/index.ts b/components/header/index.ts deleted file mode 100644 index 677ca79d..00000000 --- a/components/header/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './header'; diff --git a/components/layout/layout.tsx b/components/layout.tsx similarity index 98% rename from components/layout/layout.tsx rename to components/layout.tsx index 9a190439..cf6ad7a8 100644 --- a/components/layout/layout.tsx +++ b/components/layout.tsx @@ -2,7 +2,7 @@ import Head from 'next/head'; import { useRouter } from 'next/router'; import { PropsWithChildren } from 'react'; -import { Footer } from '@/components/footer'; +import { Footer } from '@/components/footer/footer'; import { Header } from '@/components/header'; const DESCRIPTION = diff --git a/components/layout/index.ts b/components/layout/index.ts deleted file mode 100644 index 5d15fe1b..00000000 --- a/components/layout/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './layout'; diff --git a/components/linkedin-feedback/constants.ts b/components/linkedin-feedback.constants.ts similarity index 97% rename from components/linkedin-feedback/constants.ts rename to components/linkedin-feedback.constants.ts index cee6ff3b..2c95b0ba 100644 --- a/components/linkedin-feedback/constants.ts +++ b/components/linkedin-feedback.constants.ts @@ -1,4 +1,4 @@ -import { LinkedinTestimonial } from '@/lib/types'; +import type { LinkedinTestimonial } from '@/lib/types'; export const LINKEDIN_FEEDBACK_LIST: LinkedinTestimonial[] = [ { diff --git a/components/linkedin-feedback/linkedin-feedback.tsx b/components/linkedin-feedback.tsx similarity index 100% rename from components/linkedin-feedback/linkedin-feedback.tsx rename to components/linkedin-feedback.tsx diff --git a/components/linkedin-feedback/index.ts b/components/linkedin-feedback/index.ts deleted file mode 100644 index 316b4e7e..00000000 --- a/components/linkedin-feedback/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { LinkedinFeedback } from './linkedin-feedback'; diff --git a/components/mdx-components/index.tsx b/components/mdx-components/mdx-components.tsx similarity index 95% rename from components/mdx-components/index.tsx rename to components/mdx-components/mdx-components.tsx index 8e6855d3..b64168f7 100644 --- a/components/mdx-components/index.tsx +++ b/components/mdx-components/mdx-components.tsx @@ -1,6 +1,6 @@ import Image, { ImageProps } from 'next/image'; import Link from 'next/link'; -import React, { AnchorHTMLAttributes, ClassAttributes, JSX } from 'react'; +import { AnchorHTMLAttributes, ClassAttributes, JSX } from 'react'; import { Routes } from '@/lib/routes'; diff --git a/components/mobile-menu/index.ts b/components/mobile-menu/index.ts deleted file mode 100644 index 7929ed63..00000000 --- a/components/mobile-menu/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './mobile-menu'; diff --git a/components/no-results/no-results.test.tsx b/components/no-results.test.tsx similarity index 100% rename from components/no-results/no-results.test.tsx rename to components/no-results.test.tsx diff --git a/components/no-results/no-results.tsx b/components/no-results.tsx similarity index 100% rename from components/no-results/no-results.tsx rename to components/no-results.tsx diff --git a/components/no-results/index.ts b/components/no-results/index.ts deleted file mode 100644 index f322bb4e..00000000 --- a/components/no-results/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { NoResults } from './no-results'; diff --git a/components/resource-card/resource-card.tsx b/components/resource-card.tsx similarity index 100% rename from components/resource-card/resource-card.tsx rename to components/resource-card.tsx diff --git a/components/resource-card/index.ts b/components/resource-card/index.ts deleted file mode 100644 index 59208132..00000000 --- a/components/resource-card/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { ResourceCard, type ResourceCardProps } from './resource-card'; diff --git a/components/search-input/search-input.test.tsx b/components/search-input.test.tsx similarity index 100% rename from components/search-input/search-input.test.tsx rename to components/search-input.test.tsx diff --git a/components/search-input/search-input.tsx b/components/search-input.tsx similarity index 100% rename from components/search-input/search-input.tsx rename to components/search-input.tsx diff --git a/components/search-input/index.ts b/components/search-input/index.ts deleted file mode 100644 index 0b58bb30..00000000 --- a/components/search-input/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { SearchInput } from './search-input'; diff --git a/components/share-button/index.ts b/components/share-button/index.ts deleted file mode 100644 index 126aae59..00000000 --- a/components/share-button/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './facebook-share'; -export * from './linkedin-share'; -export * from './twitter-share'; -export * from './telegram-share'; diff --git a/components/table-of-content/table-of-content.tsx b/components/table-of-content.tsx similarity index 100% rename from components/table-of-content/table-of-content.tsx rename to components/table-of-content.tsx diff --git a/components/table-of-content/index.ts b/components/table-of-content/index.ts deleted file mode 100644 index 8f940e40..00000000 --- a/components/table-of-content/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { TableOfContent } from './table-of-content'; diff --git a/components/tag/tag.test.tsx b/components/tag.test.tsx similarity index 100% rename from components/tag/tag.test.tsx rename to components/tag.test.tsx diff --git a/components/tag/tag.tsx b/components/tag.tsx similarity index 100% rename from components/tag/tag.tsx rename to components/tag.tsx diff --git a/components/tag/index.ts b/components/tag/index.ts deleted file mode 100644 index e533e200..00000000 --- a/components/tag/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Tag } from './tag'; diff --git a/components/theme-changer/theme-changer.test.tsx b/components/theme-changer.test.tsx similarity index 100% rename from components/theme-changer/theme-changer.test.tsx rename to components/theme-changer.test.tsx diff --git a/components/theme-changer/theme-changer.tsx b/components/theme-changer.tsx similarity index 100% rename from components/theme-changer/theme-changer.tsx rename to components/theme-changer.tsx diff --git a/components/theme-changer/index.ts b/components/theme-changer/index.ts deleted file mode 100644 index 16cdc95d..00000000 --- a/components/theme-changer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './theme-changer'; diff --git a/components/view-counter/view-counter.test.tsx b/components/view-counter.test.tsx similarity index 100% rename from components/view-counter/view-counter.test.tsx rename to components/view-counter.test.tsx diff --git a/components/view-counter/view-counter.tsx b/components/view-counter.tsx similarity index 100% rename from components/view-counter/view-counter.tsx rename to components/view-counter.tsx diff --git a/components/view-counter/index.ts b/components/view-counter/index.ts deleted file mode 100644 index 26229ef9..00000000 --- a/components/view-counter/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './view-counter'; diff --git a/components/year-separator/year-separator.tsx b/components/year-separator.tsx similarity index 91% rename from components/year-separator/year-separator.tsx rename to components/year-separator.tsx index 584fddb7..4f052cc4 100644 --- a/components/year-separator/year-separator.tsx +++ b/components/year-separator.tsx @@ -1,4 +1,4 @@ -import { type ElementType } from 'react'; +import type { ElementType } from 'react'; interface YearSeparatorProps { year: number | string; diff --git a/components/year-separator/index.ts b/components/year-separator/index.ts deleted file mode 100644 index ba1d8626..00000000 --- a/components/year-separator/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { YearSeparator } from './year-separator'; diff --git a/lib/index.ts b/lib/index.ts deleted file mode 100644 index a3820983..00000000 --- a/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './routes'; diff --git a/pages/about.tsx b/pages/about.tsx index 3c0b488b..a7478453 100644 --- a/pages/about.tsx +++ b/pages/about.tsx @@ -2,7 +2,7 @@ import Head from 'next/head'; import Image from 'next/image'; import { LinkedinFeedback } from '@/components/linkedin-feedback'; -import { LINKEDIN_FEEDBACK_LIST } from '@/components/linkedin-feedback/constants'; +import { LINKEDIN_FEEDBACK_LIST } from '@/components/linkedin-feedback.constants'; import about from '../public/static/images/about.jpeg'; import carBack from '../public/static/images/car-back.jpeg'; diff --git a/pages/blog/[slug].tsx b/pages/blog/[slug].tsx index f3117e95..f279efea 100644 --- a/pages/blog/[slug].tsx +++ b/pages/blog/[slug].tsx @@ -12,16 +12,14 @@ import React from 'react'; import { ArticleDates } from '@/components/article-dates'; import { ArticleMeta } from '@/components/article-meta'; -import { MDXComponents } from '@/components/mdx-components'; -import { - FacebookShare, - LinkedInShare, - TelegramShare, - TwitterShare, -} from '@/components/share-button'; +import { MDXComponents } from '@/components/mdx-components/mdx-components'; +import { FacebookShare } from '@/components/share-button/facebook-share'; +import { LinkedInShare } from '@/components/share-button/linkedin-share'; +import { TelegramShare } from '@/components/share-button/telegram-share'; +import { TwitterShare } from '@/components/share-button/twitter-share'; import { TableOfContent } from '@/components/table-of-content'; import { Tag } from '@/components/tag'; -import { ViewCounter } from '@/components/view-counter/view-counter'; +import { ViewCounter } from '@/components/view-counter'; import { getPostBySlug, getPostSlugs } from '@/lib/posts/api'; import { generateBlogPostingSchema, diff --git a/pages/snippets/[slug].tsx b/pages/snippets/[slug].tsx index cac79042..9b33cdb3 100644 --- a/pages/snippets/[slug].tsx +++ b/pages/snippets/[slug].tsx @@ -11,7 +11,7 @@ import React, { useEffect } from 'react'; import { ArticleDates } from '@/components/article-dates'; import { ArticleMeta } from '@/components/article-meta'; -import { MDXComponents } from '@/components/mdx-components'; +import { MDXComponents } from '@/components/mdx-components/mdx-components'; import { generateTechArticleSchema, generateBreadcrumbSchema,