diff --git a/lib/rules/jsx-wrap-multilines.js b/lib/rules/jsx-wrap-multilines.js index 374d0db5dc..2980a7652b 100644 --- a/lib/rules/jsx-wrap-multilines.js +++ b/lib/rules/jsx-wrap-multilines.js @@ -163,8 +163,8 @@ module.exports = { node, MISSING_PARENS, fixer => fixer.replaceTextRange( - [tokenBefore.range[0], tokenAfter ? tokenAfter.range[0] : node.range[1]], - `${trimTokenBeforeNewline(node, tokenBefore)}(\n${sourceCode.getText(node)}\n)` + [tokenBefore.range[0], tokenAfter && (tokenAfter.value === ';' || tokenAfter.value === '}') ? tokenAfter.range[0] : node.range[1]], + `${trimTokenBeforeNewline(node, tokenBefore)}(\n${' '.repeat(node.loc.start.column)}${sourceCode.getText(node)}\n${' '.repeat(node.loc.start.column - 2)})` ) ); } else { @@ -229,7 +229,7 @@ module.exports = { } }, - 'ArrowFunctionExpression:exit': function (node) { + 'ArrowFunctionExpression:exit': (node) => { const arrowBody = node.body; const type = 'arrow'; diff --git a/tests/lib/rules/jsx-wrap-multilines.js b/tests/lib/rules/jsx-wrap-multilines.js index 19b94228ff..cdf0718689 100644 --- a/tests/lib/rules/jsx-wrap-multilines.js +++ b/tests/lib/rules/jsx-wrap-multilines.js @@ -464,20 +464,20 @@ const LOGICAL_NO_PAREN_FRAGMENT = ` const LOGICAL_PAREN_NEW_LINE_AUTOFIX = `
Hello World
Hello World
> -)} + )}Hello
Hello
Hello
> -)}> + )}>Hello
Some text
+Some text
+Some text
+Some text
+