lint and typing

This commit is contained in:
Kurt Hutten Irev-Dev
2025-02-06 22:34:21 +11:00
parent 84ae567f37
commit ee54cdd27a
3 changed files with 27 additions and 45 deletions

View File

@ -1,6 +1,6 @@
import type { Page, Locator } from '@playwright/test' import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test' import { expect } from '@playwright/test'
import { uuidv4 } from 'lib/utils' import { isArray, uuidv4 } from 'lib/utils'
import { import {
closeDebugPanel, closeDebugPanel,
doAndWaitForImageDiff, doAndWaitForImageDiff,
@ -255,7 +255,7 @@ export class SceneFixture {
function isColourArray( function isColourArray(
colour: [number, number, number] | [number, number, number][] colour: [number, number, number] | [number, number, number][]
): colour is [number, number, number][] { ): colour is [number, number, number][] {
return Array.isArray(colour[0]) return isArray(colour[0])
} }
export async function expectPixelColor( export async function expectPixelColor(

View File

@ -182,12 +182,10 @@ export const ModelingMachineProvider = ({
'enable copilot': () => { 'enable copilot': () => {
editorManager.setCopilotEnabled(true) editorManager.setCopilotEnabled(true)
}, },
// tsc reports this typing as perfectly fine, but eslint is complaining. 'sketch exit execute': ({ context: { store } }) => {
// It's actually nonsensical, so I'm quieting. // TODO: Remove this async callback. For some reason eslint wouldn't
// eslint-disable-next-line @typescript-eslint/no-misused-promises // let me disable @typescript-eslint/no-misused-promises for the line.
'sketch exit execute': async ({ ;(async () => {
context: { store },
}): Promise<void> => {
// When cancelling the sketch mode we should disable sketch mode within the engine. // When cancelling the sketch mode we should disable sketch mode within the engine.
await engineCommandManager.sendSceneCommand({ await engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req', type: 'modeling_cmd_req',
@ -205,24 +203,6 @@ export const ModelingMachineProvider = ({
store.videoElement?.pause() store.videoElement?.pause()
return kclManager.executeCode().then(() => {
if (engineCommandManager.engineConnection?.idleMode) return
store.videoElement?.play().catch((e) => {
console.warn('Video playing was prevented', e)
})
})
sceneInfra.camControls.syncDirection = 'clientToEngine'
if (cameraProjection.current === 'perspective') {
await sceneInfra.camControls.snapToPerspectiveBeforeHandingBackControlToEngine()
}
sceneInfra.camControls.syncDirection = 'engineToClient'
store.videoElement?.pause()
return kclManager return kclManager
.executeCode() .executeCode()
.then(() => { .then(() => {
@ -233,6 +213,7 @@ export const ModelingMachineProvider = ({
}) })
}) })
.catch(reportRejection) .catch(reportRejection)
})().catch(reportRejection)
}, },
'Set mouse state': assign(({ context, event }) => { 'Set mouse state': assign(({ context, event }) => {
if (event.type !== 'Set mouse state') return {} if (event.type !== 'Set mouse state') return {}

View File

@ -38,6 +38,7 @@ import { Node } from 'wasm-lib/kcl/bindings/Node'
import { findKwArg } from './util' import { findKwArg } from './util'
import { codeRefFromRange } from './std/artifactGraph' import { codeRefFromRange } from './std/artifactGraph'
import { FunctionExpression } from 'wasm-lib/kcl/bindings/FunctionExpression' import { FunctionExpression } from 'wasm-lib/kcl/bindings/FunctionExpression'
import { ImportStatement } from 'wasm-lib/kcl/bindings/ImportStatement'
export const LABELED_ARG_FIELD = 'LabeledArg -> Arg' export const LABELED_ARG_FIELD = 'LabeledArg -> Arg'
export const ARG_INDEX_FIELD = 'arg index' export const ARG_INDEX_FIELD = 'arg index'