UNPKG

eslint-plugin-comment-length

Version:

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

27 lines (24 loc) 821 B
import { mergeComments } from './util.merge-comments.js'; function captureNearbyComments(comments, startIndex) { let comment = comments[startIndex]; if (!comment) { return; } for (let i = startIndex - 1; i >= 0; i--) { const prevComment = comments[i]; if (!prevComment || (prevComment.loc?.end.line ?? 0) + 1 !== comment.loc?.start.line) { break; } comment = mergeComments(prevComment, comment, "\n"); } for (let i = startIndex + 1; i < comments.length; i++) { const nextComment = comments[i]; if (!nextComment || nextComment.loc?.start.line !== (comment.loc?.end.line ?? 0) + 1) { break; } comment = mergeComments(comment, nextComment, "\n"); } return comment; } export { captureNearbyComments }; //# sourceMappingURL=util.capture-nearby-comments.js.map