Skip to content

Commit 1ec6aa9

Browse files
brianignacio5tyeth
authored andcommitted
fix lint
1 parent 6c57b8c commit 1ec6aa9

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

src/image/base.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@ import { checksum, ESP_CHECKSUM_MAGIC, padTo } from "../util";
55

66
export const ESP_IMAGE_MAGIC = 0xe9;
77

8+
/**
9+
* Return position aligned to size
10+
* @param {number} position Position to align
11+
* @param {number} size Alignment size
12+
* @returns {number} Aligned position
13+
*/
814
export function alignFilePosition(position: number, size: number): number {
915
const align = size - 1 - (position % size);
1016
return position + align;
1117
}
1218

19+
/**
20+
* Read a UINT32 from a byte array (little-endian)
21+
* @param {Uint8Array} data Data to read a UINT32
22+
* @param {number} offset data start offset
23+
* @returns {number} The read UINT32 value
24+
*/
1325
function readUInt32LE(data: Uint8Array, offset: number): number {
1426
return data[offset] | (data[offset + 1] << 8) | (data[offset + 2] << 16) | (data[offset + 3] << 24);
1527
}
@@ -233,8 +245,8 @@ export class BaseFirmwareImage {
233245

234246
/**
235247
* Return ESPLoader checksum from end of just-read image
236-
* @param data image to read checksum from
237-
* @param offset Current offset in image
248+
* @param {Uint8Array} data image to read checksum from
249+
* @param {number} offset Current offset in image
238250
* @returns {number} checksum value
239251
*/
240252
readChecksum(data: Uint8Array, offset: number): number {

src/image/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
/**
2020
* Function to load a firmware image from a string (from FileReader)
2121
* @param {ROM} rom - The ROM object representing the target device
22-
* @param imageData Image data as a string
22+
* @param {string} imageData Image data as a string
2323
* @returns {Promise<BaseFirmwareImage>} - A promise that resolves to the loaded firmware image
2424
*/
2525
export async function loadFirmwareImage(rom: ROM, imageData: string): Promise<BaseFirmwareImage> {

src/webserial.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,15 @@ class Transport {
7171

7272
/**
7373
* Set callback for when device is lost
74-
* @param callback Function to call when device is lost
74+
* @param {Function} callback Function to call when device is lost
7575
*/
7676
setDeviceLostCallback(callback: (() => void) | null) {
7777
this.onDeviceLostCallback = callback;
7878
}
7979

80-
8180
/**
8281
* Update the device reference (used when re-selecting device after reset)
83-
* @param newDevice New SerialPort device
82+
* @param {typeof import("w3c-web-serial").SerialPort} newDevice New SerialPort device
8483
*/
8584
updateDevice(newDevice: SerialPort) {
8685
this.device = newDevice;
@@ -407,9 +406,9 @@ class Transport {
407406
}
408407
} catch (error) {
409408
console.error("Error reading from serial port:", error);
410-
409+
411410
// Check if it's a NetworkError indicating device loss
412-
if (error instanceof Error && error.name === 'NetworkError' && error.message.includes('device has been lost')) {
411+
if (error instanceof Error && error.name === "NetworkError" && error.message.includes("device has been lost")) {
413412
this.trace("Device lost detected (NetworkError)");
414413
if (this.onDeviceLostCallback) {
415414
this.onDeviceLostCallback();

0 commit comments

Comments
 (0)