From d6c6e22035c3459c7e5acae3ebf34e4dea41914c Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Thu, 10 Jul 2025 10:19:41 -0400 Subject: [PATCH] Short-circuit before parsing --- src/preprocessors/preprocessor.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/preprocessors/preprocessor.ts b/src/preprocessors/preprocessor.ts index 72e6d9c..3eed078 100644 --- a/src/preprocessors/preprocessor.ts +++ b/src/preprocessors/preprocessor.ts @@ -17,6 +17,11 @@ export function preprocessor(code: string, options: PrettierOptions): string { plugins, }; + // short-circuit if importOrder is an empty array (can be used to disable plugin) + if (!remainingOptions.importOrder.length) { + return code; + } + // Astro component scripts allow returning a response if (options.parentParser === 'astro') { parserOptions.allowReturnOutsideFunction = true; @@ -53,11 +58,6 @@ export function preprocessor(code: string, options: PrettierOptions): string { return code; } - // short-circuit if importOrder is an empty array (can be used to disable plugin) - if (!remainingOptions.importOrder.length) { - return code; - } - const nodesToOutput = getSortedNodes( allOriginalImportNodes, remainingOptions,