Skip to content

Commit 308ec78

Browse files
committed
Optimized canReorderItems
1 parent 430290e commit 308ec78

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/rules/order-imports.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ function canReorderItems(firstNode: NodeOrToken, secondNode: NodeOrToken): boole
192192
const parent = firstNode.parent;
193193
const firstIndex = parent.body.indexOf(firstNode);
194194
const secondIndex = parent.body.indexOf(secondNode, firstIndex);
195-
if (firstIndex === -1 || secondIndex === -1) return false;
195+
if (firstIndex === -1 || secondIndex === -1) {
196+
return false;
197+
}
198+
196199
for (let i = firstIndex; i <= secondIndex; i++) {
197200
if (!canCrossNodeWhileReorder(parent.body[i])) {
198201
return false;

0 commit comments

Comments
 (0)