Skip to content

Commit 611d674

Browse files
committed
Fix lint issues
1 parent 34036b9 commit 611d674

24 files changed

+69
-83
lines changed

src/js/DarkTheme.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import $ from "jquery";
22

3-
const css_dark = ["./css/dark-theme.css"];
4-
53
const DarkTheme = {
64
configSetting: undefined,
75
enabled: false,

src/js/TuningSliders.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ const TuningSliders = {
4747
expertMode: false,
4848
};
4949

50-
const D_MAX_RATIO = 0.85;
51-
5250
TuningSliders.initialize = function () {
5351
this.PID_DEFAULT = FC.getPidDefaults();
5452
this.FILTER_DEFAULT = FC.getFilterDefaults();
@@ -441,7 +439,7 @@ TuningSliders.updateFormPids = function (updateSlidersOnly = false) {
441439
this.updateSlidersWarning();
442440
};
443441

444-
TuningSliders.calculateNewPids = function (updateSlidersOnly = false) {
442+
TuningSliders.calculateNewPids = function () {
445443
// this is the main calculation for PID sliders, inputs are in form of slider position values
446444
// values get set both into forms and their respective variables
447445
FC.TUNING_SLIDERS.slider_pids_mode = this.sliderPidsMode;

src/js/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Model.prototype.optimizeGeometryForCanvas = function (geometry) {
159159
const uniqueVertices = [];
160160
const updatedFaces = [];
161161

162-
geometry.vertices.forEach((vertex, index) => {
162+
geometry.vertices.forEach((vertex) => {
163163
// Round coordinates with configurable tolerance
164164
const key = [
165165
Math.round(vertex.x * tolerance) / tolerance,

src/js/msp/MSPHelper.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ const ledDirectionLetters = ["n", "e", "s", "w", "u", "d"]; // in LSB bit order
2323
const ledBaseFunctionLetters = ["c", "f", "a", "l", "s", "g", "r", "p", "e", "u"]; // in LSB bit
2424
let ledOverlayLetters = ["t", "y", "o", "b", "v", "i", "w"]; // in LSB bit
2525

26-
const MAX_GYROS = 8; // maximum number of gyros supported by Betaflight
27-
2826
function MspHelper() {
2927
const self = this;
3028

src/js/msp/debug/msp_queue_monitor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ export class MSPQueueMonitor {
123123
return true;
124124
});
125125
if (isDuplicate) this.metrics.duplicates++;
126-
} catch (_) {
127-
// best-effort only
126+
} catch {
127+
// Ignore errors in duplicate detection
128128
}
129129

130130
// Check for queue size peaks

src/js/msp/debug/msp_stress_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export class MSPStressTest {
276276
try {
277277
await this.msp.promise(code, null);
278278
return { error: "Expected timeout but request succeeded" };
279-
} catch (error) {
279+
} catch {
280280
const timeoutTime = performance.now() - startTime;
281281

282282
// Test that new requests work after timeout

src/js/protocols/WebSocket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Websocket extends EventTarget {
5757
return new Uint8Array(buffer);
5858
}
5959

60-
async connect(path, options) {
60+
async connect(path) {
6161
this.address = path;
6262
console.log(`${this.logHead} Connecting to ${this.address}`);
6363

src/js/protocols/webusbdfu.js

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ class WEBUSBDFU_protocol extends EventTarget {
471471
};
472472
return memory;
473473
};
474-
const chipInfo = descriptors.map(parseDescriptor).reduce((o, v, i) => {
474+
const chipInfo = descriptors.map(parseDescriptor).reduce((o, v) => {
475475
o[v.type.toLowerCase().replace(" ", "_")] = v;
476476
return o;
477477
}, {});
@@ -500,7 +500,7 @@ class WEBUSBDFU_protocol extends EventTarget {
500500
}
501501
})
502502
.catch((error) => {
503-
console.log(`${this.logHead} USB controlTransfer IN failed for request: ${request}`);
503+
console.log(`${this.logHead} USB controlTransfer IN failed for request: ${request} (${error})`);
504504
callback([], 1);
505505
});
506506
} else {
@@ -525,7 +525,7 @@ class WEBUSBDFU_protocol extends EventTarget {
525525
}
526526
})
527527
.catch((error) => {
528-
console.log(`${this.logHead} USB controlTransfer OUT failed for request: ${request}`);
528+
console.log(`${this.logHead} USB controlTransfer OUT failed for request: ${request} (${error})`);
529529
});
530530
}
531531
}
@@ -900,7 +900,7 @@ class WEBUSBDFU_protocol extends EventTarget {
900900
const spans_page = hexData.address < page_start && end_address > page_end;
901901

902902
if (starts_in_page || ends_in_page || spans_page) {
903-
const idx = erase_pages.findIndex((element, index, array) => {
903+
const idx = erase_pages.findIndex((element) => {
904904
return element.sector === i && element.page === j;
905905
});
906906
if (idx === -1) {
@@ -1161,31 +1161,23 @@ class WEBUSBDFU_protocol extends EventTarget {
11611161
? this.transferSize
11621162
: this.hex.data[reading_block].bytes - bytes_verified;
11631163

1164-
this.controlTransfer(
1165-
"in",
1166-
this.request.UPLOAD,
1167-
wBlockNum++,
1168-
0,
1169-
bytes_to_read,
1170-
0,
1171-
(data, code) => {
1172-
for (const piece of data) {
1173-
this.verify_hex[reading_block].push(piece);
1174-
}
1164+
this.controlTransfer("in", this.request.UPLOAD, wBlockNum++, 0, bytes_to_read, 0, (data) => {
1165+
for (const piece of data) {
1166+
this.verify_hex[reading_block].push(piece);
1167+
}
11751168

1176-
address += bytes_to_read;
1177-
bytes_verified += bytes_to_read;
1178-
bytes_verified_total += bytes_to_read;
1169+
address += bytes_to_read;
1170+
bytes_verified += bytes_to_read;
1171+
bytes_verified_total += bytes_to_read;
11791172

1180-
// update progress bar
1181-
TABS.firmware_flasher.flashProgress(
1182-
((this.hex.bytes_total + bytes_verified_total) / (this.hex.bytes_total * 2)) * 100,
1183-
);
1173+
// update progress bar
1174+
TABS.firmware_flasher.flashProgress(
1175+
((this.hex.bytes_total + bytes_verified_total) / (this.hex.bytes_total * 2)) * 100,
1176+
);
11841177

1185-
// verify another page
1186-
read();
1187-
},
1188-
);
1178+
// verify another page
1179+
read();
1180+
});
11891181
} else {
11901182
if (reading_block < blocks) {
11911183
// move to another block
@@ -1261,7 +1253,7 @@ class WEBUSBDFU_protocol extends EventTarget {
12611253
this.loadAddress(address, () => {
12621254
// 'downloading' 0 bytes to the program start address followed by a GETSTATUS is used to trigger DFU exit on STM32
12631255
this.controlTransfer("out", this.request.DNLOAD, 0, 0, 0, 0, () => {
1264-
this.controlTransfer("in", this.request.GETSTATUS, 0, 0, 6, 0, (data) => {
1256+
this.controlTransfer("in", this.request.GETSTATUS, 0, 0, 6, 0, () => {
12651257
this.cleanup();
12661258
});
12671259
});

src/js/receiver_msp/receiver_msp.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import $ from "jquery";
77
// It seems than when node opens a new window, the module "context" is different, so the i18n var is not initialized
88
const i18n = opener.i18n;
99

10-
const css_dark = ["/css/dark-theme.css"];
11-
1210
const CHANNEL_MIN_VALUE = 1000;
1311
const CHANNEL_MID_VALUE = 1500;
1412
const CHANNEL_MAX_VALUE = 2000;
@@ -191,7 +189,7 @@ $(".slider", sliderElems).each(function (sliderIndex) {
191189
/*
192190
* Mouseup handler needs to be bound to the window in order to receive mouseup if mouse leaves window.
193191
*/
194-
$(window).on("mouseup", function (e) {
192+
$(window).on("mouseup", function () {
195193
$(this).off("mousemove", handleGimbalMouseDrag);
196194
});
197195

src/js/serial_backend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function disconnectHandler(event) {
5959
export function initializeSerialBackend() {
6060
$("a.connection_button__link").on("click", connectDisconnect);
6161

62-
EventBus.$on("port-handler:auto-select-serial-device", function (device) {
62+
EventBus.$on("port-handler:auto-select-serial-device", function () {
6363
if (
6464
!GUI.connected_to &&
6565
!GUI.connecting_to &&
@@ -658,7 +658,7 @@ function onConnect() {
658658
// show only appropriate tabs
659659
$("#tabs ul.mode-connected li").hide();
660660
$("#tabs ul.mode-connected li")
661-
.filter(function (index) {
661+
.filter(function () {
662662
const classes = $(this).attr("class").split(/\s+/);
663663
let found = false;
664664

0 commit comments

Comments
 (0)