lib/rules/indent-legacy.js
function getNodeIndent(node, byLastLine) {
            const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node);
            const srcCharsBeforeNode = sourceCode.getText(token, token.loc.start.column).split("");
            const indentChars = srcCharsBeforeNode.slice(0, srcCharsBeforeNode.findIndex(char => char !== " " && char !== "\t"));
            const spaces = indentChars.filter(char => char === " ").length;
            const tabs = indentChars.filter(char => char === "\t").length;

            return {
                space: spaces,
                tab: tabs,
                goodChar: indentType === "space" ? spaces : tabs,
                badChar: indentType === "space" ? tabs : spaces
            };
        }
function getNodeIndent(node, byLastLine) {
            const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node);
            const srcCharsBeforeNode = sourceCode.getText(token, token.loc.start.column).split("");
            const indentChars = srcCharsBeforeNode.slice(0, srcCharsBeforeNode.findIndex(char => char !== " " && char !== "\t"));
            const spaces = indentChars.filter(char => char === " ").length;
            const tabs = indentChars.filter(char => char === "\t").length;

            return {
                space: spaces,
                tab: tabs,
                goodChar: indentType === "space" ? spaces : tabs,
                badChar: indentType === "space" ? tabs : spaces
            };
        }
function getNodeIndent ( node , byLastLine ) { const token = byLastLine ? sourceCode . getLastToken ( node ) : sourceCode . getFirstToken ( node ) ; const srcCharsBeforeNode = sourceCode . getText ( token , token . loc . start . column ) . split ( "" ) ; const indentChars = srcCharsBeforeNode . slice ( 0 , srcCharsBeforeNode . findIndex ( char => char !== " " && char !== "\t" ) ) ; const spaces = indentChars . filter ( char => char === " " ) . length ; const tabs = indentChars . filter ( char => char === "\t" ) . length ; return { space : spaces , tab : tabs , goodChar : indentType === "space" ? spaces : tabs , badChar : indentType === "space" ? tabs : spaces } ; }
Get the actual indent of node
@param {ASTNode|Token} node Node to examine
@param {boolean} [byLastLine=false] get indent of node's last line
@returns {Object} The node's indent. Contains keys `space` and `tab`, representing the indent of each character. Also
contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and
`badChar` is the amount of the other indentation character.
Get the actual indent of node