UNPKG

eslint-plugin-comment-length

Version:

An ESLint plugin that provides rules that limit the line length of your comments

23 lines (19 loc) 765 B
'use strict'; var isUrl = require('../../utils/is-url.cjs'); 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 && isUrl.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.cjs.map