From 58a89a68b1bdab246df700b077b569265dd1574a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 1 Sep 2024 14:40:40 +0200 Subject: [PATCH] [Fix] drop use of `RegExp`s --- src/rules/order.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rules/order.js b/src/rules/order.js index 222e6ba06..1cf5029f8 100644 --- a/src/rules/order.js +++ b/src/rules/order.js @@ -242,7 +242,7 @@ function fixOutOfOrder(context, firstNode, secondNode, order, named) { if (order === 'before') { const trimmed = secondCode.trimEnd(); - const gapCode = sourceCode.text.substring(firstRootEnd, secondRootStart).replace(/,$/, ''); + const gapCode = sourceCode.text.substring(firstRootEnd, secondRootStart - 1); const whiespaces = secondCode.substring(trimmed.length); context.report({ node: secondNode.node, @@ -253,7 +253,7 @@ function fixOutOfOrder(context, firstNode, secondNode, order, named) { }); } else if (order === 'after') { const trimmed = firstCode.trimEnd(); - const gapCode = sourceCode.text.substring(secondRootEnd, firstRootStart).replace(/^,/, ''); + const gapCode = sourceCode.text.substring(secondRootEnd + 1, firstRootStart); const whiespaces = firstCode.substring(trimmed.length); context.report({ node: secondNode.node,