From 4db7f595495d83efc8b2f46cd6078a3dab310685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Risoud?= Date: Thu, 17 Mar 2022 12:42:50 +0100 Subject: [PATCH] fix(framework): handle interpolation with single quotes override (#339) --- src/printer.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/printer.ts b/src/printer.ts index edfa189e..77e8f789 100644 --- a/src/printer.ts +++ b/src/printer.ts @@ -450,7 +450,12 @@ export class PugPrinter { } private frameworkFormat(code: string): string { - const options: Options = { ...this.codeInterpolationOptions }; + const options: Options = { + ...this.codeInterpolationOptions, + // we need to keep the original singleQuote option + // see https://github.com/prettier/plugin-pug/issues/339 + singleQuote: this.options.singleQuote, + }; switch (this.framework) { case 'angular': options.parser = '__ng_interpolation'; @@ -461,7 +466,6 @@ export class PugPrinter { options.parser = 'babel'; options.semi = false; } - let result: string = format(code, options); if (result[0] === ';') { result = result.slice(1);