From 7817a93cae4d6fc0db8e68e17ef549c75963ec18 Mon Sep 17 00:00:00 2001 From: Emily M Klassen Date: Fri, 8 Nov 2024 14:02:16 -0800 Subject: [PATCH] Remove duplicated newLineNodes with manual separators --- src/utils/get-sorted-nodes.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/get-sorted-nodes.ts b/src/utils/get-sorted-nodes.ts index 1847f02..76ad7ce 100644 --- a/src/utils/get-sorted-nodes.ts +++ b/src/utils/get-sorted-nodes.ts @@ -54,8 +54,12 @@ export const getSortedNodes: GetSortedNodes = (nodes, options) => { for (const group of importOrder) { if (group === SEPARATOR_SPECIAL_WORD) { - if (!importOrderSeparation) + if ( + finalNodes.length !== 0 && + finalNodes[finalNodes.length - 1] !== newLineNode + ) { finalNodes.push(newLineNode); + } continue; }