eslint-plugin-comment-length
Version:
An ESLint plugin that provides rules that limit the line length of your comments
11 lines (8 loc) • 398 B
JavaScript
;
function isCommentOnOwnLine(sourceCode, comment) {
const previousToken = sourceCode.getTokenBefore(comment);
const nextToken = sourceCode.getTokenAfter(comment);
return previousToken?.loc.end.line !== comment.loc?.start.line && nextToken?.loc.start.line !== comment.loc?.end.line;
}
exports.isCommentOnOwnLine = isCommentOnOwnLine;
//# sourceMappingURL=is-on-own-line.cjs.map