lib/rules/no-irregular-whitespace.js
function checkForIrregularLineTerminators(node) {
            const source = sourceCode.getText(),
                sourceLines = sourceCode.lines,
                linebreaks = source.match(LINE_BREAK);
            let lastLineIndex = -1,
                match;

            while ((match = IRREGULAR_LINE_TERMINATORS.exec(source)) !== null) {
                const lineIndex = linebreaks.indexOf(match[0], lastLineIndex + 1) || 0;
                const location = {
                    line: lineIndex + 1,
                    column: sourceLines[lineIndex].length
                };

                errors.push({ node, message: "Irregular whitespace not allowed.", loc: location });
                lastLineIndex = lineIndex;
            }
        }
function checkForIrregularLineTerminators(node) {
            const source = sourceCode.getText(),
                sourceLines = sourceCode.lines,
                linebreaks = source.match(LINE_BREAK);
            let lastLineIndex = -1,
                match;

            while ((match = IRREGULAR_LINE_TERMINATORS.exec(source)) !== null) {
                const lineIndex = linebreaks.indexOf(match[0], lastLineIndex + 1) || 0;
                const location = {
                    line: lineIndex + 1,
                    column: sourceLines[lineIndex].length
                };

                errors.push({ node, message: "Irregular whitespace not allowed.", loc: location });
                lastLineIndex = lineIndex;
            }
        }
function checkForIrregularLineTerminators ( node ) { const source = sourceCode . getText ( ) , sourceLines = sourceCode . lines , linebreaks = source . match ( LINE_BREAK ) ; let lastLineIndex = - 1 , match ; while ( ( match = IRREGULAR_LINE_TERMINATORS . exec ( source ) ) !== null ) { const lineIndex = linebreaks . indexOf ( match [ 0 ] , lastLineIndex + 1 ) || 0 ; const location = { line : lineIndex + 1 , column : sourceLines [ lineIndex ] . length } ; errors . push ( { node , message : "Irregular whitespace not allowed." , loc : location } ) ; lastLineIndex = lineIndex ; } }
Checks the program source for irregular line terminators
@param {ASTNode} node The program node
@returns {void}
@private
Checks the program source for irregular line terminators