Skip to content

Commit c490e77

Browse files
authored
Merge pull request #79 from u8array/chore/eslint10-no-useless-assignment
fix(lint): remove useless null initializer in buildBwipOptions
2 parents 2183e56 + 924720b commit c490e77

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/components/Canvas/bwipHelpers.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,11 @@ export function buildBwipOptions(
304304
// needed.
305305
const rotation = objectRotation(obj.props);
306306

307-
let opts: Record<string, unknown> | null = null;
307+
// Declared without an initializer because every reachable case
308+
// assigns before `break` and the `default` arm returns early — the
309+
// previous `= null` initializer is what ESLint 10's
310+
// no-useless-assignment now flags as dead.
311+
let opts: Record<string, unknown>;
308312

309313
switch (obj.type) {
310314
case "ean13":
@@ -498,7 +502,7 @@ export function buildBwipOptions(
498502
return null;
499503
}
500504

501-
if (opts && rotation !== "N") {
505+
if (rotation !== "N") {
502506
// ZPL uses N/R/I/B (B = 270° CW). bwip-js uses N/R/I/L (L = 90° CCW =
503507
// 270° CW). The other three letters mean the same thing in both.
504508
opts.rotate = rotation === "B" ? "L" : rotation;

0 commit comments

Comments
 (0)