diff --git a/src/App.tsx b/src/App.tsx index cdf35ac..53056eb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,13 @@ -import { Component, createEffect, createMemo, For, Index, Match, Show, Switch } from 'solid-js'; +import { + For, + Index, + Match, + Show, + Switch, + createEffect, + createMemo, + type Component, +} from 'solid-js'; import { Portal } from 'solid-js/web'; import { version } from '../package.json'; import CommentBox from './components/CommentBox'; diff --git a/src/ComponentEntry.tsx b/src/ComponentEntry.tsx index ab1734d..cdd4c4a 100644 --- a/src/ComponentEntry.tsx +++ b/src/ComponentEntry.tsx @@ -2,7 +2,7 @@ import type { Component } from 'solid-js'; import App from './App'; import configProvider from './controllers/configProvider'; -import SodesuInitOptions from './types/SodesuInitOptions'; +import type SodesuInitOptions from './types/SodesuInitOptions'; const ComponentEntry: Component> = (prop) => { const { path = window.location.pathname } = prop; diff --git a/src/components/CommentBox.tsx b/src/components/CommentBox.tsx index 52d1b49..3301a80 100644 --- a/src/components/CommentBox.tsx +++ b/src/components/CommentBox.tsx @@ -1,4 +1,4 @@ -import { Component, createMemo, Show } from 'solid-js'; +import { Show, createMemo, type Component } from 'solid-js'; import commentBoxState, { submitComment } from '../controllers/commentBoxState'; import configProvider from '../controllers/configProvider'; import userInfoState, { openProfile } from '../controllers/userInfoState'; diff --git a/src/components/CommentBoxFooter.tsx b/src/components/CommentBoxFooter.tsx index 2439537..6c2bcdc 100644 --- a/src/components/CommentBoxFooter.tsx +++ b/src/components/CommentBoxFooter.tsx @@ -1,4 +1,4 @@ -import { Component, Show } from 'solid-js'; +import { Show, type Component } from 'solid-js'; import commentBoxState, { submitComment } from '../controllers/commentBoxState'; import configProvider from '../controllers/configProvider'; import userInfoState, { userLogin, userLogout } from '../controllers/userInfoState'; diff --git a/src/components/CommentCard.tsx b/src/components/CommentCard.tsx index 70ad9cc..2eb7048 100644 --- a/src/components/CommentCard.tsx +++ b/src/components/CommentCard.tsx @@ -1,5 +1,5 @@ import { createDateNow } from '@solid-primitives/date'; -import { Component, createMemo, Index, Show } from 'solid-js'; +import { Index, Show, createMemo, type Component } from 'solid-js'; import commentBoxState from '../controllers/commentBoxState'; import type { ReactiveComment } from '../controllers/commentListState'; import configProvider from '../controllers/configProvider'; diff --git a/src/components/CommentCardActions.tsx b/src/components/CommentCardActions.tsx index 9c2a3a6..6311734 100644 --- a/src/components/CommentCardActions.tsx +++ b/src/components/CommentCardActions.tsx @@ -1,9 +1,9 @@ import { deleteComment } from '@waline/client/dist/api'; -import { Component, createMemo, Show } from 'solid-js'; +import { type Component, createMemo, Show } from 'solid-js'; import commentBoxState, { clearReplyState } from '../controllers/commentBoxState'; import { deleteComment as deleteCommentFront, - ReactiveComment, + type ReactiveComment, } from '../controllers/commentListState'; import configProvider from '../controllers/configProvider'; import likeState, { handleLike } from '../controllers/likeState'; diff --git a/src/components/CommentMeta.tsx b/src/components/CommentMeta.tsx index 1c29d7f..25e07fd 100644 --- a/src/components/CommentMeta.tsx +++ b/src/components/CommentMeta.tsx @@ -1,4 +1,4 @@ -import { Component, Show } from 'solid-js'; +import { Show, type Component } from 'solid-js'; const CommentMeta: Component<{ addr?: string; browser?: string; os?: string }> = (props) => (
diff --git a/src/components/UserMeta.tsx b/src/components/UserMeta.tsx index d44ef85..8e5867b 100644 --- a/src/components/UserMeta.tsx +++ b/src/components/UserMeta.tsx @@ -1,4 +1,4 @@ -import { Component, createMemo, For } from 'solid-js'; +import { For, createMemo, type Component } from 'solid-js'; import { userMetaState } from '../controllers/commentBoxState'; import configProvider from '../controllers/configProvider'; diff --git a/src/controllers/commentBoxState.ts b/src/controllers/commentBoxState.ts index eb74029..faf0a98 100644 --- a/src/controllers/commentBoxState.ts +++ b/src/controllers/commentBoxState.ts @@ -1,8 +1,8 @@ -import { WalineCommentData } from '@waline/client'; +import { type WalineCommentData } from '@waline/client'; import { addComment, updateComment } from '@waline/client/dist/api'; import { createEffect, createMemo, createRoot, createSignal } from 'solid-js'; import { getWordNumber } from '../waline/utils/wordCount'; -import commentListState, { makeDataReactive, ReactiveComment } from './commentListState'; +import commentListState, { makeDataReactive, type ReactiveComment } from './commentListState'; import configProvider from './configProvider'; import userInfoState from './userInfoState'; diff --git a/src/controllers/commentListState.ts b/src/controllers/commentListState.ts index 4e1c4b1..acb1ddd 100644 --- a/src/controllers/commentListState.ts +++ b/src/controllers/commentListState.ts @@ -1,6 +1,6 @@ import type { WalineComment, WalineCommentSorting, WalineCommentStatus } from '@waline/client'; import { getComment } from '@waline/client/dist/api'; -import { Accessor, createRoot, createSignal, Setter } from 'solid-js'; +import { createRoot, createSignal, type Accessor, type Setter } from 'solid-js'; import configProvider from './configProvider'; // eslint-disable-next-line import/no-cycle import userInfoState from './userInfoState'; diff --git a/src/controllers/configProvider.ts b/src/controllers/configProvider.ts index 6e3be33..964a939 100644 --- a/src/controllers/configProvider.ts +++ b/src/controllers/configProvider.ts @@ -1,5 +1,6 @@ import { createEffect, createMemo, createRoot, createSignal, onMount } from 'solid-js'; -import SodesuInitOptions, { SodesuConfig, SodesuProps } from '../types/SodesuInitOptions'; +import type SodesuInitOptions from '../types/SodesuInitOptions'; +import type { SodesuConfig, SodesuProps } from '../types/SodesuInitOptions'; import { commentCount } from '../waline/comment'; import { pageviewCount } from '../waline/pageview'; import { getConfig } from '../waline/utils/config'; diff --git a/src/controllers/likeState.ts b/src/controllers/likeState.ts index a0036b1..c0eb60e 100644 --- a/src/controllers/likeState.ts +++ b/src/controllers/likeState.ts @@ -1,7 +1,7 @@ import { createStorageSignal } from '@solid-primitives/storage'; import { updateComment } from '@waline/client/dist/api'; import { createRoot } from 'solid-js'; -import { ReactiveComment } from './commentListState'; +import { type ReactiveComment } from './commentListState'; import configProvider from './configProvider'; import userInfoState from './userInfoState'; diff --git a/src/controllers/userInfoState.ts b/src/controllers/userInfoState.ts index 20cfcae..e61a853 100644 --- a/src/controllers/userInfoState.ts +++ b/src/controllers/userInfoState.ts @@ -1,5 +1,5 @@ import { createStorageSignal } from '@solid-primitives/storage'; -import { login, UserInfo } from '@waline/client/dist/api'; +import { login, type UserInfo } from '@waline/client/dist/api'; import { createMemo, createRoot, onCleanup, onMount } from 'solid-js'; // eslint-disable-next-line import/no-cycle import { refresh } from './commentListState'; diff --git a/src/index.tsx b/src/index.tsx index 24fb878..00954b4 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,7 +1,7 @@ import { render } from 'solid-js/web'; import App from './App'; import configProvider from './controllers/configProvider'; -import SodesuInitOptions from './types/SodesuInitOptions'; +import type SodesuInitOptions from './types/SodesuInitOptions'; const Sodesu = { init: (opt: SodesuInitOptions) => { diff --git a/src/waline/utils/date.ts b/src/waline/utils/date.ts index 6dcfb7c..98c2db4 100644 --- a/src/waline/utils/date.ts +++ b/src/waline/utils/date.ts @@ -1,4 +1,4 @@ -import { WalineDateLocale } from '../typings'; +import type { WalineDateLocale } from '../typings'; const padWithZeros = (vNumber: number, width: number): string => { let numAsString = vNumber.toString(); @@ -18,11 +18,7 @@ export const dateFormat = (date: Date): string => { return `${vYear}-${vMonth}-${vDay}`; }; -export const getTimeAgo = ( - date: Date | string, - now: Date, - locale: WalineDateLocale -): string => { +export const getTimeAgo = (date: Date | string, now: Date, locale: WalineDateLocale): string => { if (!date) return ''; const time = diff --git a/tsconfig.json b/tsconfig.json index 732010c..14e2e0c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,8 @@ "types": ["vite/client"], "isolatedModules": true, "skipLibCheck": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "verbatimModuleSyntax": true }, "exclude": ["dist"] }