Skip to content

Commit

Permalink
style: lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed Sep 10, 2024
1 parent 89e0cb0 commit 520dce2
Show file tree
Hide file tree
Showing 213 changed files with 510 additions and 502 deletions.
4 changes: 2 additions & 2 deletions cli/src/generate.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
const cwd = process.cwd()
Expand Down
2 changes: 1 addition & 1 deletion cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cli/src/locales/index.ts
Original file line number Diff line number Diff line change
@@ -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<Langs, Locale> = {
'zh-CN': zh,
Expand Down
4 changes: 2 additions & 2 deletions cli/src/packageJson.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions cli/src/prompt.ts
Original file line number Diff line number Diff line change
@@ -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())

Expand Down
2 changes: 1 addition & 1 deletion cli/src/render.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions cli/src/run.ts
Original file line number Diff line number Diff line change
@@ -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 { Mode } from './constants.js'
import { generate } from './generate.js'
import { prompt } from './prompt.js'
import { t } from './translate.js'
import { Mode } from './constants.js'
import type { PromptResult, ResolvedData } from './types.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 !'))
Expand Down
2 changes: 1 addition & 1 deletion cli/src/translate.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion cli/src/utils/fs.ts
Original file line number Diff line number Diff line change
@@ -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<File[]> {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { fileURLToPath } from 'node:url'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

export const __dirname = path.dirname(fileURLToPath(import.meta.url))

export const resolve = (...args: string[]) => path.resolve(__dirname, '../', ...args)

export const getTemplate = (dir: string) => resolve('templates', dir)

export * from './fs.js'
export * from './depsVersion.js'
export * from './fs.js'
export * from './getPackageManager.js'
4 changes: 2 additions & 2 deletions docs/.vuepress/client.ts
Original file line number Diff line number Diff line change
@@ -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 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 Contributors from './themes/components/Contributors.vue'
import { setupThemeColors } from './themes/composables/theme-colors.js'

export default defineClientConfig({
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
4 changes: 2 additions & 2 deletions docs/.vuepress/notes/zh/index.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/plume.config.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/themes/components/ColorPick.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import '@simonwep/pickr/dist/themes/nano.min.css'
import { onMounted, onUnmounted, ref, watch } from 'vue'
import '@simonwep/pickr/dist/themes/nano.min.css'
const emit = defineEmits<{ (e: 'update:modelValue', value: string): void }>()
Expand Down
17 changes: 12 additions & 5 deletions docs/.vuepress/themes/components/Contributors.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
<script setup lang="ts">
defineProps<{
contributors: string[]
import { computed } from 'vue'
const props = defineProps<{
contributors: ({ github: string, name: string } | string)[]
}>()
const list = computed(() =>
props.contributors.map(contributor =>
typeof contributor === 'string' ? { github: contributor, name: contributor } : contributor),
)
</script>

<template>
<div class="contributors">
<div v-for="contributor in contributors" :key="contributor" class="contributor">
<img :src="`https://github.com/${contributor}.png`" :alt="contributor">
<a :href="`https://github.com/${contributor}`" target="_blank" rel="noopener noreferrer">{{ contributor }}</a>
<div v-for="contributor in list" :key="contributor.github" class="contributor">
<img :src="`https://avatars.githubusercontent.com/${contributor.github}?v=4`" :alt="contributor.name">
<a :href="`https://github.com/${contributor.github}`" target="_blank" rel="noopener noreferrer">{{ contributor.name }}</a>
</div>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/themes/components/CustomTintPlate.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { PlumeThemeHomeHeroTintPlate } from 'vuepress-theme-plume/client'
import { computed, watch } from 'vue'
import type { PlumeThemeHomeHeroTintPlate } from 'vuepress-theme-plume/client'
import InputRange from './InputRange.vue'
const min = 20
Expand Down
6 changes: 3 additions & 3 deletions docs/.vuepress/themes/components/HeroTintPlateConfig.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import VPHomeHero from 'vuepress-theme-plume/components/Home/VPHomeHero.vue'
import { useDarkMode } from 'vuepress-theme-plume/composables'
import type { PlumeThemeHomeHeroTintPlate } from 'vuepress-theme-plume/client'
import { computed, ref, watch } from 'vue'
import CodeViewer from './CodeViewer.vue'
import CustomTintPlate from './CustomTintPlate.vue'
import DemoWrapper from './DemoWrapper.vue'
import SingleTintPlate from './SingleTintPlate.vue'
import TripletTintPlate from './TripletTintPlate.vue'
import CustomTintPlate from './CustomTintPlate.vue'
import CodeViewer from './CodeViewer.vue'
type Mode = 'single' | 'triplet' | 'custom'
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/themes/components/ThemeColors.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import VPButton from '@theme/VPButton.vue'
import { useThemeColors } from '../composables/theme-colors.js'
import ColorPick from './ColorPick.vue'
import CodeViewer from './CodeViewer.vue'
import ColorPick from './ColorPick.vue'
const { lightColors, darkColors, css, reset } = useThemeColors()
</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/themes/composables/caniuse.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/themes/composables/theme-colors.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ export default defineUserConfig({
<Contributors
:contributors="[
'pengzhanbo',
'huankong233',
'northword',
{ github: 'huankong233', name: 'huan_kong' },
{ github: 'northword', name: 'Northword' },
'KrLite',
'shylock-wu',
'hrradev',
'TheCoderAlex'
{ github: 'TheCoderAlex', name: 'Tang Zifeng' },
]"
/>

Expand Down
2 changes: 1 addition & 1 deletion docs/notes/plugins/caniuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
4 changes: 2 additions & 2 deletions docs/notes/plugins/content-updated.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -86,8 +86,8 @@ onContentUpdated(() => {

```vue
<script lang="ts" setup>
import { onContentUpdated } from '@vuepress-plume/plugin-content-update/client'
import { useMediumZoom } from '@vuepress/plugin-medium-zoom/client'
import { onContentUpdated } from '@vuepress-plume/plugin-content-update/client'
const mediumZoom = useMediumZoom()
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/config/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ permalink: /config/plugins/
所有主题内部使用的插件, 均在 `plugins` 字段中进行配置。

``` js
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
theme: plumeTheme({
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/config/plugins/markdownPower.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ permalink: /config/plugin/markdown-power/
默认配置:

```ts
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
theme: plumeTheme({
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/config/plugins/markdown增强.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ permalink: /config/plugins/markdown-enhance/
默认配置:

```ts
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
theme: plumeTheme({
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/config/plugins/代码高亮.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Shiki 支持多种编程语言。
默认配置:

```ts
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
theme: plumeTheme({
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/config/plugins/阅读统计.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ permalink: /config/plugins/reading-time/
默认配置:

```ts
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
theme: plumeTheme({
Expand Down
6 changes: 3 additions & 3 deletions docs/notes/theme/config/配置说明.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ VuePress 站点的基本配置文件是 `.vuepress/config.js` ,但也同样支

```ts
import { viteBundler } from '@vuepress/bundler-vite'
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
bundler: viteBundler(),
Expand Down Expand Up @@ -61,8 +61,8 @@ export default defineUserConfig({
一般我们使用 `.vuepress/config.js` 或者 `.vuepress/config.ts` 来配置主题。

```ts
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
theme: plumeTheme({
Expand Down Expand Up @@ -122,8 +122,8 @@ export default defineThemeConfig({

```ts
import path from 'node:path'
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
theme: plumeTheme({
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/guide/api-客户端.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import { Layout, NotFound } from 'vuepress-theme-plume/client'
更多其他组件请查看 [源代码](https://github.com/pengzhanbo/vuepress-theme-plume/tree/main/theme/src/client/components)

```ts
import VPLink from 'vuepress-theme-plume/components/VPLink.vue'
import VPButton from 'vuepress-theme-plume/components/VPButton.vue'
import VPLink from 'vuepress-theme-plume/components/VPLink.vue'
```

## 组合式 API
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/guide/博客.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ config:
(还可以在重新修改 分类页/标签页/归档页的链接地址)

```ts
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
theme: plumeTheme({
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/guide/国际化.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export default defineUserConfig({
`locales` 支持 所有主题配置项。

```js
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from '@vuepress-plume/vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'

export default defineUserConfig({
lang: 'en-US',
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/guide/安装与使用.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ cd open-source # 进入 D: 分区下的 open-source 目录
@tab docs/.vuepress/config.js

``` ts :no-line-numbers
import { defineUserConfig } from 'vuepress'
import { viteBundler } from '@vuepress/bundler-vite'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
Expand Down
Loading

0 comments on commit 520dce2

Please sign in to comment.