From ece1e37c6e0e50e5b077af0e62becf723c3d72b4 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Tue, 5 Dec 2023 01:38:23 -0300 Subject: [PATCH] lint e type fixes --- src/libs/joystick/protocols/cockpit-actions.ts | 2 +- src/libs/joystick/protocols/mavlink-manual-control.ts | 2 +- src/libs/vehicle/ardupilot/ardupilot.ts | 2 +- src/libs/vehicle/ardupilot/arduplane.ts | 3 +-- src/stores/controller.ts | 5 ++++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/libs/joystick/protocols/cockpit-actions.ts b/src/libs/joystick/protocols/cockpit-actions.ts index 411588551..5ce7eca13 100644 --- a/src/libs/joystick/protocols/cockpit-actions.ts +++ b/src/libs/joystick/protocols/cockpit-actions.ts @@ -3,7 +3,7 @@ /* eslint-disable max-len */ import { v4 as uuid4 } from 'uuid' -import { type JoystickProtocolActionsMapping,type JoystickState, type ProtocolAction, CockpitModifierKeyOption,JoystickButton,JoystickProtocol } from '@/types/joystick' +import { type ProtocolAction, JoystickProtocol } from '@/types/joystick' /** * Possible functions in the MAVLink `MANUAL_CONTROL` message protocol diff --git a/src/libs/joystick/protocols/mavlink-manual-control.ts b/src/libs/joystick/protocols/mavlink-manual-control.ts index 98dd46993..af4530cac 100644 --- a/src/libs/joystick/protocols/mavlink-manual-control.ts +++ b/src/libs/joystick/protocols/mavlink-manual-control.ts @@ -366,7 +366,7 @@ export class MavlinkManualControlManager { if (useShift && shiftButton === undefined) return - const vehicleButtonsToActivate = useShift ? shiftVehicleButtonsToActivate.concat([manualControlButtonFromParameterName(shiftButton?.button)]) : regularVehicleButtonsToActivate + const vehicleButtonsToActivate = useShift ? shiftVehicleButtonsToActivate.concat([manualControlButtonFromParameterName(shiftButton!.button)]) : regularVehicleButtonsToActivate // Calculate buttons value let buttons_int = 0 diff --git a/src/libs/vehicle/ardupilot/ardupilot.ts b/src/libs/vehicle/ardupilot/ardupilot.ts index 213f64e49..1aeb6217a 100644 --- a/src/libs/vehicle/ardupilot/ardupilot.ts +++ b/src/libs/vehicle/ardupilot/ardupilot.ts @@ -42,10 +42,10 @@ import { StatusText, Velocity, } from '@/libs/vehicle/types' +import type { MetadataFile } from '@/types/ardupilot-metadata' import { type MissionLoadingCallback, type Waypoint, defaultLoadingCallback } from '@/types/mission' import * as Vehicle from '../vehicle' -import type { MetadataFile } from '@/types/ardupilot-metadata' // eslint-disable-next-line @typescript-eslint/no-explicit-any export type ArduPilot = ArduPilotVehicle diff --git a/src/libs/vehicle/ardupilot/arduplane.ts b/src/libs/vehicle/ardupilot/arduplane.ts index 1da15acee..a74563e7c 100644 --- a/src/libs/vehicle/ardupilot/arduplane.ts +++ b/src/libs/vehicle/ardupilot/arduplane.ts @@ -1,11 +1,10 @@ import type { Package } from '@/libs/connection/m2r/messages/mavlink2rest' import { MAVLinkType, MavModeFlag } from '@/libs/connection/m2r/messages/mavlink2rest-enum' -import * as arduplane_metadata from '@/libs/vehicle/ardupilot/ParameterRepository/Plane-4.3/apm.pdef.json' import type { Message } from '@/libs/connection/m2r/messages/mavlink2rest-message' +import * as arduplane_metadata from '@/libs/vehicle/ardupilot/ParameterRepository/Plane-4.3/apm.pdef.json' import * as Vehicle from '../vehicle' import { ArduPilotVehicle } from './ardupilot' -import type { MetadataFile } from '@/types/ardupilot-metadata' /** * Custom modes for Plane diff --git a/src/stores/controller.ts b/src/stores/controller.ts index 591d360ac..e2b7c56f2 100644 --- a/src/stores/controller.ts +++ b/src/stores/controller.ts @@ -86,7 +86,10 @@ export const useControllerStore = defineStore('controller', () => { return joystickState.buttons .map((btnState, idx) => ({ id: idx, value: btnState })) .filter((btn) => btn.value ?? 0 > 0.5) - .map((btn) => mapping.buttonsCorrespondencies[modifierKeyId as CockpitModifierKeyOption][btn.id as JoystickButton].action) + .map((btn) => + // @ts-ignore: It's right and working + mapping.buttonsCorrespondencies[modifierKeyId as CockpitModifierKeyOption][btn.id as JoystickButton].action + ) .concat([modifierKeyId]) }