Skip to content

Commit 497f075

Browse files
committed
style: add trailing comma
1 parent 874fd74 commit 497f075

17 files changed

+94
-96
lines changed

.prettierrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"semi": false,
3-
"singleQuote": true,
4-
"trailingComma": "es5"
3+
"singleQuote": true
54
}

src/Message.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ watch(
1010
() => [props.err, props.warn],
1111
() => {
1212
dismissed.value = false
13-
}
13+
},
1414
)
1515
1616
function formatMessage(err: string | Error): string {

src/codemirror/CodeMirror.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ onMounted(() => {
7070
'resize',
7171
debounce(() => {
7272
editor.refresh()
73-
})
73+
}),
7474
)
7575
}
7676
})

src/editor/FileSelector.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const files = computed(() =>
2121
Object.entries(store.state.files)
2222
.filter(
2323
([name, file]) =>
24-
name !== importMapFile && name !== tsconfigFile && !file.hidden
24+
name !== importMapFile && name !== tsconfigFile && !file.hidden,
2525
)
26-
.map(([name]) => name)
26+
.map(([name]) => name),
2727
)
2828
2929
function startAddFile() {

src/editor/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import CodeMirrorEditor from "./CodeMirrorEditor.vue";
2-
import MonacoEditor from "./MonacoEditor.vue";
1+
import CodeMirrorEditor from './CodeMirrorEditor.vue'
2+
import MonacoEditor from './MonacoEditor.vue'
33

44
export type EditorComponentType = typeof CodeMirrorEditor | typeof MonacoEditor
55

src/monaco/Monaco.vue

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const props = withDefaults(
2525
}>(),
2626
{
2727
readonly: false,
28-
}
28+
},
2929
)
3030
3131
const emit = defineEmits<{
@@ -43,7 +43,7 @@ const lang = computed(() => (props.mode === 'css' ? 'css' : 'javascript'))
4343
4444
const replTheme = inject<Ref<'dark' | 'light'>>('theme')!
4545
onMounted(async () => {
46-
const theme = await import('./highlight').then(r => r.registerHighlighter())
46+
const theme = await import('./highlight').then((r) => r.registerHighlighter())
4747
ready.value = true
4848
await nextTick()
4949
@@ -76,7 +76,7 @@ onMounted(async () => {
7676
t.getTokenStyleMetadata = (
7777
type: string,
7878
modifiers: string[],
79-
_language: string
79+
_language: string,
8080
) => {
8181
const _readonly = modifiers.includes('readonly')
8282
switch (type) {
@@ -99,11 +99,11 @@ onMounted(async () => {
9999
if (editorInstance.getValue() === value) return
100100
editorInstance.setValue(value || '')
101101
},
102-
{ immediate: true }
102+
{ immediate: true },
103103
)
104104
105105
watch(lang, (lang) =>
106-
monaco.editor.setModelLanguage(editorInstance.getModel()!, lang)
106+
monaco.editor.setModelLanguage(editorInstance.getModel()!, lang),
107107
)
108108
109109
if (!props.readonly) {
@@ -116,7 +116,7 @@ onMounted(async () => {
116116
const model = getOrCreateModel(
117117
monaco.Uri.parse(`file:///${props.filename}`),
118118
file.language,
119-
file.code
119+
file.code,
120120
)
121121
122122
const oldFile = oldFilename ? store.state.files[oldFilename] : null
@@ -131,7 +131,7 @@ onMounted(async () => {
131131
editorInstance.focus()
132132
}
133133
},
134-
{ immediate: true }
134+
{ immediate: true },
135135
)
136136
}
137137

src/monaco/env.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function initMonaco(store: Store) {
2121
getOrCreateModel(
2222
Uri.parse(`file:///${filename}`),
2323
file.language,
24-
file.code
24+
file.code,
2525
)
2626
}
2727

@@ -107,26 +107,26 @@ export async function reloadLanguageTools(store: Store) {
107107
const languageId = ['vue', 'javascript', 'typescript']
108108
const getSyncUris = () =>
109109
Object.keys(store.state.files).map((filename) =>
110-
Uri.parse(`file:///${filename}`)
110+
Uri.parse(`file:///${filename}`),
111111
)
112112
const { dispose: disposeMarkers } = volar.editor.activateMarkers(
113113
worker,
114114
languageId,
115115
'vue',
116116
getSyncUris,
117-
editor
117+
editor,
118118
)
119119
const { dispose: disposeAutoInsertion } = volar.editor.activateAutoInsertion(
120120
worker,
121121
languageId,
122122
getSyncUris,
123-
editor
123+
editor,
124124
)
125125
const { dispose: disposeProvides } = await volar.languages.registerProvides(
126126
worker,
127127
languageId,
128128
getSyncUris,
129-
languages
129+
languages,
130130
)
131131

132132
disposeVue = () => {

src/monaco/highlight.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ import langVue from 'shikiji/langs/vue.mjs'
77
import themeDark from 'shikiji/themes/dark-plus.mjs'
88
import themeLight from 'shikiji/themes/light-plus.mjs'
99

10-
1110
export async function registerHighlighter() {
1211
const highlighter = await getHighlighterCore({
1312
themes: [themeDark, themeLight],
1413
langs: [langVue],
15-
loadWasm: getWasmInlined
14+
loadWasm: getWasmInlined,
1615
})
1716
monaco.languages.register({ id: 'vue' })
1817
shikijiToMonaco(highlighter, monaco)
1918
return {
2019
light: themeLight.name!,
21-
dark: themeDark.name!
20+
dark: themeDark.name!,
2221
}
2322
}

src/monaco/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Uri, editor } from 'monaco-editor-core'
33
export function getOrCreateModel(
44
uri: Uri,
55
lang: string | undefined,
6-
value: string
6+
value: string,
77
) {
88
const model = editor.getModel(uri)
99
if (model) {

src/monaco/vue.worker.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ self.onmessage = async (msg: MessageEvent<WorkerMessage>) => {
3737
importTsFromCdn(msg.data.tsVersion),
3838
locale &&
3939
fetchJson(
40-
`https://cdn.jsdelivr.net/npm/typescript@${msg.data.tsVersion}/lib/${locale}/diagnosticMessages.generated.json`
40+
`https://cdn.jsdelivr.net/npm/typescript@${msg.data.tsVersion}/lib/${locale}/diagnosticMessages.generated.json`,
4141
),
4242
])
4343
self.postMessage('inited')
@@ -47,23 +47,23 @@ self.onmessage = async (msg: MessageEvent<WorkerMessage>) => {
4747
worker.initialize(
4848
(
4949
ctx: monaco.worker.IWorkerContext<WorkerHost>,
50-
{ tsconfig, dependencies }: CreateData
50+
{ tsconfig, dependencies }: CreateData,
5151
) => {
5252
const { options: compilerOptions } = ts.convertCompilerOptionsFromJson(
5353
tsconfig?.compilerOptions || {},
54-
''
54+
'',
5555
)
5656
const env = createServiceEnvironment()
5757
const host = createLanguageHost(
5858
ctx.getMirrorModels,
5959
env,
6060
'/src',
61-
compilerOptions
61+
compilerOptions,
6262
)
6363
const jsDelivrFs = createJsDelivrFs(ctx.host.onFetchCdnFile)
6464
const jsDelivrUriResolver = createJsDelivrUriResolver(
6565
'/node_modules',
66-
dependencies
66+
dependencies,
6767
)
6868

6969
if (locale) {
@@ -82,11 +82,11 @@ self.onmessage = async (msg: MessageEvent<WorkerMessage>) => {
8282
ts as any,
8383
{},
8484
compilerOptions,
85-
tsconfig.vueCompilerOptions || {}
85+
tsconfig.vueCompilerOptions || {},
8686
),
87-
host
87+
host,
8888
)
89-
}
89+
},
9090
)
9191
}
9292

src/output/Output.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ const previewRef = ref<InstanceType<typeof Preview>>()
1616
const modes = computed(() =>
1717
props.showCompileOutput
1818
? (['preview', 'js', 'css', 'ssr'] as const)
19-
: (['preview'] as const)
19+
: (['preview'] as const),
2020
)
2121
2222
const mode = ref<OutputModes>(
2323
(modes.value as readonly string[]).includes(store.initialOutputMode)
2424
? (store.initialOutputMode as OutputModes)
25-
: 'preview'
25+
: 'preview',
2626
)
2727
2828
function reload() {

src/output/Preview.vue

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ watch(
4545
store.state.errors = [e as Error]
4646
return
4747
}
48-
}
48+
},
4949
)
5050
5151
// reset sandbox when version changes
@@ -59,7 +59,7 @@ watch(
5959
if (html) {
6060
html.className = value
6161
}
62-
}
62+
},
6363
)
6464
6565
onUnmounted(() => {
@@ -86,7 +86,7 @@ function createSandbox() {
8686
'allow-same-origin',
8787
'allow-scripts',
8888
'allow-top-navigation-by-user-activation',
89-
].join(' ')
89+
].join(' '),
9090
)
9191
9292
const importMap = store.getImportMap()
@@ -101,11 +101,11 @@ function createSandbox() {
101101
.replace(/<!--IMPORT_MAP-->/, JSON.stringify(importMap))
102102
.replace(
103103
/<!-- PREVIEW-OPTIONS-HEAD-HTML -->/,
104-
previewOptions?.headHTML || ''
104+
previewOptions?.headHTML || '',
105105
)
106106
.replace(
107107
/<!--PREVIEW-OPTIONS-PLACEHOLDER-HTML-->/,
108-
previewOptions?.placeholderHTML || ''
108+
previewOptions?.placeholderHTML || '',
109109
)
110110
sandbox.srcdoc = sandboxSrc
111111
container.value.appendChild(sandbox)
@@ -186,7 +186,7 @@ async function updatePreview() {
186186
if (major === 3 && (minor < 2 || (minor === 2 && patch < 27))) {
187187
alert(
188188
`The selected version of Vue (${store.vueVersion}) does not support in-browser SSR.` +
189-
` Rendering in client mode instead.`
189+
` Rendering in client mode instead.`,
190190
)
191191
isSSR = false
192192
}
@@ -199,7 +199,7 @@ async function updatePreview() {
199199
if (isSSR && mainFile.endsWith('.vue')) {
200200
const ssrModules = compileModulesForPreview(store, true)
201201
console.log(
202-
`[@vue/repl] successfully compiled ${ssrModules.length} modules for SSR.`
202+
`[@vue/repl] successfully compiled ${ssrModules.length} modules for SSR.`,
203203
)
204204
await proxy.eval([
205205
`const __modules__ = {};`,
@@ -229,7 +229,7 @@ async function updatePreview() {
229229
console.log(
230230
`[@vue/repl] successfully compiled ${modules.length} module${
231231
modules.length > 1 ? `s` : ``
232-
}.`
232+
}.`,
233233
)
234234
235235
const codeToEval = [
@@ -267,7 +267,7 @@ async function updatePreview() {
267267
window.__ssr_promise__.then(_mount)
268268
} else {
269269
_mount()
270-
}`
270+
}`,
271271
)
272272
}
273273

0 commit comments

Comments
 (0)