style: lint fix
This commit is contained in:
parent
2cd8bd493c
commit
248826886a
@ -11,13 +11,13 @@ const tsupArgv = rawArgv.includes('--') ? rawArgv.slice(rawArgv.indexOf('--') +
|
||||
|
||||
const parsed = tsupArgv.length
|
||||
? minimist(tsupArgv, {
|
||||
boolean: ['client', 'node', 'all'],
|
||||
alias: {
|
||||
client: 'c',
|
||||
node: 'n',
|
||||
all: 'a',
|
||||
},
|
||||
})
|
||||
boolean: ['client', 'node', 'all'],
|
||||
alias: {
|
||||
client: 'c',
|
||||
node: 'n',
|
||||
all: 'a',
|
||||
},
|
||||
})
|
||||
: {
|
||||
client: true,
|
||||
node: true,
|
||||
|
||||
@ -30,15 +30,15 @@ export function setupDarkMode(app: App): void {
|
||||
? ref(true)
|
||||
: appearance
|
||||
? useDark({
|
||||
storageKey: 'vuepress-theme-appearance',
|
||||
attribute: 'data-theme',
|
||||
valueLight: 'light',
|
||||
valueDark: 'dark',
|
||||
disableTransition,
|
||||
initialValue: () =>
|
||||
typeof appearance === 'string' ? appearance : 'auto',
|
||||
...(typeof appearance === 'object' ? appearance : {}),
|
||||
})
|
||||
storageKey: 'vuepress-theme-appearance',
|
||||
attribute: 'data-theme',
|
||||
valueLight: 'light',
|
||||
valueDark: 'dark',
|
||||
disableTransition,
|
||||
initialValue: () =>
|
||||
typeof appearance === 'string' ? appearance : 'auto',
|
||||
...(typeof appearance === 'object' ? appearance : {}),
|
||||
})
|
||||
: ref(false)
|
||||
|
||||
app.provide(darkModeSymbol, isDark)
|
||||
|
||||
@ -102,7 +102,7 @@ export function setupEncrypt() {
|
||||
const filePathRelative = page.value.filePathRelative
|
||||
return encrypt.value.ruleList.length
|
||||
? encrypt.value.ruleList
|
||||
.filter(item => toMatch(item.match, pagePath, filePathRelative))
|
||||
.filter(item => toMatch(item.match, pagePath, filePathRelative))
|
||||
: []
|
||||
})
|
||||
|
||||
|
||||
@ -26,12 +26,12 @@ export function useLastUpdated() {
|
||||
|
||||
datetime.value = date.value
|
||||
? new Intl.DateTimeFormat(
|
||||
themeData.value.lastUpdated?.formatOptions?.forceLocale ? lang.value : undefined,
|
||||
themeData.value.lastUpdated?.formatOptions ?? {
|
||||
dateStyle: 'short',
|
||||
timeStyle: 'short',
|
||||
},
|
||||
).format(date.value)
|
||||
themeData.value.lastUpdated?.formatOptions?.forceLocale ? lang.value : undefined,
|
||||
themeData.value.lastUpdated?.formatOptions ?? {
|
||||
dateStyle: 'short',
|
||||
timeStyle: 'short',
|
||||
},
|
||||
).format(date.value)
|
||||
: ''
|
||||
})
|
||||
})
|
||||
|
||||
@ -69,8 +69,8 @@ export function setupSidebar() {
|
||||
const sidebarData = computed(() => {
|
||||
return hasSidebar.value
|
||||
? getSidebar(typeof frontmatter.value.sidebar === 'string'
|
||||
? frontmatter.value.sidebar
|
||||
: page.value.path, routeLocale.value)
|
||||
? frontmatter.value.sidebar
|
||||
: page.value.path, routeLocale.value)
|
||||
: []
|
||||
})
|
||||
|
||||
|
||||
@ -167,10 +167,10 @@ async function generator(file: AutoFrontmatterMarkdownFile): Promise<void> {
|
||||
const yaml = isEmptyObject(data)
|
||||
? ''
|
||||
: jsonToYaml
|
||||
.stringify(data)
|
||||
.replace(/\n\s{2}/g, '\n')
|
||||
.replace(/"/g, '')
|
||||
.replace(/\s+\n/g, '\n')
|
||||
.stringify(data)
|
||||
.replace(/\n\s{2}/g, '\n')
|
||||
.replace(/"/g, '')
|
||||
.replace(/\s+\n/g, '\n')
|
||||
const newContent = yaml ? `${yaml}---\n${content}` : content
|
||||
|
||||
await fs.promises.writeFile(filepath, newContent, 'utf-8')
|
||||
|
||||
@ -48,9 +48,9 @@ const salt = () => genSaltSync(random(8, 16))
|
||||
function resolveEncrypt(encrypt?: EncryptOptions): EncryptConfig {
|
||||
const admin = encrypt?.admin
|
||||
? toArray(encrypt.admin)
|
||||
.filter(isStringLike)
|
||||
.map(item => hashSync(String(item), salt()))
|
||||
.join(separator)
|
||||
.filter(isStringLike)
|
||||
.map(item => hashSync(String(item), salt()))
|
||||
.join(separator)
|
||||
: ''
|
||||
|
||||
const rules: Record<string, string> = {}
|
||||
|
||||
@ -56,9 +56,9 @@ async function resolveBulletin(app: App, themeData: PlumeThemeData) {
|
||||
const type = themeData.bulletin.contentType ?? 'text'
|
||||
themeData.bulletin.content = type === 'markdown'
|
||||
? app.markdown.render(themeData.bulletin.content, {
|
||||
filepath: app.dir.source(`/_bulletin.md`),
|
||||
filePathRelative: `_bulletin.md`,
|
||||
})
|
||||
filepath: app.dir.source(`/_bulletin.md`),
|
||||
filePathRelative: `_bulletin.md`,
|
||||
})
|
||||
: themeData.bulletin.content
|
||||
}
|
||||
}
|
||||
@ -83,9 +83,9 @@ async function resolveBulletin(app: App, themeData: PlumeThemeData) {
|
||||
const type = themeData.locales[locale].bulletin.contentType ?? 'text'
|
||||
themeData.locales[locale].bulletin.content = type === 'markdown'
|
||||
? app.markdown.render(themeData.locales[locale].bulletin.content, {
|
||||
filepath: app.dir.source(`${locale}_bulletin.md`),
|
||||
filePathRelative: `${locale.slice(1)}_bulletin.md`,
|
||||
})
|
||||
filepath: app.dir.source(`${locale}_bulletin.md`),
|
||||
filePathRelative: `${locale.slice(1)}_bulletin.md`,
|
||||
})
|
||||
: themeData.locales[locale].bulletin.content
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user