Skip to content

Commit

Permalink
style: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Aug 30, 2023
1 parent 7f90029 commit 88908d1
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 81 deletions.
11 changes: 2 additions & 9 deletions ecosystem/plugin-docsearch/src/client/components/Docsearch.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import { usePageLang, useRouteLocale } from '@vuepress/client'
import {
computed,
defineComponent,
h,
onMounted,
type PropType,
ref,
watch,
} from 'vue'
import type { PropType } from 'vue'
import { computed, defineComponent, h, onMounted, ref, watch } from 'vue'
import type { DocsearchOptions } from '../../shared/index.js'
import {
useDocsearchHotkeyListener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const __dirname = getDirname(import.meta.url)
/**
* Options for @vuepress/plugin-external-link-icon
*/
export type ExternalLinkIconPluginOptions = {
export interface ExternalLinkIconPluginOptions {
/**
* Locales config for external link icon
*/
Expand Down
7 changes: 2 additions & 5 deletions ecosystem/plugin-theme-data/src/client/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { setupDevtoolsPlugin } from '@vue/devtools-api'
import {
defineClientConfig,
type RouteLocaleRef,
routeLocaleSymbol,
} from '@vuepress/client'
import type { RouteLocaleRef } from '@vuepress/client'
import { defineClientConfig, routeLocaleSymbol } from '@vuepress/client'
import { computed } from 'vue'
import {
resolveThemeLocaleData,
Expand Down
4 changes: 1 addition & 3 deletions ecosystem/theme-default/src/client/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import {
useUpdateDeviceStatus,
} from '../composables/index.js'
defineEmits<{
(e: 'toggle-sidebar'): void
}>()
defineEmits<(e: 'toggle-sidebar') => void>()
defineSlots<{
before?: (props: Record<never, never>) => any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<script setup lang="ts">
import { useThemeLocaleData } from '../composables/index.js'
defineEmits<{
(e: 'toggle'): void
}>()
defineEmits<(e: 'toggle') => void>()
const themeLocale = useThemeLocaleData()
</script>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"docs:serve": "pnpm --filter=docs docs:serve",
"format": "prettier --write .",
"lint": "eslint --ext .cjs,.js,.ts,.vue . && prettier --check .",
"lint:fix": "eslint --fix --ext .cjs,.js,.ts,.vue . && prettier --write .",
"prepare": "husky install",
"release": "pnpm release:check && pnpm release:version && pnpm release:publish",
"release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
Expand Down
3 changes: 2 additions & 1 deletion packages/bundler-vite/src/resolveViteConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { default as vuePlugin } from '@vitejs/plugin-vue'
import type { App } from '@vuepress/core'
import { type InlineConfig, mergeConfig } from 'vite'
import type { InlineConfig } from 'vite'
import { mergeConfig } from 'vite'
import {
constantsReplacementPlugin,
mainPlugin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const resolvePageClientFilesMeta = ({
moduleRequests: string[]
moduleFilesMetaMap: ModuleFilesMetaMap
}): FileMeta[] => {
const files: Set<FileMeta> = new Set()
const files = new Set<FileMeta>()
moduleRequests.forEach((request) => {
moduleFilesMetaMap[request]?.forEach((file) => files.add(file))
})
Expand Down
26 changes: 13 additions & 13 deletions packages/bundler-webpack/src/types.webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import type { Compiler, ModuleOptions } from 'webpack'
export interface StatsToJsonOutput {
_showErrors: boolean
_showWarnings: boolean
assets?: Array<{
chunks: Array<number | string>
assets?: {
chunks: (number | string)[]
chunkNames: string[]
emitted: boolean
isOverSizeLimit?: boolean
name: string
size: number
}>
}[]
assetsByChunkName?: Record<string, string | string[]>
builtAt?: number
children?: Array<StatsToJsonOutput & { name?: string }>
chunks?: Array<{
children?: (StatsToJsonOutput & { name?: string })[]
chunks?: {
children: number[]
childrenByOrder: Record<string, number[]>
entry: boolean
Expand All @@ -28,22 +28,22 @@ export interface StatsToJsonOutput {
initial: boolean
modules?: FnModules[]
names: string[]
origins?: Array<{
origins?: {
moduleId?: string | number
module: string
moduleIdentifier: string
moduleName: string
loc: string
request: string
reasons: string[]
}>
}[]
parents: number[]
reason?: string
recorded?: boolean
rendered: boolean
size: number
siblings: number[]
}>
}[]
entrypoints?: Record<string, ChunkGroup>
errors: string[]
env?: Record<string, any>
Expand All @@ -64,7 +64,7 @@ export interface FnModules {
assets?: string[]
built: boolean
cacheable: boolean
chunks: Array<number | string>
chunks: (number | string)[]
depth?: number
errors: number
failed: boolean
Expand All @@ -76,12 +76,12 @@ export interface FnModules {
issuer: string | undefined
issuerId: number | string | undefined
issuerName: string | undefined
issuerPath: Array<{
issuerPath: {
id: number | string
identifier: string
name: string
profile: any // TODO
}>
}[]
modules: FnModules[]
name: string
optimizationBailout?: string
Expand All @@ -98,12 +98,12 @@ export interface FnModules {

export interface ChunkGroup {
assets: { name: string }[]
chunks: Array<number | string>
chunks: (number | string)[]
children: Record<
string,
{
assets: string[]
chunks: Array<number | string>
chunks: (number | string)[]
name: string
}
>
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/composables/layouts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type ComputedRef, inject, type InjectionKey } from 'vue'
import type { ComputedRef, InjectionKey } from 'vue'
import { inject } from 'vue'
import type { Layouts } from '../types/index.js'

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/composables/pageData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { PageData } from '@vuepress/shared'
import { inject, type InjectionKey, readonly, type Ref } from 'vue'
import type { InjectionKey, Ref } from 'vue'
import { inject, readonly } from 'vue'

export type { PageData }

Expand Down
8 changes: 2 additions & 6 deletions packages/client/src/composables/pageLayout.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import {
type Component,
type ComputedRef,
inject,
type InjectionKey,
} from 'vue'
import type { Component, ComputedRef, InjectionKey } from 'vue'
import { inject } from 'vue'

/**
* Ref wrapper of `PageLayout`
Expand Down
21 changes: 10 additions & 11 deletions packages/client/src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ import {
} from '@vuepress/shared'
import type { Component } from 'vue'
import { reactive } from 'vue'
import {
type PageData,
pageDataEmpty,
type PageFrontmatter,
type PageHead,
type PageHeadTitle,
type PageLang,
pagesData,
type RouteLocale,
type SiteData,
type SiteLocaleData,
import type {
PageData,
PageFrontmatter,
PageHead,
PageHeadTitle,
PageLang,
RouteLocale,
SiteData,
SiteLocaleData,
} from './composables/index.js'
import { pageDataEmpty, pagesData } from './composables/index.js'
import { LAYOUT_NAME_DEFAULT, LAYOUT_NAME_NOT_FOUND } from './constants.js'
import type { ClientConfig, Layouts } from './types/index.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/router.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { pagesComponents } from '@internal/pagesComponents'
import { removeEndingSlash } from '@vuepress/shared'
import type { Router } from 'vue-router'
import {
createMemoryHistory,
createRouter,
createWebHistory,
type Router,
START_LOCATION,
} from 'vue-router'
import type { PageData } from './composables/index.js'
Expand Down
41 changes: 22 additions & 19 deletions packages/client/src/setupGlobalComputed.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
import { computedEager, computedWithControl } from '@vueuse/core'
import { type App, computed } from 'vue'
import type { App } from 'vue'
import { computed } from 'vue'
import type { Router } from 'vue-router'
import type {
LayoutsRef,
PageData,
PageDataRef,
PageFrontmatter,
PageFrontmatterRef,
PageHead,
PageHeadRef,
PageHeadTitle,
PageHeadTitleRef,
PageLang,
PageLangRef,
PageLayoutRef,
RouteLocale,
RouteLocaleRef,
SiteData,
SiteDataRef,
SiteLocaleData,
SiteLocaleDataRef,
} from './composables/index.js'
import {
type LayoutsRef,
layoutsSymbol,
type PageData,
type PageDataRef,
pageDataSymbol,
type PageFrontmatter,
type PageFrontmatterRef,
pageFrontmatterSymbol,
type PageHead,
type PageHeadRef,
pageHeadSymbol,
type PageHeadTitle,
type PageHeadTitleRef,
pageHeadTitleSymbol,
type PageLang,
type PageLangRef,
pageLangSymbol,
type PageLayoutRef,
pageLayoutSymbol,
pagesData,
type RouteLocale,
type RouteLocaleRef,
routeLocaleSymbol,
type SiteData,
siteData,
type SiteDataRef,
type SiteLocaleData,
type SiteLocaleDataRef,
siteLocaleDataSymbol,
} from './composables/index.js'
import { withBase } from './helpers/index.js'
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/types/pluginApi/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import type { Page, PageOptions } from '../page.js'

// util type
type PromiseOrNot<T> = Promise<T> | T
type Closable = { close(): void }
interface Closable {
close(): void
}

// base hook type
export type Hook<
export interface Hook<
Exposed,
Normalized = Exposed,
Result = Normalized extends (...args: any) => infer U
? U extends Promise<infer V>
? V
: U
: void,
> = {
> {
exposed: Exposed
normalized: Normalized
result: Result
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/types/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import type { HeadConfig } from './head.js'
/**
* Base type of vuepress page
*/
export type PageBase<
export interface PageBase<
ExtraPageFrontmatter extends Record<any, any> = Record<string, unknown>,
> = {
> {
/**
* Identifier of the page
*
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/src/withSpinner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import process from 'node:process'
import ora, { type Ora } from 'ora'
import type { Ora } from 'ora'
import ora from 'ora'
import { formatMs } from './formatMs.js'

export const withSpinner =
Expand Down

0 comments on commit 88908d1

Please sign in to comment.