@isentinel/eslint-plugin-comment-length
Version:
32 lines • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.reportOverflowingBlocks = void 0;
const const_message_ids_1 = require("../../const.message-ids");
const fix_overflow_1 = require("./fix.overflow");
function reportOverflowingBlocks(ruleContext, baseComment, context, overflowingBlocks) {
for (const fixableBlock of overflowingBlocks) {
ruleContext.report({
// Ensure we only highlight exactly the block within the multi-line
// comment which violates the rule.
loc: {
start: {
column: 0,
line: baseComment.loc.start.line + fixableBlock.startIndex,
},
end: {
column: baseComment.loc.start.column +
context.boilerplateSize +
(fixableBlock.lines.at(-1)?.length ?? 0),
line: baseComment.loc.start.line + fixableBlock.endIndex,
},
},
messageId: const_message_ids_1.MessageIds.EXCEEDS_MAX_LENGTH,
data: {
maxLength: context.maxLength,
},
fix: (fixer) => (0, fix_overflow_1.fixOverflowingBlock)(fixer, fixableBlock, context),
});
}
}
exports.reportOverflowingBlocks = reportOverflowingBlocks;
//# sourceMappingURL=report.overflow.js.map