Skip to content

Commit

Permalink
[Fix] drop use of RegExps
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed Sep 1, 2024
1 parent 4bae4f9 commit 58a89a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rules/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 58a89a6

Please sign in to comment.