From e377ed6dc580e061521e74c9f2e9bd092afd7bc9 Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Sun, 11 Oct 2026 20:53:42 +0200 Subject: [PATCH 1/4] DFULoader: mark intended assignments in while conditions Extra parentheses show the regex-match assignment in the loop condition is deliberate. --- DFULoader/dfuse.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DFULoader/dfuse.js b/DFULoader/dfuse.js index fef31a79..353f149b 100644 --- a/DFULoader/dfuse.js +++ b/DFULoader/dfuse.js @@ -41,11 +41,11 @@ var dfuse = {}; let contiguousSegmentRegex = /\/\s*(0x[0-9a-fA-F]{1,8})\s*\/(\s*[0-9]+\s*\*\s*[0-9]+\s?[ BKM]\s*[abcdefg]\s*,?\s*)+/g; let contiguousSegmentMatch; - while (contiguousSegmentMatch = contiguousSegmentRegex.exec(segmentString)) { + while ((contiguousSegmentMatch = contiguousSegmentRegex.exec(segmentString))) { let segmentRegex = /([0-9]+)\s*\*\s*([0-9]+)\s?([ BKM])\s*([abcdefg])\s*,?\s*/g; let startAddress = parseInt(contiguousSegmentMatch[1], 16); let segmentMatch; - while (segmentMatch = segmentRegex.exec(contiguousSegmentMatch[0])) { + while ((segmentMatch = segmentRegex.exec(contiguousSegmentMatch[0]))) { let segment = {} let sectorCount = parseInt(segmentMatch[1], 10); let sectorSize = parseInt(segmentMatch[2]) * sectorMultipliers[segmentMatch[3]]; From b452e7b6dfc2420d53a9ead9e2ae4f2d4a9ae968 Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Sun, 11 Oct 2026 20:53:42 +0200 Subject: [PATCH 2/4] DFULoader: call hasOwnProperty through Object.prototype --- DFULoader/dfu-util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DFULoader/dfu-util.js b/DFULoader/dfu-util.js index 79a49442..b835deca 100644 --- a/DFULoader/dfu-util.js +++ b/DFULoader/dfu-util.js @@ -130,7 +130,7 @@ var device = null; let configValue = device.settings.configuration.configurationValue; if (configDesc.bConfigurationValue == configValue) { for (let desc of configDesc.descriptors) { - if (desc.bDescriptorType == 0x21 && desc.hasOwnProperty("bcdDFUVersion")) { + if (desc.bDescriptorType == 0x21 && Object.prototype.hasOwnProperty.call(desc, "bcdDFUVersion")) { funcDesc = desc; break; } From dc6963b2de2ef6a838294a4d3d757b9274dc4741 Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Sun, 11 Oct 2026 20:53:42 +0200 Subject: [PATCH 3/4] DFULoader: drop unused catch bindings Use catch without a binding where the error is not used. --- DFULoader/dfu-util.js | 2 +- DFULoader/dfuse.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DFULoader/dfu-util.js b/DFULoader/dfu-util.js index b835deca..700a0ad8 100644 --- a/DFULoader/dfu-util.js +++ b/DFULoader/dfu-util.js @@ -543,7 +543,7 @@ var device = null; if (status.state == dfu.dfuERROR) { await device.clearStatus(); } - } catch (error) { + } catch { device.logWarning("Failed to clear status"); } await device.do_download(transferSize, firmwareFile, manifestationTolerant).then( diff --git a/DFULoader/dfuse.js b/DFULoader/dfuse.js index 353f149b..881050e8 100644 --- a/DFULoader/dfuse.js +++ b/DFULoader/dfuse.js @@ -272,7 +272,7 @@ var dfuse = {}; try { await this.poll_until(state => (state == dfu.dfuMANIFEST)); - } catch (error) { + } catch { } } From 703d3f24ff85b2a15a3d8a461de1f658ca5c2652 Mon Sep 17 00:00:00 2001 From: j-w9 <295470691+j-w9@users.noreply.github.com> Date: Sun, 11 Oct 2026 20:53:44 +0200 Subject: [PATCH 4/4] DFULoader: prune fixed ESLint suppressions --- eslint-suppressions.json | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/eslint-suppressions.json b/eslint-suppressions.json index d509b65e..989385be 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -43,14 +43,11 @@ } }, "DFULoader/dfu-util.js": { - "no-prototype-builtins": { - "count": 1 - }, "no-undef": { "count": 2 }, "no-unused-vars": { - "count": 6 + "count": 5 }, "no-useless-assignment": { "count": 1 @@ -65,15 +62,9 @@ } }, "DFULoader/dfuse.js": { - "no-cond-assign": { - "count": 2 - }, "no-undef": { "count": 1 }, - "no-unused-vars": { - "count": 1 - }, "no-useless-assignment": { "count": 1 }