internal: Add lints for promises (#3733)

* Add lints for floating and misued promises

* Add logging async errors in main

* Add async error catch in test-utils

* Change any to unknown

* Trap promise errors and ignore more await warnings

* Add more ignores and toSync helper

* Fix more lint warnings

* Add more ignores and fixes

* Add more reject reporting

* Add accepting arbitrary parameters to toSync()

* Fix more lints

* Revert unintentional change to non-arrow function

* Revert unintentional change to use arrow function

* Fix new warnings in main with auto updater

* Fix formatting

* Change lints to error

This is what the recommended type checked rules do.

* Fix to properly report promise rejections

* Fix formatting

* Fix formatting

* Remove unused import

* Remove unused convenience function

* Move type helpers

* Fix to not return promise when caller doesn't expect it

* Add ignores to lsp code
This commit is contained in:
Jonathan Tran
2024-09-09 18:17:45 -04:00
committed by GitHub
parent 0a72d7a39a
commit 25443eba31
59 changed files with 786 additions and 528 deletions

View File

@ -27,6 +27,7 @@ import {
} from './ContextMenu'
import { Popover } from '@headlessui/react'
import { CustomIcon } from './CustomIcon'
import { reportRejection } from 'lib/trap'
const CANVAS_SIZE = 80
const FRUSTUM_SIZE = 0.5
@ -67,7 +68,9 @@ export default function Gizmo() {
<ContextMenuItem
key={axisName}
onClick={() => {
sceneInfra.camControls.updateCameraToAxis(axisName as AxisNames)
sceneInfra.camControls
.updateCameraToAxis(axisName as AxisNames)
.catch(reportRejection)
}}
>
{axisSemantic} view
@ -75,7 +78,7 @@ export default function Gizmo() {
)),
<ContextMenuItem
onClick={() => {
sceneInfra.camControls.resetCameraPosition()
sceneInfra.camControls.resetCameraPosition().catch(reportRejection)
}}
>
Reset view
@ -299,7 +302,7 @@ const initializeMouseEvents = (
const handleClick = () => {
if (raycasterIntersect.current) {
const axisName = raycasterIntersect.current.object.name as AxisNames
sceneInfra.camControls.updateCameraToAxis(axisName)
sceneInfra.camControls.updateCameraToAxis(axisName).catch(reportRejection)
}
}