diff --git a/docs/app/components/content/ComponentCode.vue b/docs/app/components/content/ComponentCode.vue index fbadd81d..83e2288b 100644 --- a/docs/app/components/content/ComponentCode.vue +++ b/docs/app/components/content/ComponentCode.vue @@ -127,7 +127,7 @@ const code = computed(() => { const { data: ast } = await useAsyncData(`component-code-${name}-${JSON.stringify({ props: componentProps, slots: props.slots })}`, async () => { let formatted = '' try { - formatted = await $prettier.format(code.value) + formatted = await $prettier.format(code.value, { trailingComma: 'none', vueIndentScriptAndStyle: true }) } catch (e) { formatted = code.value } diff --git a/docs/app/plugins/prettier.ts b/docs/app/plugins/prettier.ts index 02261349..823d9182 100644 --- a/docs/app/plugins/prettier.ts +++ b/docs/app/plugins/prettier.ts @@ -1,4 +1,5 @@ import type { Options } from 'prettier' +import { defu } from 'defu' import PrettierWorker from '@/workers/prettier.js?worker&inline' export interface SimplePrettier { @@ -48,10 +49,10 @@ export default defineNuxtPlugin({ if (import.meta.server) { const prettierModule = await import('prettier') prettier = { - format(source, options = { - parser: 'markdown' - }) { - return prettierModule.format(source, options) + format(source, options = {}) { + return prettierModule.format(source, defu(options, { + parser: 'markdown' + })) } } } else { diff --git a/docs/app/workers/prettier.js b/docs/app/workers/prettier.js index b12fafec..719e38cd 100644 --- a/docs/app/workers/prettier.js +++ b/docs/app/workers/prettier.js @@ -1,7 +1,7 @@ /* eslint-disable no-undef */ -import('https://unpkg.com/prettier@3.0.3/standalone.js') -import('https://unpkg.com/prettier@3.0.3/plugins/html.js') -import('https://unpkg.com/prettier@3.0.3/plugins/markdown.js') +import('https://unpkg.com/prettier@3.3.3/standalone.js') +import('https://unpkg.com/prettier@3.3.3/plugins/html.js') +import('https://unpkg.com/prettier@3.3.3/plugins/markdown.js') self.onmessage = async function (event) { self.postMessage({