diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index c6f362c58e..6946e35f6b 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -168,18 +168,15 @@ module.exports = { * @return {Number} Indent */ function getNodeIndent(node, byLastLine, excludeCommas) { - const finalLine = !!byLastLine; - const noCommas = !!excludeCommas; - let src = context.getSourceCode().getText(node, node.loc.start.column + extraColumnStart); const lines = src.split('\n'); - if (finalLine) { + if (byLastLine) { src = lines[lines.length - 1]; } else { src = lines[0]; } - const skip = noCommas ? ',' : ''; + const skip = excludeCommas ? ',' : ''; let regExp; if (indentType === 'space') {