[lint] Enforce @typescript-eslint/no-floating-promises (#3402)

This commit is contained in:
Chenlei Hu
2025-04-11 12:19:22 -04:00
committed by GitHub
parent 59e20964a0
commit dc5d7ea1be
60 changed files with 305 additions and 279 deletions

View File

@@ -30,15 +30,15 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
const isBookmarked = (node: ComfyNodeDefImpl) =>
bookmarksSet.value.has(node.nodePath) || bookmarksSet.value.has(node.name)
const toggleBookmark = (node: ComfyNodeDefImpl) => {
const toggleBookmark = async (node: ComfyNodeDefImpl) => {
if (isBookmarked(node)) {
deleteBookmark(node.nodePath)
await deleteBookmark(node.nodePath)
// Delete the bookmark at the top level if it exists
// This is used for clicking the bookmark button in the node library, i.e.
// the node is inside original/standard node library tree node
deleteBookmark(node.name)
await deleteBookmark(node.name)
} else {
addBookmark(node.name)
await addBookmark(node.name)
}
}
@@ -62,28 +62,28 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
return buildNodeDefTree(bookmarkNodes)
}
const addBookmark = (nodePath: string) => {
settingStore.set(BOOKMARK_SETTING_ID, [...bookmarks.value, nodePath])
const addBookmark = async (nodePath: string) => {
await settingStore.set(BOOKMARK_SETTING_ID, [...bookmarks.value, nodePath])
}
const deleteBookmark = (nodePath: string) => {
settingStore.set(
const deleteBookmark = async (nodePath: string) => {
await settingStore.set(
BOOKMARK_SETTING_ID,
bookmarks.value.filter((b: string) => b !== nodePath)
)
}
const addNewBookmarkFolder = (
const addNewBookmarkFolder = async (
parent: ComfyNodeDefImpl | undefined,
folderName: string
) => {
const parentPath = parent ? parent.nodePath : ''
const newFolderPath = parentPath + folderName + '/'
addBookmark(newFolderPath)
await addBookmark(newFolderPath)
return newFolderPath
}
const renameBookmarkFolder = (
const renameBookmarkFolder = async (
folderNode: ComfyNodeDefImpl,
newName: string
) => {
@@ -107,7 +107,7 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
throw new Error(`Folder name "${newNodePath}" already exists`)
}
settingStore.set(
await settingStore.set(
BOOKMARK_SETTING_ID,
bookmarks.value.map((b: string) =>
b.startsWith(folderNode.nodePath)
@@ -115,28 +115,28 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
: b
)
)
renameBookmarkCustomization(folderNode.nodePath, newNodePath)
await renameBookmarkCustomization(folderNode.nodePath, newNodePath)
}
const deleteBookmarkFolder = (folderNode: ComfyNodeDefImpl) => {
const deleteBookmarkFolder = async (folderNode: ComfyNodeDefImpl) => {
if (!folderNode.isDummyFolder) {
throw new Error('Cannot delete non-folder node')
}
settingStore.set(
await settingStore.set(
BOOKMARK_SETTING_ID,
bookmarks.value.filter(
(b: string) =>
b !== folderNode.nodePath && !b.startsWith(folderNode.nodePath)
)
)
deleteBookmarkCustomization(folderNode.nodePath)
await deleteBookmarkCustomization(folderNode.nodePath)
}
const bookmarksCustomization = computed<
Record<string, BookmarkCustomization>
>(() => settingStore.get('Comfy.NodeLibrary.BookmarksCustomization'))
const updateBookmarkCustomization = (
const updateBookmarkCustomization = async (
nodePath: string,
customization: BookmarkCustomization
) => {
@@ -153,23 +153,23 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
// If the customization is empty, remove it entirely
if (Object.keys(newCustomization).length === 0) {
deleteBookmarkCustomization(nodePath)
await deleteBookmarkCustomization(nodePath)
} else {
settingStore.set('Comfy.NodeLibrary.BookmarksCustomization', {
await settingStore.set('Comfy.NodeLibrary.BookmarksCustomization', {
...bookmarksCustomization.value,
[nodePath]: newCustomization
})
}
}
const deleteBookmarkCustomization = (nodePath: string) => {
settingStore.set('Comfy.NodeLibrary.BookmarksCustomization', {
const deleteBookmarkCustomization = async (nodePath: string) => {
await settingStore.set('Comfy.NodeLibrary.BookmarksCustomization', {
...bookmarksCustomization.value,
[nodePath]: undefined
} as Record<string, BookmarkCustomization>)
}
const renameBookmarkCustomization = (
const renameBookmarkCustomization = async (
oldNodePath: string,
newNodePath: string
) => {
@@ -178,7 +178,7 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
updatedCustomization[newNodePath] = updatedCustomization[oldNodePath]
delete updatedCustomization[oldNodePath]
}
settingStore.set(
await settingStore.set(
'Comfy.NodeLibrary.BookmarksCustomization',
updatedCustomization
)