UNPKG

@isentinel/eslint-plugin-comment-length

Version:
22 lines 933 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.canBlockBeCompated = void 0; const is_url_1 = require("../../utils/is-url"); function canBlockBeCompated(comments, block, context) { for (let i = block.startIndex + 1; i <= block.endIndex; i++) { const prev = comments[i - 1]; const curr = comments[i]; if (!prev || !curr || (context.ignoreUrls && (0, is_url_1.isURL)(curr?.value))) { continue; } const firstWordOnCurrentLine = curr.value.trim().split(" ")[0]; const lengthOfPrevLine = prev.value.length + context.boilerplateSize + context.whitespace.size + 1; if (lengthOfPrevLine + 1 + (firstWordOnCurrentLine?.length ?? 0) <= context.maxLength) { return true; } } return false; } exports.canBlockBeCompated = canBlockBeCompated; //# sourceMappingURL=util.can-block-be-compacted.js.map