lib/rules/html-comment-content-newline.js
function getCommentLocatuons(node) {
            const contentStartIndex = node.commentOpen.range[1]
            const contentEndIndex = node.commentClose.range[0]
            const contentText = sourceCode.text.slice(
                contentStartIndex,
                contentEndIndex
            )
            const contentFirstIndex = (() => {
                const index = contentText.search(/\S/u)
                if (index >= 0) {
                    return index + contentStartIndex
                }
                return contentEndIndex
            })()
            const contentLastIndex = (() => {
                const index = contentText.search(/\S\s*$/gu)
                if (index >= 0) {
                    return index + contentStartIndex + 1
                }
                return contentStartIndex
            })()

            return {
                first: {
                    index: contentFirstIndex,
                    loc: sourceCode.getLocFromIndex(contentFirstIndex),
                },
                last: {
                    index: contentLastIndex,
                    loc: sourceCode.getLocFromIndex(contentLastIndex),
                },
            }
        }
function getCommentLocatuons(node) {
            const contentStartIndex = node.commentOpen.range[1]
            const contentEndIndex = node.commentClose.range[0]
            const contentText = sourceCode.text.slice(
                contentStartIndex,
                contentEndIndex
            )
            const contentFirstIndex = (() => {
                const index = contentText.search(/\S/u)
                if (index >= 0) {
                    return index + contentStartIndex
                }
                return contentEndIndex
            })()
            const contentLastIndex = (() => {
                const index = contentText.search(/\S\s*$/gu)
                if (index >= 0) {
                    return index + contentStartIndex + 1
                }
                return contentStartIndex
            })()

            return {
                first: {
                    index: contentFirstIndex,
                    loc: sourceCode.getLocFromIndex(contentFirstIndex),
                },
                last: {
                    index: contentLastIndex,
                    loc: sourceCode.getLocFromIndex(contentLastIndex),
                },
            }
        }
function getCommentLocatuons ( node ) { const contentStartIndex = node . commentOpen . range [ 1 ] const contentEndIndex = node . commentClose . range [ 0 ] const contentText = sourceCode . text . slice ( contentStartIndex , contentEndIndex ) const contentFirstIndex = ( ( ) => { const index = contentText . search ( / \S / u ) if ( index >= 0 ) { return index + contentStartIndex } return contentEndIndex } ) ( ) const contentLastIndex = ( ( ) => { const index = contentText . search ( / \S\s*$ / gu ) if ( index >= 0 ) { return index + contentStartIndex + 1 } return contentStartIndex } ) ( ) return { first : { index : contentFirstIndex , loc : sourceCode . getLocFromIndex ( contentFirstIndex ) , } , last : { index : contentLastIndex , loc : sourceCode . getLocFromIndex ( contentLastIndex ) , } , } }
Get the comments locations.
@param {ASTNode} node The HTML comment.
@returns {object} The comments locations.
Get the comments locations .