Skip to content

Commit 075864c

Browse files
dtinthyannickcr
authored andcommitted
Fix line-aligned jsx-closing-bracket-location fixer (jsx-eslint#561)
Fix line-aligned jsx-closing-bracket-location fixer (fixes jsx-eslint#533)
1 parent 6c46f57 commit 075864c

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

lib/rules/jsx-closing-bracket-location.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,7 @@ module.exports = function(context) {
202202
return fixer.replaceTextRange([cachedLastAttributeEndPos, node.end],
203203
'\n' + tagSpaces.join(' ') + closingTag);
204204
case 'line-aligned':
205-
var walkNode = node;
206-
var lineSpaces = 0;
207-
while ((walkNode = walkNode.parent)) {
208-
if (walkNode.type === 'VariableDeclaration' ||
209-
walkNode.type === 'ReturnStatement' ||
210-
walkNode.type === 'ExpressionStatement') {
211-
lineSpaces = walkNode.loc.start.column + 1;
212-
break;
213-
}
214-
}
215-
lineSpaces = new Array(lineSpaces);
205+
var lineSpaces = new Array(+correctColumn + 1);
216206
return fixer.replaceTextRange([cachedLastAttributeEndPos, node.end],
217207
'\n' + lineSpaces.join(' ') + closingTag);
218208
default:

0 commit comments

Comments
 (0)