Skip to content

Commit 33b5621

Browse files
committed
[Fix] drop use of RegExps
1 parent 2d49fce commit 33b5621

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rules/order.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function fixOutOfOrder(context, firstNode, secondNode, order, named) {
242242

243243
if (order === 'before') {
244244
const trimmed = secondCode.trimEnd();
245-
const gapCode = sourceCode.text.substring(firstRootEnd, secondRootStart).replace(/,$/, '');
245+
const gapCode = sourceCode.text.substring(firstRootEnd, secondRootStart - 1);
246246
const whiespaces = secondCode.substring(trimmed.length);
247247
context.report({
248248
node: secondNode.node,
@@ -253,7 +253,7 @@ function fixOutOfOrder(context, firstNode, secondNode, order, named) {
253253
});
254254
} else if (order === 'after') {
255255
const trimmed = firstCode.trimEnd();
256-
const gapCode = sourceCode.text.substring(secondRootEnd, firstRootStart).replace(/^,/, '');
256+
const gapCode = sourceCode.text.substring(secondRootEnd + 1, firstRootStart);
257257
const whiespaces = firstCode.substring(trimmed.length);
258258
context.report({
259259
node: secondNode.node,

0 commit comments

Comments
 (0)