Skip to content

Commit

Permalink
chore: use string repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
akulsr0 committed Aug 25, 2023
1 parent 358e933 commit 2428d4c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rules/jsx-no-leaked-render.js
Expand Up @@ -86,8 +86,8 @@ function ruleFixer(context, fixStrategy, fixer, reportedNode, leftNode, rightNod
const rightSideTextLines = rightSideText.split('\n');
if (rightSideTextLines.length > 1) {
const rightSideTextLastLine = rightSideTextLines[rightSideTextLines.length - 1];
const indentSpacesStart = Array(rightSideTextLastLine.search(/\S/)).fill(' ').join('');
const indentSpacesClose = Array(rightSideTextLastLine.search(/\S/) - 2).fill(' ').join('');
const indentSpacesStart = ' '.repeat(rightSideTextLastLine.search(/\S/));
const indentSpacesClose = ' '.repeat(rightSideTextLastLine.search(/\S/) - 2);
return fixer.replaceText(reportedNode, `${newText} && (\n${indentSpacesStart}${rightSideText}\n${indentSpacesClose})`);
}
}
Expand Down

0 comments on commit 2428d4c

Please sign in to comment.