eslint-plugin-comment-length
Version:
An ESLint plugin that provides rules that limit the line length of your comments
32 lines (28 loc) • 1.09 kB
JavaScript
;
var const_messageIds = require('../../const.message-ids.cjs');
var fix_overflow = require('./fix.overflow.cjs');
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_messageIds.MessageIds.EXCEEDS_MAX_LENGTH,
data: {
maxLength: context.maxLength
},
fix: (fixer) => fix_overflow.fixOverflowingBlock(fixer, fixableBlock, context)
});
}
}
exports.reportOverflowingBlocks = reportOverflowingBlocks;
//# sourceMappingURL=report.overflow.cjs.map