From 8e0c19297335d34671604d5e3f831b143a41bc0e Mon Sep 17 00:00:00 2001 From: J8k3 Date: Thu, 21 May 2026 19:44:13 -0400 Subject: [PATCH] Fix lint: brace-style, comma-spacing, key-spacing, JSDoc, operator-linebreak 11 ESLint errors across 6 files introduced in the ARQC/ARPC/TLV/Script ops. Also document the constructor-JSDoc and operator-linebreak rules in AGENTS.md to prevent recurrence. Co-Authored-By: Claude Sonnet 4.6 --- AGENTS.md | 3 ++- src/core/lib/EmvTlv.mjs | 5 ++++- src/core/lib/EmvTlvDictionary.mjs | 6 +++--- src/core/operations/BuildEMVARPCData.mjs | 7 ++++--- src/core/operations/BuildEMVARQCData.mjs | 1 + src/core/operations/ParseEMVARPCData.mjs | 1 + src/core/operations/ParseEMVARQCData.mjs | 1 + src/core/operations/ParseEMVTLV.mjs | 1 + 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 8d179344..6f381edf 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -52,9 +52,10 @@ This check is for internal development and validation only. APC must never appea ## ESLint - Continuation lines inside `args: [` must be aligned to **23 spaces** -- All module-level functions require JSDoc (`jsdoc/require-jsdoc`) +- All module-level functions require JSDoc (`jsdoc/require-jsdoc`). Constructors must have their own JSDoc — either `/** @inheritdoc */` or a named comment block. The class-level JSDoc does not satisfy this. - No unused imports - No inline single-line blocks: `try { x; } catch` or `if (x) { y; }` — statement and closing brace must each be on their own line (`brace-style` rule) +- Ternary `?` and `:` must be at the **end** of the line, not the start (`operator-linebreak` rule). Write `condition ?\n a :\n b` not `condition\n ? a\n : b`. ## Payment Operation Maintenance diff --git a/src/core/lib/EmvTlv.mjs b/src/core/lib/EmvTlv.mjs index addbe480..d37c12ae 100644 --- a/src/core/lib/EmvTlv.mjs +++ b/src/core/lib/EmvTlv.mjs @@ -113,7 +113,10 @@ function parseTlvSequence(bytes, start, end, depth) { let offset = start; while (offset < end) { // Skip 0x00 padding bytes (common in EMV records) - if (bytes[offset] === 0x00) { offset++; continue; } + if (bytes[offset] === 0x00) { + offset++; + continue; + } const tlv = readTlv(bytes, offset); offset = tlv.nextOffset; diff --git a/src/core/lib/EmvTlvDictionary.mjs b/src/core/lib/EmvTlvDictionary.mjs index f80370b6..ed03a6c7 100644 --- a/src/core/lib/EmvTlvDictionary.mjs +++ b/src/core/lib/EmvTlvDictionary.mjs @@ -32,7 +32,7 @@ const EMV_TAG_DICTIONARY = { // ── File Control Information ─────────────────────────────────────────────── "6F": { name: "File Control Information (FCI) Template", constructed: true, source: "ICC", format: "b", class: "Application" }, "A5": { name: "FCI Proprietary Template", constructed: true, source: "ICC", format: "b", class: "Context-Specific" }, - "BF0C":{ name: "FCI Issuer Discretionary Data", constructed: true, source: "ICC", format: "b", class: "Private" }, + "BF0C": { name: "FCI Issuer Discretionary Data", constructed: true, source: "ICC", format: "b", class: "Private" }, // ── Record / Response Templates ──────────────────────────────────────────── "70": { name: "Record Template", constructed: true, source: "ICC", format: "b", class: "Application" }, @@ -51,7 +51,7 @@ const EMV_TAG_DICTIONARY = { "9F06": { name: "Application Identifier (AID) — Terminal", constructed: false, source: "T", format: "b", class: "Application" }, "9F11": { name: "Issuer Code Table Index", constructed: false, source: "ICC", format: "n", class: "Application" }, "9F12": { name: "Application Preferred Name", constructed: false, source: "ICC", format: "ans", class: "Application" }, - "9F38": { name: "Processing Options Data Object List (PDOL)",constructed: false, source: "ICC", format: "b", class: "Application" }, + "9F38": { name: "Processing Options Data Object List (PDOL)", constructed: false, source: "ICC", format: "b", class: "Application" }, "9F4D": { name: "Log Entry", constructed: false, source: "ICC", format: "b", class: "Application" }, // ── Card / Cardholder Data ───────────────────────────────────────────────── @@ -144,7 +144,7 @@ const EMV_TAG_DICTIONARY = { "90": { name: "Issuer Public Key Certificate", constructed: false, source: "ICC", format: "b", class: "Context-Specific" }, "92": { name: "Issuer Public Key Remainder", constructed: false, source: "ICC", format: "b", class: "Context-Specific" }, "93": { name: "Signed Static Application Data", constructed: false, source: "ICC", format: "b", class: "Context-Specific" }, - "9F2D": { name: "ICC PIN Encipherment Public Key Certificate",constructed: false, source: "ICC", format: "b", class: "Application" }, + "9F2D": { name: "ICC PIN Encipherment Public Key Certificate", constructed: false, source: "ICC", format: "b", class: "Application" }, "9F2E": { name: "ICC PIN Encipherment Public Key Exponent", constructed: false, source: "ICC", format: "b", class: "Application" }, "9F2F": { name: "ICC PIN Encipherment Public Key Remainder", constructed: false, source: "ICC", format: "b", class: "Application" }, "9F32": { name: "Issuer Public Key Exponent", constructed: false, source: "ICC", format: "b", class: "Application" }, diff --git a/src/core/operations/BuildEMVARPCData.mjs b/src/core/operations/BuildEMVARPCData.mjs index 0c281941..c2375fad 100644 --- a/src/core/operations/BuildEMVARPCData.mjs +++ b/src/core/operations/BuildEMVARPCData.mjs @@ -15,6 +15,7 @@ import { */ class BuildEMVARPCData extends Operation { + /** @inheritdoc */ constructor() { super(); @@ -90,9 +91,9 @@ class BuildEMVARPCData extends Operation { run(input, args) { const [method, arqc, arc, csu, pad, fmt] = args; - const { fields, hex } = method === METHOD2 - ? buildMethod2(arqc, csu, pad) - : buildMethod1(arqc, arc); + const { fields, hex } = method === METHOD2 ? + buildMethod2(arqc, csu, pad) : + buildMethod1(arqc, arc); if (fmt === "JSON") return formatJson(fields, method); if (fmt === "Annotated") return formatAnnotated(fields, method); diff --git a/src/core/operations/BuildEMVARQCData.mjs b/src/core/operations/BuildEMVARQCData.mjs index d2eface6..90812e5f 100644 --- a/src/core/operations/BuildEMVARQCData.mjs +++ b/src/core/operations/BuildEMVARQCData.mjs @@ -11,6 +11,7 @@ import { buildCdol1, formatHex, formatJson, formatAnnotatedTlv } from "../lib/Em */ class BuildEMVARQCData extends Operation { + /** @inheritdoc */ constructor() { super(); diff --git a/src/core/operations/ParseEMVARPCData.mjs b/src/core/operations/ParseEMVARPCData.mjs index ffd5f2c8..6172b0cf 100644 --- a/src/core/operations/ParseEMVARPCData.mjs +++ b/src/core/operations/ParseEMVARPCData.mjs @@ -15,6 +15,7 @@ import { */ class ParseEMVARPCData extends Operation { + /** @inheritdoc */ constructor() { super(); diff --git a/src/core/operations/ParseEMVARQCData.mjs b/src/core/operations/ParseEMVARQCData.mjs index 7a4accda..20dc44dd 100644 --- a/src/core/operations/ParseEMVARQCData.mjs +++ b/src/core/operations/ParseEMVARQCData.mjs @@ -11,6 +11,7 @@ import { parseCdol1, formatJson, formatAnnotatedTlv } from "../lib/EmvCdol.mjs"; */ class ParseEMVARQCData extends Operation { + /** @inheritdoc */ constructor() { super(); diff --git a/src/core/operations/ParseEMVTLV.mjs b/src/core/operations/ParseEMVTLV.mjs index 4342a0f1..bf5b5447 100644 --- a/src/core/operations/ParseEMVTLV.mjs +++ b/src/core/operations/ParseEMVTLV.mjs @@ -11,6 +11,7 @@ import { parseEmvTlv, EMV_TAG_DICTIONARY } from "../lib/EmvTlv.mjs"; */ class ParseEMVTLV extends Operation { + /** @inheritdoc */ constructor() { super();