lib/rules/html-content-newline.js
function getContentLocatuons(node) {
            const contentStartIndex = node.startTag.range[1]
            const contentEndIndex = node.endTag.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 getContentLocatuons(node) {
            const contentStartIndex = node.startTag.range[1]
            const contentEndIndex = node.endTag.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 getContentLocatuons ( node ) { const contentStartIndex = node . startTag . range [ 1 ] const contentEndIndex = node . endTag . 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 contents locations.
@param {ASTNode} node The element node.
@returns {object} The contents locations.
Get the contents locations .