From 924720b5e026978ae5957022d8550ba8ba58ec03 Mon Sep 17 00:00:00 2001 From: u8array Date: Wed, 20 May 2026 22:40:53 +0200 Subject: [PATCH] fix(lint): remove useless null initializer in buildBwipOptions ESLint 10's no-useless-assignment rule, enabled via @eslint/js 10's recommended config (dependabot PR #77), flags the `let opts = null` in buildBwipOptions as dead. Every reachable case in the switch assigns opts before `break` and the `default` arm returns early, so the initial null is never read. Drops the initializer and the redundant truthiness guard before the rotation branch (opts is unconditionally assigned by the time we reach it). Behaviour is unchanged. --- src/components/Canvas/bwipHelpers.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Canvas/bwipHelpers.ts b/src/components/Canvas/bwipHelpers.ts index 70b3a499..1185a781 100644 --- a/src/components/Canvas/bwipHelpers.ts +++ b/src/components/Canvas/bwipHelpers.ts @@ -304,7 +304,11 @@ export function buildBwipOptions( // needed. const rotation = objectRotation(obj.props); - let opts: Record | null = null; + // Declared without an initializer because every reachable case + // assigns before `break` and the `default` arm returns early — the + // previous `= null` initializer is what ESLint 10's + // no-useless-assignment now flags as dead. + let opts: Record; switch (obj.type) { case "ean13": @@ -498,7 +502,7 @@ export function buildBwipOptions( return null; } - if (opts && rotation !== "N") { + if (rotation !== "N") { // ZPL uses N/R/I/B (B = 270° CW). bwip-js uses N/R/I/L (L = 90° CCW = // 270° CW). The other three letters mean the same thing in both. opts.rotate = rotation === "B" ? "L" : rotation;