mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
docs(ComponentCode): update prettier config
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user