Introduce oxlint, and fix lint warnings

This commit is contained in:
James Babcock committed 2026-09-29 11:54:22 -07:00
1 parent cb6dddd120
commit 06146c2b08
89 files changed
+818 -469

No files matched your search

+6 -4
View File
@@ -47,7 +47,7 @@ const MIRROR_TOUCH_GESTURES: Record<Exclude<MirrorTouchKind, "tap">, WearRemoteI
import { findSoundEffect, playSoundEffect } from "../ui/sound-effects";
import { GlanceHost } from "./glance-host";
import { type GlanceEvent } from "./glance-state";
import { isWelcomeSoundPending, setWelcomeSoundPending } from "../phone-ui/onboarding-state";
import { isPreviewOnlyMode, isWelcomeSoundPending, setWelcomeSoundPending } from "../phone-ui/onboarding-state";
import { beginRenderPass, endRenderPass } from "../util/render-freshness";
import { voiceControlBridge } from "../native/voice-control";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../graphics/image";
@@ -92,7 +92,6 @@ import { wearerVerificationOptions } from "../apps/microphones/speakers";
import { micSession } from "../apps/microphones/mic-session";
import { glassesDisplayLabel } from "./glasses-display-state";
import { PreviewDisplayTarget, type DisplayTarget } from "../native/preview-display";
import { isPreviewOnlyMode } from "../phone-ui/onboarding-state";
type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging" | "disconnecting";
@@ -186,6 +185,9 @@ function createInitialDisplayPreview(): ImageSource | null {
return grayImageToPreviewSource(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0));
}
/** Echo the controller's appendLog() trace to the console. */
const VERBOSE_CONTROLLER_LOG = false;
function formatTimestamp(date: Date): string {
return date.toISOString().slice(11, 23);
}
@@ -2004,7 +2006,7 @@ class DashboardController {
}
private startContinuousVoiceCapture(): void {
this.beginVoiceCapture("continuous");
void this.beginVoiceCapture("continuous");
}
private stopContinuousVoiceCapture(): void {
@@ -2761,7 +2763,7 @@ class DashboardController {
}
private appendLog(line: string): void {
//console.log(`[${formatTimestamp(new Date())}] ${line}`);
if (VERBOSE_CONTROLLER_LOG) console.log(`[${formatTimestamp(new Date())}] ${line}`);
}
private setDisplayPreview(preview: ImageSource | null): void {
+1 -1
View File
@@ -95,7 +95,7 @@ export function g2NameAddressTail(name: string | null | undefined): string | nul
* Even's wire order is reversed human order: "AA:BB:CC:DD:EE:FF" ⇄ [FF EE DD CC BB AA].
*/
export function wireBytesFromHumanReadableAddress(address: string): Uint8Array | null {
const cleaned = address.replace(/[:\-]/g, "").trim();
const cleaned = address.replace(/[:-]/g, "").trim();
if (cleaned.length !== 12 || !/^[0-9a-fA-F]{12}$/.test(cleaned)) return null;
const human = hexToBytes(cleaned);
return new Uint8Array(Array.from(human).reverse());
+1 -1
View File
@@ -187,7 +187,7 @@ function persistEvenHubFonts(base: ArrayBuffer): void {
writeError = error;
},
);
if (writeError) throw writeError;
if (writeError) throw writeError instanceof Error ? writeError : new Error(String(writeError));
// A degraded EvenHubFont (built before this extraction existed) is cached
// per JS context; drop it so the next render picks up the real fonts
// without an app restart.
+1 -1
View File
@@ -79,7 +79,7 @@ export class GlanceHost {
* "Show on head tilt" is off (it then wakes the regular UI). A release
* always passes so a hold in progress can end.
*/
eventForGesture(gesture: "head-tilt" | string): GlanceEvent | null {
eventForGesture(gesture: "head-tilt" | (string & {})): GlanceEvent | null {
const provider = this.options.getProvider();
if (!provider?.isEnabled()) return null;
if (gesture === "click" && !provider.showOnTap()) return null;
+1 -1
View File
@@ -66,7 +66,7 @@ export function reduceGlance(
* already handles or ignores while asleep.
*/
export function glanceEventForGesture(
gesture: "click" | "double-click" | "long-press" | "short-then-long-press" | "long-press-release" | "head-tilt" | string,
gesture: "click" | "double-click" | "long-press" | "short-then-long-press" | "long-press-release" | "head-tilt" | (string & {}),
boardVisible: boolean,
): GlanceEvent | null {
switch (gesture) {
+6 -8
View File
@@ -1,9 +1,8 @@
import { startRemoteInput } from "../remote/service"
import type { KeyboardInputSession } from '../ui/shell/keyboard-input'
import { acceptInput, resetRingInputFilter } from "../ui/input-monitor";
import { bindIosNotifications, iosNotificationsChanged, onIosNotificationPopup } from '../native/notification-icons.ios'
import { bindIosNotifications, iosNotificationsChanged, onIosNotificationPopup, readActiveNotifications } from '../native/notification-icons.ios'
import { shouldShowNotificationOnGlasses } from '../native/notification-sources'
import { readActiveNotifications } from '../native/notification-icons.ios'
import { launcherEntries } from '../apps/launcher'
import { getInstalledEvenHubAppById, installedEvenHubPackageId, uninstallEvenHubPackage } from '../apps/evenhub/installed-apps'
import { isInstalledPackagePresent } from '../apps/evenhub/updates'
@@ -14,9 +13,8 @@ import { registerWindowTools } from '../assistant/window-tools'
import { registerNavigateTools } from '../assistant/navigate-tools'
import { registerRoamTools } from '../assistant/roam-tools'
import { IosNavigationSensors } from '../native/ios-navigation-sensors'
import { Utils } from '@nativescript/core'
import { bindCompassSession, receiveCompassEvent } from '../native/compass.ios'
import { Dialogs, File, knownFolders, path, type ImageSource } from '@nativescript/core'
import { Dialogs, File, knownFolders, path, Utils, type ImageSource } from '@nativescript/core'
import { iosVoiceInput } from '../native/ios-voice-input'
import { nightscoutBridge } from '../native/nightscout-bridge'
import { FaceclawCommunicatorBridge, resolveIosPeripherals, type CommunicatorState, type RawInputEvent } from '../native/faceclaw-communicator.ios'
@@ -32,7 +30,6 @@ import { ALL_APPS } from '../apps/all-apps'
import type { AppContext, AppDefinition, AppLaunchParams } from '../apps/app-definition'
import { WorkerAppHost } from '../ui/shell/worker-window'
import { createInProcessWindow, YieldAtRootLayer, type InProcessAppOptions, type InProcessWindow } from '../ui/shell/in-process-window'
import { getStringSettingById, nightscoutSiteUrlSetting, nightscoutApiTokenSetting } from '../ui/dashboard-settings'
import { readPhoneBatteryState } from '../native/phone-battery'
import { iosAppUnavailableReason } from '../apps/ios-availability'
import { flattenPlanesWithDraws, planesFingerprint, type Plane } from '../graphics/plane'
@@ -44,7 +41,8 @@ import { TextViewerLayer } from '../apps/files/text-viewer'
import { shell, rawInputEventToInputEvent, type ShellWindow } from '../ui/shell/shell'
import { appViewportRect, SIDEBAR_WIDTH, sidebarStripVisible } from '../ui/shell/geometry'
import { DISPLAY_MODE_VALUES, displayModeLabel, displayModeSetting, onAnySettingChanged,
previewColorSetting, lockScreenEnabledSetting, getBrightnessPreferences } from '../ui/dashboard-settings'
previewColorSetting, lockScreenEnabledSetting, getBrightnessPreferences, getStringSettingById,
nightscoutSiteUrlSetting, nightscoutApiTokenSetting } from '../ui/dashboard-settings'
import type { PhoneGesture } from '../phone-ui/phone-gestures'
import { isWelcomeSoundPending, setWelcomeSoundPending } from '../phone-ui/onboarding-state'
import { findSoundEffect, playSoundEffect } from '../ui/sound-effects'
@@ -548,10 +546,10 @@ export class IosPreviewController {
this.requestShellRender()
}
async launchApp(id: string, params?: AppLaunchParams): Promise<void> {
const app = ALL_APPS.find(app => app.appId === id)
const app = ALL_APPS.find(candidate => candidate.appId === id)
if (!app) {
const installed = getInstalledEvenHubAppById(id)
const host = ALL_APPS.find(app => app.appId === 'evenhub')
const host = ALL_APPS.find(candidate => candidate.appId === 'evenhub')
if (installed && host) {
try {
if (isInstalledPackagePresent(installed.packageId))