mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-28 10:50:40 +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 () => {
|
const { data: ast } = await useAsyncData(`component-code-${name}-${JSON.stringify({ props: componentProps, slots: props.slots })}`, async () => {
|
||||||
let formatted = ''
|
let formatted = ''
|
||||||
try {
|
try {
|
||||||
formatted = await $prettier.format(code.value)
|
formatted = await $prettier.format(code.value, { trailingComma: 'none', vueIndentScriptAndStyle: true })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
formatted = code.value
|
formatted = code.value
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { Options } from 'prettier'
|
import type { Options } from 'prettier'
|
||||||
|
import { defu } from 'defu'
|
||||||
import PrettierWorker from '@/workers/prettier.js?worker&inline'
|
import PrettierWorker from '@/workers/prettier.js?worker&inline'
|
||||||
|
|
||||||
export interface SimplePrettier {
|
export interface SimplePrettier {
|
||||||
@@ -48,10 +49,10 @@ export default defineNuxtPlugin({
|
|||||||
if (import.meta.server) {
|
if (import.meta.server) {
|
||||||
const prettierModule = await import('prettier')
|
const prettierModule = await import('prettier')
|
||||||
prettier = {
|
prettier = {
|
||||||
format(source, options = {
|
format(source, options = {}) {
|
||||||
parser: 'markdown'
|
return prettierModule.format(source, defu(options, {
|
||||||
}) {
|
parser: 'markdown'
|
||||||
return prettierModule.format(source, options)
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
import('https://unpkg.com/prettier@3.0.3/standalone.js')
|
import('https://unpkg.com/prettier@3.3.3/standalone.js')
|
||||||
import('https://unpkg.com/prettier@3.0.3/plugins/html.js')
|
import('https://unpkg.com/prettier@3.3.3/plugins/html.js')
|
||||||
import('https://unpkg.com/prettier@3.0.3/plugins/markdown.js')
|
import('https://unpkg.com/prettier@3.3.3/plugins/markdown.js')
|
||||||
|
|
||||||
self.onmessage = async function (event) {
|
self.onmessage = async function (event) {
|
||||||
self.postMessage({
|
self.postMessage({
|
||||||
|
|||||||
Reference in New Issue
Block a user