lib/rules/no-irregular-whitespace.js
function checkForIrregularWhitespace(node, ignoreTokens) {
            const text = sourceCode.text.slice(node.range[0], node.range[1])
            let match = undefined

            /**
             * Check whether the index is in ignore location.
             * @param {number} index The index.
             * @returns {boolean} `true` if the index is in ignore location.
             */
            function isIgnoreLocation(index) {
                return (
                    ignoreTokens.find(
                        t => t.range[0] <= index && index < t.range[1]
                    ) ||
                    templateTokens.find(
                        t => t.range[0] <= index && index < t.range[1]
                    )
                )
            }

            while ((match = IRREGULAR_WHITESPACE.exec(text)) !== null) {
                const index = node.range[0] + match.index

                if (isIgnoreLocation(index)) {
                    continue
                }

                const code = `0000${sourceCode.text[index]
                    .charCodeAt(0)
                    .toString(16)}`
                    .slice(-4)
                    .toUpperCase()
                context.report({
                    loc: sourceCode.getLocFromIndex(index),
                    messageId: "unexpected",
                    data: { code },
                    fix: defineWhitespaceFix(index),
                })
            }

            while ((match = IRREGULAR_LINE_TERMINATORS.exec(text)) !== null) {
                const index = node.range[0] + match.index

                if (isIgnoreLocation(index)) {
                    continue
                }

                const code = `0000${sourceCode.text[index]
                    .charCodeAt(0)
                    .toString(16)}`
                    .slice(-4)
                    .toUpperCase()
                context.report({
                    loc: sourceCode.getLocFromIndex(index),
                    messageId: "unexpected",
                    data: { code },
                    fix: defineLineTerminatorsFix(index),
                })
            }
        }
function checkForIrregularWhitespace(node, ignoreTokens) {
            const text = sourceCode.text.slice(node.range[0], node.range[1])
            let match = undefined

            /**
             * Check whether the index is in ignore location.
             * @param {number} index The index.
             * @returns {boolean} `true` if the index is in ignore location.
             */
            function isIgnoreLocation(index) {
                return (
                    ignoreTokens.find(
                        t => t.range[0] <= index && index < t.range[1]
                    ) ||
                    templateTokens.find(
                        t => t.range[0] <= index && index < t.range[1]
                    )
                )
            }

            while ((match = IRREGULAR_WHITESPACE.exec(text)) !== null) {
                const index = node.range[0] + match.index

                if (isIgnoreLocation(index)) {
                    continue
                }

                const code = `0000${sourceCode.text[index]
                    .charCodeAt(0)
                    .toString(16)}`
                    .slice(-4)
                    .toUpperCase()
                context.report({
                    loc: sourceCode.getLocFromIndex(index),
                    messageId: "unexpected",
                    data: { code },
                    fix: defineWhitespaceFix(index),
                })
            }

            while ((match = IRREGULAR_LINE_TERMINATORS.exec(text)) !== null) {
                const index = node.range[0] + match.index

                if (isIgnoreLocation(index)) {
                    continue
                }

                const code = `0000${sourceCode.text[index]
                    .charCodeAt(0)
                    .toString(16)}`
                    .slice(-4)
                    .toUpperCase()
                context.report({
                    loc: sourceCode.getLocFromIndex(index),
                    messageId: "unexpected",
                    data: { code },
                    fix: defineLineTerminatorsFix(index),
                })
            }
        }
function checkForIrregularWhitespace ( node , ignoreTokens ) { const text = sourceCode . text . slice ( node . range [ 0 ] , node . range [ 1 ] ) let match = undefined /**
             * Check whether the index is in ignore location.
             * @param {number} index The index.
             * @returns {boolean} `true` if the index is in ignore location.
             */ function isIgnoreLocation ( index ) { return ( ignoreTokens . find ( t => t . range [ 0 ] <= index && index < t . range [ 1 ] ) || templateTokens . find ( t => t . range [ 0 ] <= index && index < t . range [ 1 ] ) ) } while ( ( match = IRREGULAR_WHITESPACE . exec ( text ) ) !== null ) { const index = node . range [ 0 ] + match . index if ( isIgnoreLocation ( index ) ) { continue } const code = ` ${ sourceCode . text [ index ] . charCodeAt ( 0 ) . toString ( 16 ) } ` . slice ( - 4 ) . toUpperCase ( ) context . report ( { loc : sourceCode . getLocFromIndex ( index ) , messageId : "unexpected" , data : { code } , fix : defineWhitespaceFix ( index ) , } ) } while ( ( match = IRREGULAR_LINE_TERMINATORS . exec ( text ) ) !== null ) { const index = node . range [ 0 ] + match . index if ( isIgnoreLocation ( index ) ) { continue } const code = ` ${ sourceCode . text [ index ] . charCodeAt ( 0 ) . toString ( 16 ) } ` . slice ( - 4 ) . toUpperCase ( ) context . report ( { loc : sourceCode . getLocFromIndex ( index ) , messageId : "unexpected" , data : { code } , fix : defineLineTerminatorsFix ( index ) , } ) } }
Checks the source for irregular whitespace
@param {ASTNode} node The tag node
@param {Token[]} ignoreTokens The ignore location tokens
@returns {void}
Checks the source for irregular whitespace