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 <noreply@anthropic.com>
This commit is contained in:
parent
32622a01de
commit
8e0c192973
@ -52,9 +52,10 @@ This check is for internal development and validation only. APC must never appea
|
|||||||
## ESLint
|
## ESLint
|
||||||
|
|
||||||
- Continuation lines inside `args: [` must be aligned to **23 spaces**
|
- 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 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)
|
- 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
|
## Payment Operation Maintenance
|
||||||
|
|
||||||
|
|||||||
@ -113,7 +113,10 @@ function parseTlvSequence(bytes, start, end, depth) {
|
|||||||
let offset = start;
|
let offset = start;
|
||||||
while (offset < end) {
|
while (offset < end) {
|
||||||
// Skip 0x00 padding bytes (common in EMV records)
|
// 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);
|
const tlv = readTlv(bytes, offset);
|
||||||
offset = tlv.nextOffset;
|
offset = tlv.nextOffset;
|
||||||
|
|||||||
@ -32,7 +32,7 @@ const EMV_TAG_DICTIONARY = {
|
|||||||
// ── File Control Information ───────────────────────────────────────────────
|
// ── File Control Information ───────────────────────────────────────────────
|
||||||
"6F": { name: "File Control Information (FCI) Template", constructed: true, source: "ICC", format: "b", class: "Application" },
|
"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" },
|
"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 ────────────────────────────────────────────
|
// ── Record / Response Templates ────────────────────────────────────────────
|
||||||
"70": { name: "Record Template", constructed: true, source: "ICC", format: "b", class: "Application" },
|
"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" },
|
"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" },
|
"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" },
|
"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" },
|
"9F4D": { name: "Log Entry", constructed: false, source: "ICC", format: "b", class: "Application" },
|
||||||
|
|
||||||
// ── Card / Cardholder Data ─────────────────────────────────────────────────
|
// ── 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" },
|
"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" },
|
"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" },
|
"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" },
|
"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" },
|
"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" },
|
"9F32": { name: "Issuer Public Key Exponent", constructed: false, source: "ICC", format: "b", class: "Application" },
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import {
|
|||||||
*/
|
*/
|
||||||
class BuildEMVARPCData extends Operation {
|
class BuildEMVARPCData extends Operation {
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -90,9 +91,9 @@ class BuildEMVARPCData extends Operation {
|
|||||||
run(input, args) {
|
run(input, args) {
|
||||||
const [method, arqc, arc, csu, pad, fmt] = args;
|
const [method, arqc, arc, csu, pad, fmt] = args;
|
||||||
|
|
||||||
const { fields, hex } = method === METHOD2
|
const { fields, hex } = method === METHOD2 ?
|
||||||
? buildMethod2(arqc, csu, pad)
|
buildMethod2(arqc, csu, pad) :
|
||||||
: buildMethod1(arqc, arc);
|
buildMethod1(arqc, arc);
|
||||||
|
|
||||||
if (fmt === "JSON") return formatJson(fields, method);
|
if (fmt === "JSON") return formatJson(fields, method);
|
||||||
if (fmt === "Annotated") return formatAnnotated(fields, method);
|
if (fmt === "Annotated") return formatAnnotated(fields, method);
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { buildCdol1, formatHex, formatJson, formatAnnotatedTlv } from "../lib/Em
|
|||||||
*/
|
*/
|
||||||
class BuildEMVARQCData extends Operation {
|
class BuildEMVARQCData extends Operation {
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import {
|
|||||||
*/
|
*/
|
||||||
class ParseEMVARPCData extends Operation {
|
class ParseEMVARPCData extends Operation {
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { parseCdol1, formatJson, formatAnnotatedTlv } from "../lib/EmvCdol.mjs";
|
|||||||
*/
|
*/
|
||||||
class ParseEMVARQCData extends Operation {
|
class ParseEMVARQCData extends Operation {
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { parseEmvTlv, EMV_TAG_DICTIONARY } from "../lib/EmvTlv.mjs";
|
|||||||
*/
|
*/
|
||||||
class ParseEMVTLV extends Operation {
|
class ParseEMVTLV extends Operation {
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user