UNPKG

@isentinel/eslint-plugin-comment-length

Version:
37 lines 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.reportCompactableBlocks = void 0; const const_message_ids_1 = require("../../const.message-ids"); const fix_overflow_1 = require("./fix.overflow"); const util_can_block_be_compacted_1 = require("./util.can-block-be-compacted"); function reportCompactableBlocks(ruleContext, baseComment, context, blocks) { if (context.mode !== "compact") { return; } for (const block of blocks) { if (!(0, util_can_block_be_compacted_1.canBlockBeCompated)(block, context)) { continue; } ruleContext.report({ loc: { start: { column: 0, line: baseComment.loc.start.line + block.startIndex, }, end: { column: baseComment.loc.start.column + context.boilerplateSize + (block.lines.at(-1)?.length ?? 0), line: baseComment.loc.start.line + block.endIndex, }, }, messageId: const_message_ids_1.MessageIds.CAN_COMPACT, data: { maxLength: context.maxLength, }, fix: (fixer) => (0, fix_overflow_1.fixOverflowingBlock)(fixer, block, context), }); } } exports.reportCompactableBlocks = reportCompactableBlocks; //# sourceMappingURL=report.compact.js.map