From 2428d4cda3946073b8721c8a334b2d8f55b104ee Mon Sep 17 00:00:00 2001 From: Akul Srivastava Date: Fri, 25 Aug 2023 21:34:51 +0530 Subject: [PATCH] chore: use string repeat --- lib/rules/jsx-no-leaked-render.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rules/jsx-no-leaked-render.js b/lib/rules/jsx-no-leaked-render.js index 32d537814b..05f319edbf 100644 --- a/lib/rules/jsx-no-leaked-render.js +++ b/lib/rules/jsx-no-leaked-render.js @@ -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})`); } }