[refactor] remove 6 floating-promise ignores (#5985)

* Remove trivial floating promise in authMachine

* Add catch statement so LSP promise is considered non-floating

* Remove trivial float in AllSettingsFields

* Add error reporting for ensureWasmInit

* Remove pointless floating promise in Modeling

* Add comment and reportRejection to floating promise in "set selection"

* Read comment, put back await that should be there

* Fix dumb imports rebase botch

* Missed an import

---------

Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
Frank Noirot
2025-04-02 22:53:10 -04:00
committed by GitHub
parent 1fe1cfb397
commit 3e4505e2e3
5 changed files with 26 additions and 19 deletions

View File

@ -445,10 +445,15 @@ export const ModelingMachineProvider = ({
}, },
}) })
} }
// If there are engine commands that need sent off, send them
// TODO: This should be handled outside of an action as its own
// actor, so that the system state is more controlled.
engineEvents && engineEvents &&
engineEvents.forEach((event) => { engineEvents.forEach((event) => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises engineCommandManager
engineCommandManager.sendSceneCommand(event) .sendSceneCommand(event)
.catch(reportRejection)
}) })
updateSceneObjectColors() updateSceneObjectColors()
@ -1566,9 +1571,7 @@ export const ModelingMachineProvider = ({
data data
) )
if (err(result)) return reject(result) if (err(result)) return reject(result)
await codeManager.updateEditorWithAstAndWriteToFile(kclManager.ast)
// eslint-disable-next-line @typescript-eslint/no-floating-promises
codeManager.updateEditorWithAstAndWriteToFile(kclManager.ast)
return result return result
} }

View File

@ -96,8 +96,7 @@ export const AllSettingsFields = forwardRef(
} }
} }
} }
// eslint-disable-next-line @typescript-eslint/no-floating-promises navigateToOnboardingStart().catch(reportRejection)
navigateToOnboardingStart()
}, [ }, [
isFileSettings, isFileSettings,
navigate, navigate,

View File

@ -102,11 +102,14 @@ onmessage = function (event: MessageEvent) {
intoServer.enqueue(data) intoServer.enqueue(data)
const json: jsrpc.JSONRPCRequest = Codec.decode(data) const json: jsrpc.JSONRPCRequest = Codec.decode(data)
if (null != json.id) { if (null != json.id) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises, @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
fromServer.responses.get(json.id)!.then((response) => { fromServer.responses
const encoded = Codec.encode(response as jsrpc.JSONRPCResponse) .get(json.id)!
postMessage(encoded) .then((response) => {
}) const encoded = Codec.encode(response as jsrpc.JSONRPCResponse)
postMessage(encoded)
})
.catch(reportRejection)
} }
break break
default: default:

View File

@ -20,7 +20,7 @@ import {
import type ModelingAppFile from '@src/lib/modelingAppFile' import type ModelingAppFile from '@src/lib/modelingAppFile'
import type { DefaultPlaneStr } from '@src/lib/planes' import type { DefaultPlaneStr } from '@src/lib/planes'
import { defaultPlaneStrToKey } from '@src/lib/planes' import { defaultPlaneStrToKey } from '@src/lib/planes'
import { err } from '@src/lib/trap' import { err, reportRejection } from '@src/lib/trap'
import type { DeepPartial } from '@src/lib/types' import type { DeepPartial } from '@src/lib/types'
import type { ModuleType } from '@src/lib/wasm_lib_wrapper' import type { ModuleType } from '@src/lib/wasm_lib_wrapper'
import { getModule } from '@src/lib/wasm_lib_wrapper' import { getModule } from '@src/lib/wasm_lib_wrapper'
@ -48,10 +48,11 @@ export default class RustContext {
constructor(engineCommandManager: EngineCommandManager) { constructor(engineCommandManager: EngineCommandManager) {
this.engineCommandManager = engineCommandManager this.engineCommandManager = engineCommandManager
// eslint-disable-next-line @typescript-eslint/no-floating-promises this.ensureWasmInit()
this.ensureWasmInit().then(async () => { .then(async () => {
this.ctxInstance = await this.create() this.ctxInstance = await this.create()
}) })
.catch(reportRejection)
} }
// Create a new context instance // Create a new context instance

View File

@ -238,8 +238,9 @@ async function getAndSyncStoredToken(input: {
if (token) { if (token) {
// has just logged in, update storage // has just logged in, update storage
localStorage.setItem(TOKEN_PERSIST_KEY, token) localStorage.setItem(TOKEN_PERSIST_KEY, token)
// eslint-disable-next-line @typescript-eslint/no-floating-promises if (isDesktop()) {
isDesktop() && writeTokenFile(token) await writeTokenFile(token)
}
return token return token
} }
if (!isDesktop()) return '' if (!isDesktop()) return ''