From 520dce22c1b037232401c4b6ddf5a90346da41a0 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Wed, 11 Sep 2024 00:03:13 +0800 Subject: [PATCH] style: lint fix --- cli/src/generate.ts | 4 +- cli/src/index.ts | 2 +- cli/src/locales/index.ts | 2 +- cli/src/packageJson.ts | 4 +- cli/src/prompt.ts | 4 +- cli/src/render.ts | 2 +- cli/src/run.ts | 10 ++-- cli/src/translate.ts | 2 +- cli/src/utils/fs.ts | 2 +- cli/src/utils/index.ts | 4 +- docs/.vuepress/client.ts | 6 +- docs/.vuepress/config.ts | 2 +- docs/.vuepress/notes/zh/index.ts | 4 +- docs/.vuepress/plume.config.ts | 2 +- .../.vuepress/themes/components/ColorPick.vue | 2 +- .../themes/components/Contributors.vue | 17 ++++-- .../themes/components/CustomTintPlate.vue | 2 +- .../themes/components/HeroTintPlateConfig.vue | 6 +- .../themes/components/ThemeColors.vue | 2 +- docs/.vuepress/themes/composables/caniuse.ts | 2 +- .../themes/composables/theme-colors.ts | 2 +- docs/README.md | 6 +- docs/notes/plugins/caniuse.md | 2 +- docs/notes/plugins/content-updated.md | 4 +- docs/notes/theme/config/plugins/README.md | 2 +- .../theme/config/plugins/markdownPower.md | 2 +- .../theme/config/plugins/markdown增强.md | 2 +- docs/notes/theme/config/plugins/代码高亮.md | 2 +- docs/notes/theme/config/plugins/阅读统计.md | 2 +- docs/notes/theme/config/配置说明.md | 6 +- docs/notes/theme/guide/api-客户端.md | 2 +- docs/notes/theme/guide/博客.md | 2 +- docs/notes/theme/guide/国际化.md | 2 +- docs/notes/theme/guide/安装与使用.md | 2 +- docs/notes/theme/guide/布局插槽.md | 2 +- docs/notes/theme/guide/组件覆写.md | 4 +- docs/notes/theme/guide/自定义样式.md | 4 +- docs/notes/theme/snippet/include-1.snippet.md | 4 +- .../plugin-content-update/src/node/plugin.ts | 2 +- plugins/plugin-content-update/tsup.config.ts | 2 +- plugins/plugin-fonts/src/node/plugin.ts | 2 +- plugins/plugin-fonts/tsup.config.ts | 2 +- .../src/client/components/CanIUse.vue | 2 +- .../src/client/components/CodeEditor.vue | 4 +- .../src/client/components/CodeRepl.vue | 4 +- .../src/client/components/PDFViewer.vue | 4 +- .../src/client/components/Plot.vue | 4 +- .../src/client/components/Replit.vue | 2 +- .../src/client/composables/codeRepl.ts | 2 +- .../src/client/composables/pdf.ts | 8 +-- .../src/client/composables/size.ts | 4 +- .../plugin-md-power/src/client/utils/link.ts | 2 +- .../src/node/features/caniuse.ts | 8 +-- .../src/node/features/codeSandbox.ts | 6 +- .../src/node/features/codepen.ts | 6 +- .../src/node/features/fileTree/findIcon.ts | 2 +- .../src/node/features/fileTree/index.ts | 6 +- .../features/fileTree/resolveTreeNodeInfo.ts | 2 +- .../src/node/features/imageSize.ts | 12 ++-- .../src/node/features/jsfiddle.ts | 6 +- .../src/node/features/langRepl.ts | 4 +- .../plugin-md-power/src/node/features/pdf.ts | 6 +- .../src/node/features/replit.ts | 6 +- .../src/node/features/video/bilibili.ts | 8 +-- .../src/node/features/video/youtube.ts | 8 +-- plugins/plugin-md-power/src/node/index.ts | 2 +- plugins/plugin-md-power/src/node/plugin.ts | 24 ++++---- .../src/node/prepareConfigFile.ts | 2 +- plugins/plugin-md-power/src/shared/index.ts | 14 ++--- plugins/plugin-md-power/src/shared/plugin.ts | 2 +- plugins/plugin-md-power/tsup.config.ts | 2 +- .../src/client/components/Search.vue | 2 +- .../src/client/components/SearchBox.vue | 34 +++++------ .../src/client/components/SearchButton.vue | 2 +- .../src/client/composables/index.ts | 2 +- .../src/client/composables/locale.ts | 4 +- plugins/plugin-search/src/client/config.ts | 4 +- plugins/plugin-search/src/node/index.ts | 2 +- .../src/node/prepareSearchIndex.ts | 2 +- .../plugin-search/src/node/searchPlugin.ts | 8 +-- plugins/plugin-search/src/shared/index.ts | 2 +- plugins/plugin-search/tsup.config.ts | 2 +- .../src/client/composables/twoslash.ts | 2 +- .../copy-code-button/copyCodeButtonPlugin.ts | 2 +- .../createCopyCodeButtonRender.ts | 4 +- .../src/node/copy-code-button/index.ts | 2 +- .../src/node/highlight/highlight.ts | 6 +- .../src/node/highlight/transformers.ts | 8 +-- .../src/node/markdown/preWrapperPlugin.ts | 2 +- .../src/node/prepareClientConfigFile.ts | 10 ++-- .../plugin-shikiji/src/node/shikiPlugin.ts | 16 ++--- .../node/twoslash/renderer-floating-vue.ts | 6 +- .../src/node/twoslash/rendererTransformer.ts | 10 ++-- .../plugin-shikiji/src/node/utils/index.ts | 4 +- plugins/plugin-shikiji/tsup.config.ts | 2 +- theme/src/client/components/Blog/VPBlog.vue | 6 +- .../client/components/Blog/VPBlogExtract.vue | 2 +- .../src/client/components/Blog/VPBlogNav.vue | 2 +- .../client/components/Blog/VPBlogProfile.vue | 2 +- .../client/components/Blog/VPCategories.vue | 2 +- .../components/Blog/VPCategoriesGroup.vue | 4 +- .../src/client/components/Blog/VPPostItem.vue | 4 +- .../src/client/components/Blog/VPPostList.vue | 6 +- theme/src/client/components/Home/VPHome.vue | 16 ++--- .../client/components/Home/VPHomeBanner.vue | 6 +- .../src/client/components/Home/VPHomeBox.vue | 4 +- .../client/components/Home/VPHomeCustom.vue | 2 +- .../client/components/Home/VPHomeFeature.vue | 2 +- .../client/components/Home/VPHomeFeatures.vue | 4 +- .../src/client/components/Home/VPHomeHero.vue | 4 +- .../client/components/Home/VPHomeProfile.vue | 6 +- .../components/Home/VPHomeTextImage.vue | 4 +- theme/src/client/components/Nav/VPNav.vue | 2 +- theme/src/client/components/Nav/VPNavBar.vue | 4 +- .../client/components/Nav/VPNavBarExtra.vue | 2 +- .../components/Nav/VPNavBarMenuGroup.vue | 6 +- .../components/Nav/VPNavBarMenuLink.vue | 8 +-- .../components/Nav/VPNavBarSocialLinks.vue | 2 +- .../client/components/Nav/VPNavBarTitle.vue | 4 +- .../src/client/components/Nav/VPNavScreen.vue | 2 +- .../components/Nav/VPNavScreenMenuGroup.vue | 4 +- .../Nav/VPNavScreenMenuGroupLink.vue | 4 +- .../Nav/VPNavScreenMenuGroupSection.vue | 2 +- .../components/Nav/VPNavScreenMenuLink.vue | 4 +- .../Nav/VPNavScreenTranslations.vue | 2 +- theme/src/client/components/VPContent.vue | 6 +- theme/src/client/components/VPDoc.vue | 12 ++-- .../client/components/VPDocAsideOutline.vue | 2 +- .../client/components/VPDocBreadcrumbs.vue | 2 +- theme/src/client/components/VPDocFooter.vue | 2 +- theme/src/client/components/VPDocMeta.vue | 2 +- .../src/client/components/VPEncryptGlobal.vue | 4 +- theme/src/client/components/VPFlyout.vue | 2 +- theme/src/client/components/VPFriends.vue | 6 +- theme/src/client/components/VPFriendsItem.vue | 4 +- theme/src/client/components/VPIcon.vue | 6 +- theme/src/client/components/VPIconify.vue | 4 +- theme/src/client/components/VPLocalNav.vue | 2 +- .../components/VPLocalNavOutlineDropdown.vue | 4 +- theme/src/client/components/VPMenuLink.vue | 2 +- theme/src/client/components/VPSidebar.vue | 4 +- .../src/client/components/VPSidebarGroup.vue | 2 +- theme/src/client/components/VPSidebarItem.vue | 4 +- .../client/components/VPSwitchAppearance.vue | 2 +- .../client/components/global/VPCardGrid.vue | 2 +- .../client/components/global/VPLinkCard.vue | 2 +- theme/src/client/composables/blog-archives.ts | 2 +- theme/src/client/composables/blog-data.ts | 2 +- theme/src/client/composables/blog-extract.ts | 2 +- .../src/client/composables/blog-post-list.ts | 4 +- theme/src/client/composables/blog-tags.ts | 4 +- theme/src/client/composables/data.ts | 6 +- theme/src/client/composables/edit-link.ts | 4 +- theme/src/client/composables/encrypt.ts | 6 +- theme/src/client/composables/home.ts | 4 +- theme/src/client/composables/index.ts | 60 +++++++++---------- theme/src/client/composables/internal-link.ts | 2 +- theme/src/client/composables/langs.ts | 4 +- .../src/client/composables/latest-updated.ts | 2 +- theme/src/client/composables/link.ts | 2 +- theme/src/client/composables/nav.ts | 8 +-- theme/src/client/composables/outline.ts | 4 +- theme/src/client/composables/page.ts | 2 +- theme/src/client/composables/prev-next.ts | 6 +- theme/src/client/composables/route-query.ts | 8 +-- .../src/client/composables/scroll-behavior.ts | 2 +- theme/src/client/composables/sidebar.ts | 8 +-- theme/src/client/composables/theme-data.ts | 2 +- theme/src/client/config.ts | 4 +- .../client/features/components/NpmBadge.vue | 2 +- .../features/components/NpmBadgeGroup.vue | 2 +- theme/src/client/globalComponents.ts | 10 ++-- theme/src/client/index.ts | 34 +++++------ theme/src/client/layouts/Layout.vue | 16 ++--- theme/src/client/layouts/NotFound.vue | 4 +- theme/src/client/utils/index.ts | 4 +- theme/src/client/utils/resolveNavLink.ts | 2 +- theme/src/node/autoFrontmatter/generator.ts | 10 ++-- theme/src/node/autoFrontmatter/readFile.ts | 2 +- .../node/autoFrontmatter/resolveOptions.ts | 22 +++---- theme/src/node/config/index.ts | 20 +++---- theme/src/node/config/resolveLocaleOptions.ts | 2 +- theme/src/node/config/resolveNotesOptions.ts | 4 +- theme/src/node/config/resolveProvideData.ts | 4 +- theme/src/node/config/resolveSearchOptions.ts | 2 +- theme/src/node/config/resolveThemeData.ts | 2 +- theme/src/node/config/resolveThemeOption.ts | 2 +- .../src/node/config/templateBuildRenderer.ts | 2 +- theme/src/node/defineConfig.ts | 2 +- theme/src/node/index.ts | 2 +- theme/src/node/loadConfig/compiler.ts | 2 +- theme/src/node/loadConfig/findConfigPath.ts | 2 +- theme/src/node/loadConfig/index.ts | 2 +- theme/src/node/loadConfig/loader.ts | 12 ++-- theme/src/node/locales/index.ts | 4 +- theme/src/node/plugins/getPlugins.ts | 18 +++--- theme/src/node/plugins/index.ts | 2 +- theme/src/node/prepare/index.ts | 4 +- theme/src/node/prepare/prepareBlogData.ts | 8 +-- theme/src/node/prepare/prepareEncrypt.ts | 4 +- theme/src/node/prepare/prepareIcons.ts | 11 ++-- theme/src/node/prepare/prepareSidebar.ts | 4 +- theme/src/node/setupPages.ts | 8 +-- theme/src/node/theme.ts | 12 ++-- theme/src/node/utils/index.ts | 4 +- theme/src/node/utils/path.ts | 2 +- theme/src/shared/frontmatter/index.ts | 6 +- theme/src/shared/index.ts | 12 ++-- theme/src/shared/options/index.ts | 4 +- theme/src/shared/options/locale.ts | 2 +- theme/src/shared/options/plugins.ts | 6 +- theme/src/shared/theme-data.ts | 4 +- theme/tsup.config.ts | 4 +- 213 files changed, 541 insertions(+), 533 deletions(-) diff --git a/cli/src/generate.ts b/cli/src/generate.ts index 77e2184b..b48a6325 100644 --- a/cli/src/generate.ts +++ b/cli/src/generate.ts @@ -1,12 +1,12 @@ +import fs from 'node:fs' import path from 'node:path' import process from 'node:process' -import fs from 'node:fs' import { execaCommand } from 'execa' +import { DeployType, Mode } from './constants.js' import { createPackageJson } from './packageJson.js' import { createRender } from './render.js' import { getTemplate, readFiles, readJsonFile, writeFiles } from './utils/index.js' import type { File, ResolvedData } from './types.js' -import { DeployType, Mode } from './constants.js' export async function generate(mode: Mode, data: ResolvedData): Promise { const cwd = process.cwd() diff --git a/cli/src/index.ts b/cli/src/index.ts index d7d14ffe..8291f080 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -1,6 +1,6 @@ import cac from 'cac' -import { run } from './run.js' import { Mode } from './constants.js' +import { run } from './run.js' declare const __CLI_VERSION__: string diff --git a/cli/src/locales/index.ts b/cli/src/locales/index.ts index 133b7b48..952b5551 100644 --- a/cli/src/locales/index.ts +++ b/cli/src/locales/index.ts @@ -1,6 +1,6 @@ -import type { Langs, Locale } from '../types.js' import { en } from './en.js' import { zh } from './zh.js' +import type { Langs, Locale } from '../types.js' export const locales: Record = { 'zh-CN': zh, diff --git a/cli/src/packageJson.ts b/cli/src/packageJson.ts index c888bed3..95bae4a8 100644 --- a/cli/src/packageJson.ts +++ b/cli/src/packageJson.ts @@ -1,8 +1,8 @@ -import { execaCommand } from 'execa' import { kebabCase } from '@pengzhanbo/utils' +import { execaCommand } from 'execa' +import { Mode } from './constants.js' import { getDependenciesVersion, readJsonFile, resolve } from './utils/index.js' import type { File, ResolvedData } from './types.js' -import { Mode } from './constants.js' export async function createPackageJson( mode: Mode, diff --git a/cli/src/prompt.ts b/cli/src/prompt.ts index 7d048ea4..ebca1587 100644 --- a/cli/src/prompt.ts +++ b/cli/src/prompt.ts @@ -1,9 +1,9 @@ -import process from 'node:process' import { createRequire } from 'node:module' +import process from 'node:process' import { cancel, confirm, group, select, text } from '@clack/prompts' +import { bundlerOptions, deployOptions, DeployType, languageOptions, Mode } from './constants.js' import { setLang, t } from './translate.js' import type { Bundler, Langs, Options, PromptResult } from './types.js' -import { DeployType, Mode, bundlerOptions, deployOptions, languageOptions } from './constants.js' const require = createRequire(process.cwd()) diff --git a/cli/src/render.ts b/cli/src/render.ts index 99de1e4f..04371fe2 100644 --- a/cli/src/render.ts +++ b/cli/src/render.ts @@ -1,5 +1,5 @@ -import handlebars from 'handlebars' import { kebabCase } from '@pengzhanbo/utils' +import handlebars from 'handlebars' import type { ResolvedData } from './types.js' export interface RenderData extends ResolvedData { diff --git a/cli/src/run.ts b/cli/src/run.ts index 06544d98..a31d1189 100644 --- a/cli/src/run.ts +++ b/cli/src/run.ts @@ -1,14 +1,14 @@ -import process from 'node:process' import path from 'node:path' +import process from 'node:process' import { intro, outro, spinner } from '@clack/prompts' import { execaCommand } from 'execa' import colors from 'picocolors' -import { prompt } from './prompt.js' -import { generate } from './generate.js' -import { t } from './translate.js' import { Mode } from './constants.js' -import type { PromptResult, ResolvedData } from './types.js' +import { generate } from './generate.js' +import { prompt } from './prompt.js' +import { t } from './translate.js' import { getPackageManager } from './utils/index.js' +import type { PromptResult, ResolvedData } from './types.js' export async function run(mode: Mode, root?: string) { intro(colors.cyan('Welcome to VuePress and vuepress-theme-plume !')) diff --git a/cli/src/translate.ts b/cli/src/translate.ts index 9fdf0aa4..1feeac11 100644 --- a/cli/src/translate.ts +++ b/cli/src/translate.ts @@ -1,5 +1,5 @@ -import type { Langs, Locale } from './types.js' import { locales } from './locales/index.js' +import type { Langs, Locale } from './types.js' function createTranslate(lang?: Langs) { let current: Langs = lang || 'en-US' diff --git a/cli/src/utils/fs.ts b/cli/src/utils/fs.ts index ef4f2ce6..b83c8db0 100644 --- a/cli/src/utils/fs.ts +++ b/cli/src/utils/fs.ts @@ -1,5 +1,5 @@ -import path from 'node:path' import fs from 'node:fs/promises' +import path from 'node:path' import type { File } from '../types.js' export async function readFiles(root: string): Promise { diff --git a/cli/src/utils/index.ts b/cli/src/utils/index.ts index 311366a3..5d48509b 100644 --- a/cli/src/utils/index.ts +++ b/cli/src/utils/index.ts @@ -1,5 +1,5 @@ -import { fileURLToPath } from 'node:url' import path from 'node:path' +import { fileURLToPath } from 'node:url' export const __dirname = path.dirname(fileURLToPath(import.meta.url)) @@ -7,6 +7,6 @@ export const resolve = (...args: string[]) => path.resolve(__dirname, '../', ... export const getTemplate = (dir: string) => resolve('templates', dir) -export * from './fs.js' export * from './depsVersion.js' +export * from './fs.js' export * from './getPackageManager.js' diff --git a/docs/.vuepress/client.ts b/docs/.vuepress/client.ts index 4788225a..71f2aeba 100644 --- a/docs/.vuepress/client.ts +++ b/docs/.vuepress/client.ts @@ -1,9 +1,9 @@ import { type ClientConfig, defineClientConfig } from 'vuepress/client' -import HeroTintPlateConfig from './themes/components/HeroTintPlateConfig.vue' import CanIUseConfig from './themes/components/CanIUseConfig.vue' -import Demos from './themes/components/Demos.vue' -import ThemeColors from './themes/components/ThemeColors.vue' import Contributors from './themes/components/Contributors.vue' +import Demos from './themes/components/Demos.vue' +import HeroTintPlateConfig from './themes/components/HeroTintPlateConfig.vue' +import ThemeColors from './themes/components/ThemeColors.vue' import { setupThemeColors } from './themes/composables/theme-colors.js' export default defineClientConfig({ diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 67ddda33..c3609e6a 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -1,7 +1,7 @@ import * as path from 'node:path' -import { type UserConfig, defineUserConfig } from 'vuepress' import { viteBundler } from '@vuepress/bundler-vite' import { addViteOptimizeDepsInclude, addViteSsrExternal } from '@vuepress/helper' +import { defineUserConfig, type UserConfig } from 'vuepress' import { peerDependencies } from '../package.json' import { theme } from './theme.js' diff --git a/docs/.vuepress/notes/zh/index.ts b/docs/.vuepress/notes/zh/index.ts index fed5583d..c2116c11 100644 --- a/docs/.vuepress/notes/zh/index.ts +++ b/docs/.vuepress/notes/zh/index.ts @@ -1,7 +1,7 @@ import { defineNotesConfig } from 'vuepress-theme-plume' -import { themeGuide } from './theme-guide' -import { themeConfig } from './theme-config' import { plugins } from './plugins' +import { themeConfig } from './theme-config' +import { themeGuide } from './theme-guide' import { tools } from './tools' export const zhNotes = defineNotesConfig({ diff --git a/docs/.vuepress/plume.config.ts b/docs/.vuepress/plume.config.ts index c835f5e7..f6011830 100644 --- a/docs/.vuepress/plume.config.ts +++ b/docs/.vuepress/plume.config.ts @@ -1,6 +1,6 @@ import { defineThemeConfig } from 'vuepress-theme-plume' -import { enNotes, zhNotes } from './notes/index.js' import { enNavbar, zhNavbar } from './navbar.js' +import { enNotes, zhNotes } from './notes/index.js' export default defineThemeConfig({ logo: '/plume.png', diff --git a/docs/.vuepress/themes/components/ColorPick.vue b/docs/.vuepress/themes/components/ColorPick.vue index a1292026..38b9bd69 100644 --- a/docs/.vuepress/themes/components/ColorPick.vue +++ b/docs/.vuepress/themes/components/ColorPick.vue @@ -1,6 +1,6 @@ diff --git a/docs/.vuepress/themes/components/CustomTintPlate.vue b/docs/.vuepress/themes/components/CustomTintPlate.vue index fbd10999..919882e2 100644 --- a/docs/.vuepress/themes/components/CustomTintPlate.vue +++ b/docs/.vuepress/themes/components/CustomTintPlate.vue @@ -1,6 +1,6 @@ diff --git a/docs/.vuepress/themes/composables/caniuse.ts b/docs/.vuepress/themes/composables/caniuse.ts index bead1ff9..04b97078 100644 --- a/docs/.vuepress/themes/composables/caniuse.ts +++ b/docs/.vuepress/themes/composables/caniuse.ts @@ -1,5 +1,5 @@ -import { type Ref, computed, onMounted, readonly, ref, watch } from 'vue' import { onClickOutside, useDebounceFn, useEventListener, useLocalStorage } from '@vueuse/core' +import { computed, onMounted, readonly, type Ref, ref, watch } from 'vue' interface Feature { label: string diff --git a/docs/.vuepress/themes/composables/theme-colors.ts b/docs/.vuepress/themes/composables/theme-colors.ts index 5572c854..085f3046 100644 --- a/docs/.vuepress/themes/composables/theme-colors.ts +++ b/docs/.vuepress/themes/composables/theme-colors.ts @@ -1,5 +1,5 @@ -import { type InjectionKey, type Ref, inject, provide, watch } from 'vue' import { useSessionStorage, useStyleTag } from '@vueuse/core' +import { inject, type InjectionKey, provide, type Ref, watch } from 'vue' export interface ThemeColor { name: string diff --git a/docs/README.md b/docs/README.md index 3006c461..ba6300ed 100644 --- a/docs/README.md +++ b/docs/README.md @@ -172,12 +172,12 @@ export default defineUserConfig({ diff --git a/docs/notes/plugins/caniuse.md b/docs/notes/plugins/caniuse.md index bf66ddae..6be59f49 100644 --- a/docs/notes/plugins/caniuse.md +++ b/docs/notes/plugins/caniuse.md @@ -49,8 +49,8 @@ pnpm add @vuepress-plume/plugin-caniuse @tab .vuepress/config.ts ``` ts -import { defineUserConfig } from 'vuepress' import { caniusePlugin } from '@vuepress-plume/plugin-caniuse' +import { defineUserConfig } from 'vuepress' export default defineUserConfig({ plugins: [ diff --git a/docs/notes/plugins/content-updated.md b/docs/notes/plugins/content-updated.md index 84e00f9e..1ae07e30 100644 --- a/docs/notes/plugins/content-updated.md +++ b/docs/notes/plugins/content-updated.md @@ -56,8 +56,8 @@ yarn add @vuepress-plume/plugin-content-update @tab .vuepress/config.ts ``` ts -import { defineUserConfig } from 'vuepress' import { contentUpdatePlugin } from '@vuepress-plume/plugin-content-update' +import { defineUserConfig } from 'vuepress' export default defineUserConfig({ plugins: [ @@ -86,8 +86,8 @@ onContentUpdated(() => { ```vue