Skip to content

Commit 72c8af9

Browse files
committed
Short-circuit before parsing
1 parent 3497e9a commit 72c8af9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/preprocessors/preprocessor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export function preprocessor(code: string, options: PrettierOptions): string {
1717
plugins,
1818
};
1919

20+
// short-circuit if importOrder is an empty array (can be used to disable plugin)
21+
if (!remainingOptions.importOrder.length) {
22+
return code;
23+
}
24+
2025
// Astro component scripts allow returning a response
2126
if (options.parentParser === 'astro') {
2227
parserOptions.allowReturnOutsideFunction = true;
@@ -53,11 +58,6 @@ export function preprocessor(code: string, options: PrettierOptions): string {
5358
return code;
5459
}
5560

56-
// short-circuit if importOrder is an empty array (can be used to disable plugin)
57-
if (!remainingOptions.importOrder.length) {
58-
return code;
59-
}
60-
6161
const nodesToOutput = getSortedNodes(
6262
allOriginalImportNodes,
6363
remainingOptions,

0 commit comments

Comments
 (0)