UNPKG

ecmarkup

Version:

Custom element definitions and core utilities for markup that specifies ECMAScript and related technologies.

20 lines (19 loc) 687 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; const ruleId = 'algorithm-step-numbering'; /* Checks that step numbers are all `1`. */ function default_1(report, node, algorithmSource) { const itemSource = algorithmSource.slice(node.location.start.offset, node.location.end.offset); const match = itemSource.match(/^(\s*)(\d+\.) /); if (match[2] !== '1.') { report({ ruleId, line: node.location.start.line, column: node.location.start.column + match[1].length, message: `expected step number to be "1." (found ${JSON.stringify(match[2])})`, }); } }