Skip to content

Commit

Permalink
refactor: modify eslint rules on type imports (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
resir014 authored Nov 26, 2024
1 parent c933243 commit a0aaba4
Show file tree
Hide file tree
Showing 46 changed files with 91 additions and 89 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-argument': 'warn',
'import/consistent-type-specifier-style': 'off',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion lib/item-by-slug.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import matter from 'gray-matter';
import { PostKind } from '~/types/default';
import type { PostKind } from '~/types/default';
import { renderMarkdown } from './markdown-to-html';
import { getContentDirectory } from './content';

Expand Down
2 changes: 1 addition & 1 deletion lib/next.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NextPage, NextPageProps } from '~/types/next';
import type { NextPage, NextPageProps } from '~/types/next';

/**
* Helper function to create next pages.
Expand Down
2 changes: 1 addition & 1 deletion lib/pages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BasePageProps } from '~/types/posts';
import type { BasePageProps } from '~/types/posts';
import { getContentFiles } from './content';
import { DEFAULT_PAGE_DIRECTORY, getPageBySlug } from './item-by-slug';

Expand Down
4 changes: 2 additions & 2 deletions lib/posts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import { PostKind } from '~/types/default';
import {
import type { PostKind } from '~/types/default';
import type {
BaseBookmarkProps,
BaseJamProps,
BasePhotoProps,
Expand Down
2 changes: 1 addition & 1 deletion lib/projects.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import matter from 'gray-matter';
import { BaseProjectProps, ProjectMetadata } from '~/types/projects';
import type { BaseProjectProps, ProjectMetadata } from '~/types/projects';
import { getContentDirectory } from './content';
import { renderMarkdown } from './markdown-to-html';

Expand Down
2 changes: 1 addition & 1 deletion lib/rss.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Feed } from 'feed';
import { BasePostProps } from '~/types/posts';
import type { BasePostProps } from '~/types/posts';
import siteMetadata from './data/site-metadata';
import { renderMarkdown } from './markdown-to-html';

Expand Down
2 changes: 1 addition & 1 deletion modules/bookmarks/bookmark-list-item.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { BaseBookmarkProps } from '~/types/posts';
import type { BaseBookmarkProps } from '~/types/posts';

export interface BookmarkListItemProps extends React.ComponentPropsWithoutRef<'li'> {
bookmark: BaseBookmarkProps;
Expand Down
2 changes: 1 addition & 1 deletion modules/bookmarks/bookmark-list.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { BaseBookmarkProps } from '~/types/posts';
import type { BaseBookmarkProps } from '~/types/posts';
import { BookmarkListItem } from './bookmark-list-item';

export interface BookmarkListProps extends React.ComponentPropsWithoutRef<'ul'> {
Expand Down
2 changes: 1 addition & 1 deletion modules/photos/featured-photo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { BasePhotoProps } from '~/types/posts';
import type { BasePhotoProps } from '~/types/posts';
import { PhotoListItem } from './photo-list-item';

export interface FeaturedPhotoProps {
Expand Down
2 changes: 1 addition & 1 deletion modules/photos/photo-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import clsx from 'clsx';
import Link from 'next/link';
import * as React from 'react';
import convert from 'htmr';
import { BasePhotoProps } from '~/types/posts';
import type { BasePhotoProps } from '~/types/posts';
import htmrTransform from '~/lib/htmr-transform';
import { PostMeta } from '../posts';
import { PhotoWrapper } from './photo-wrapper';
Expand Down
2 changes: 1 addition & 1 deletion modules/posts/featured-post-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import clsx from 'clsx';
import Link from 'next/link';
import Image from 'next/legacy/image';

import { PostMetadata } from '~/types/posts';
import type { PostMetadata } from '~/types/posts';
import { formatPostDate } from '~/lib/date-formatter';
import { getColorSchemeBySeed } from '~/lib/color-generator';

Expand Down
2 changes: 1 addition & 1 deletion modules/posts/featured-post-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import clsx from 'clsx';
import * as React from 'react';
import { PostMetadata } from '~/types/posts';
import type { PostMetadata } from '~/types/posts';
import { FeaturedPostListItem } from './featured-post-list-item';

export interface FeaturedPostListProps extends React.ComponentPropsWithoutRef<'div'> {
Expand Down
2 changes: 1 addition & 1 deletion modules/posts/post-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import convert from 'htmr';

import { Container, ContainerSizes } from '~/components/layout';
import { SyndicationFormat } from '~/types/default';
import type { SyndicationFormat } from '~/types/default';
import htmrTransform from '~/lib/htmr-transform';
import { SiteAuthor } from '~/lib/data/site-metadata';
import { MessageBox } from '~/components/ui/message-box';
Expand Down
2 changes: 1 addition & 1 deletion modules/posts/post-header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Container } from '~/components/layout';
import { PostKind } from '~/types/default';
import type { PostKind } from '~/types/default';
import { PostMeta } from './post-meta';

export interface PostHeaderProps {
Expand Down
2 changes: 1 addition & 1 deletion modules/posts/post-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import clsx from 'clsx';
import Link from 'next/link';

import { PostMetadata } from '~/types/posts';
import type { PostMetadata } from '~/types/posts';
import { formatPostDate } from '~/lib/date-formatter';

export interface PostListItemProps extends React.ComponentPropsWithoutRef<'article'> {
Expand Down
2 changes: 1 addition & 1 deletion modules/posts/post-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import clsx from 'clsx';
import * as React from 'react';
import { PostMetadata } from '~/types/posts';
import type { PostMetadata } from '~/types/posts';
import { PostListItem } from './post-list-item';

export interface PostListProps extends React.ComponentPropsWithoutRef<'div'> {
Expand Down
2 changes: 1 addition & 1 deletion modules/posts/post-meta.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { PostKind } from '~/types/default';
import type { PostKind } from '~/types/default';
import siteMetadata from '~/lib/data/site-metadata';
import { slugByCategory } from './utils/slug-by-category';
import { PostDate } from './post-date';
Expand Down
2 changes: 1 addition & 1 deletion modules/posts/utils/get-category-slug.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PostKind } from '~/types/default';
import type { PostKind } from '~/types/default';

function getCategorySlug(category: PostKind = 'article') {
switch (category) {
Expand Down
2 changes: 1 addition & 1 deletion modules/posts/utils/slug-by-category.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PostKind } from '~/types/default';
import type { PostKind } from '~/types/default';

export function slugByCategory(slug?: string, category: PostKind = 'article') {
switch (category) {
Expand Down
2 changes: 1 addition & 1 deletion modules/projects/featured-project-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import Image from 'next/legacy/image';
import Link from 'next/link';
import clsx from 'clsx';
import { BaseProjectProps } from '~/types/projects';
import type { BaseProjectProps } from '~/types/projects';
import { ProjectBadge } from './project-badge';

export interface FeaturedProjectCardProps extends React.ComponentPropsWithoutRef<'section'> {
Expand Down
2 changes: 1 addition & 1 deletion modules/projects/featured-project-section.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import clsx from 'clsx';

import { BaseProjectProps } from '~/types/projects';
import type { BaseProjectProps } from '~/types/projects';
import { FeaturedProjectCard } from './featured-project-card';

export interface FeaturedProjectSectionProps extends React.ComponentPropsWithoutRef<'section'> {
Expand Down
2 changes: 1 addition & 1 deletion modules/projects/project-header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import clsx from 'clsx';
import Image from 'next/legacy/image';
import { ProjectMetadata } from '~/types/projects';
import type { ProjectMetadata } from '~/types/projects';
import { Container } from '~/components/layout';
import { PageMetaItem } from '~/components/page';

Expand Down
2 changes: 1 addition & 1 deletion modules/projects/project-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import Link from 'next/link';
import clsx from 'clsx';
import Image from 'next/legacy/image';
import { ProjectMetadata } from '~/types/projects';
import type { ProjectMetadata } from '~/types/projects';
import { ProjectBadge } from './project-badge';

export interface ProjectFieldProps extends React.ComponentPropsWithoutRef<'article'> {
Expand Down
2 changes: 1 addition & 1 deletion modules/projects/project-section.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import clsx from 'clsx';

import { ProjectMetadata } from '~/types/projects';
import type { ProjectMetadata } from '~/types/projects';
import { ProjectItem } from './project-item';

export interface ProjectSectionProps extends React.ComponentPropsWithoutRef<'section'> {
Expand Down
2 changes: 1 addition & 1 deletion modules/video/renderFeaturedVideo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import convert from 'htmr';
import Link from 'next/link';
import * as React from 'react';
import { BaseJamProps, BaseVideoProps } from '~/types/posts';
import type { BaseJamProps, BaseVideoProps } from '~/types/posts';
import htmrTransform from '~/lib/htmr-transform';
import { PostMeta } from '../posts';
import { LiteYouTube } from './lite-youtube';
Expand Down
2 changes: 1 addition & 1 deletion modules/video/renderVideoList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import convert from 'htmr';
import Link from 'next/link';
import * as React from 'react';
import { BaseJamProps, BaseVideoProps } from '~/types/posts';
import type { BaseJamProps, BaseVideoProps } from '~/types/posts';
import htmrTransform from '~/lib/htmr-transform';
import { PostDate } from '../posts/post-date';
import { LiteYouTube } from './lite-youtube';
Expand Down
2 changes: 1 addition & 1 deletion pages/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { YouTubePreconnect } from '~/components/perf';
import { Post, PostHeader, PostHeaderImage } from '~/modules/posts';
import CustomErrorPage from '~/pages/_error';
import siteMetadata from '~/lib/data/site-metadata';
import { BasePageProps } from '~/types/posts';
import type { BasePageProps } from '~/types/posts';
import DefaultLayout from '~/layouts/default-layout';
import { PageBody } from '~/components/page';
import { getPageBySlug } from '~/lib/item-by-slug';
Expand Down
2 changes: 1 addition & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { defaultOpenGraph, defaultTwitterCard } from '~/lib/seo';
import { event, pageview } from '~/lib/ga';
import { trpc } from '~/lib/trpc';
import siteMetadata from '~/lib/data/site-metadata';
import { NextAppProps } from '~/types/next';
import type { NextAppProps } from '~/types/next';

import '~/fonts/jetbrains-mono.css';
import 'typeface-inter';
Expand Down
25 changes: 13 additions & 12 deletions pages/bookmarks.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { InferGetStaticPropsType, NextPage } from 'next';
import { InferGetStaticPropsType } from 'next';
import * as React from 'react';
import { MainContent } from '~/components/layout';
import DefaultLayout from '~/layouts/default-layout';
import { getAllPosts } from '~/lib/posts';
import { BookmarkList } from '~/modules/bookmarks';
import { Post, PostBody, PostHeader } from '~/modules/posts';
import { BaseBookmarkProps } from '~/types/posts';
import type { NextPage } from '~/types/next';
import type { BaseBookmarkProps } from '~/types/posts';

export const getStaticProps = async () => {
const bookmarks: BaseBookmarkProps[] = await getAllPosts(
Expand All @@ -20,17 +21,17 @@ type BookmarksPageProps = InferGetStaticPropsType<typeof getStaticProps>;

const BookmarksPage: NextPage<BookmarksPageProps> = ({ bookmarks }) => {
return (
<DefaultLayout>
<MainContent pageTitle="Bookmarks" pageDescription="@resir014's reading list.">
<Post>
<PostHeader title="Bookmarks" lead="@resir014's reading list." />
<PostBody>
<BookmarkList bookmarks={bookmarks} />
</PostBody>
</Post>
</MainContent>
</DefaultLayout>
<MainContent pageTitle="Bookmarks" pageDescription="@resir014's reading list.">
<Post>
<PostHeader title="Bookmarks" lead="@resir014's reading list." />
<PostBody>
<BookmarkList bookmarks={bookmarks} />
</PostBody>
</Post>
</MainContent>
);
};

BookmarksPage.layout = page => <DefaultLayout>{page}</DefaultLayout>;

export default BookmarksPage;
30 changes: 15 additions & 15 deletions pages/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NextPage } from 'next';
import * as React from 'react';
import { MainContent } from '~/components/layout';
import { PageBody } from '~/components/page';
Expand All @@ -7,24 +6,25 @@ import DefaultLayout from '~/layouts/default-layout';
import { LiveStreamDashboard } from '~/modules/live/live-stream-dashboard';
import { Post, PostHeader } from '~/modules/posts';
import { SpotifyDashboard } from '~/modules/spotify/spotify-dashboard';
import type { NextPage } from '~/types/next';

const DashboardPage: NextPage = () => {
return (
<DefaultLayout>
<MainContent pageTitle="Dashboard">
<Post>
<PostHeader title="Dashboard" />
<PageBody>
<div className="space-y-12">
<LiveStreamDashboard username="resir014" />
<Divider size="lg" />
<SpotifyDashboard />
</div>
</PageBody>
</Post>
</MainContent>
</DefaultLayout>
<MainContent pageTitle="Dashboard">
<Post>
<PostHeader title="Dashboard" />
<PageBody>
<div className="space-y-12">
<LiveStreamDashboard username="resir014" />
<Divider size="lg" />
<SpotifyDashboard />
</div>
</PageBody>
</Post>
</MainContent>
);
};

DashboardPage.layout = page => <DefaultLayout>{page}</DefaultLayout>;

export default DashboardPage;
33 changes: 15 additions & 18 deletions pages/design.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
import { NextPage } from 'next';
import * as React from 'react';
import { MainContent } from '~/components/layout';
import DefaultLayout from '~/layouts/default-layout';
import { ColorSpecs, LogoSpecs, TypographySpecs } from '~/modules/design';
import { Post, PostBody, PostHeader } from '~/modules/posts';
import type { NextPage } from '~/types/next';

const DesignPage: NextPage = () => {
return (
<DefaultLayout>
<MainContent
pageTitle="Brand & Design"
pageDescription="Design assets for the resir014 brand."
>
<Post>
<PostHeader title="Brand & Design" />
<PostBody>
<div className="prose lg:prose-lg prose-base prose-invert prose-chungking">
<LogoSpecs />
<TypographySpecs />
<ColorSpecs />
</div>
</PostBody>
</Post>
</MainContent>
</DefaultLayout>
<MainContent pageTitle="Brand & Design" pageDescription="Design assets for the resir014 brand.">
<Post>
<PostHeader title="Brand & Design" />
<PostBody>
<div className="prose lg:prose-lg prose-base prose-invert prose-chungking">
<LogoSpecs />
<TypographySpecs />
<ColorSpecs />
</div>
</PostBody>
</Post>
</MainContent>
);
};

DesignPage.layout = page => <DefaultLayout>{page}</DefaultLayout>;

export default DesignPage;
2 changes: 1 addition & 1 deletion pages/etc/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Post, PostBody, PostHeader, PostHeaderImage } from '~/modules/posts';
import CustomErrorPage from '~/pages/_error';
import { getAllPages } from '~/lib/pages';
import siteMetadata from '~/lib/data/site-metadata';
import { BasePageProps } from '~/types/posts';
import type { BasePageProps } from '~/types/posts';
import DefaultLayout from '~/layouts/default-layout';
import { getPageBySlug } from '~/lib/item-by-slug';

Expand Down
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getFeaturedVideo,
} from '~/lib/posts';
import { getFeaturedProject } from '~/lib/projects';
import {
import type {
BaseBookmarkProps,
BaseJamProps,
BasePhotoProps,
Expand Down
2 changes: 1 addition & 1 deletion pages/jam/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { LiteYouTube, VideoCard } from '~/modules/video';
import { YouTubePreconnect } from '~/components/perf';
import { Post, PostBody, PostHeader } from '~/modules/posts';
import CustomErrorPage from '~/pages/_error';
import { BaseJamProps } from '~/types/posts';
import type { BaseJamProps } from '~/types/posts';
import siteMetadata, { SiteMetadata } from '~/lib/data/site-metadata';
import DefaultLayout from '~/layouts/default-layout';

Expand Down
Loading

0 comments on commit a0aaba4

Please sign in to comment.