mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
chore(deps): migrate to eslint 9 (#2443)
This commit is contained in:
@@ -6,7 +6,7 @@ export interface SimplePrettier {
|
||||
format: (source: string, options?: Options) => Promise<string>
|
||||
}
|
||||
|
||||
function createPrettierWorkerApi (worker: Worker): SimplePrettier {
|
||||
function createPrettierWorkerApi(worker: Worker): SimplePrettier {
|
||||
let counter = 0
|
||||
const handlers: any = {}
|
||||
|
||||
@@ -18,6 +18,7 @@ function createPrettierWorkerApi (worker: Worker): SimplePrettier {
|
||||
}
|
||||
|
||||
const [resolve, reject] = handlers[uid]
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete handlers[uid]
|
||||
|
||||
if (error) {
|
||||
@@ -27,7 +28,7 @@ function createPrettierWorkerApi (worker: Worker): SimplePrettier {
|
||||
}
|
||||
})
|
||||
|
||||
function postMessage<T> (message: any) {
|
||||
function postMessage<T>(message: any) {
|
||||
const uid = ++counter
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
handlers[uid] = [resolve, reject]
|
||||
@@ -36,7 +37,7 @@ function createPrettierWorkerApi (worker: Worker): SimplePrettier {
|
||||
}
|
||||
|
||||
return {
|
||||
format (source: string, options?: Options) {
|
||||
format(source: string, options?: Options) {
|
||||
return postMessage({ type: 'format', source, options })
|
||||
}
|
||||
}
|
||||
@@ -47,7 +48,7 @@ export default defineNuxtPlugin(async () => {
|
||||
if (import.meta.server) {
|
||||
const prettierModule = await import('prettier')
|
||||
prettier = {
|
||||
format (source, options = {}) {
|
||||
format(source, options = {}) {
|
||||
return prettierModule.format(source, defu(options, {
|
||||
parser: 'markdown'
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user