From 6ca2e51c85b61883147d2f00de681d4224ff1b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Nikoli=C4=87?= Date: Fri, 10 Sep 2021 08:52:37 +0200 Subject: [PATCH] Fix wildcard syntax in `@forward` (#11482) --- src/language-css/printer-postcss.js | 11 +++++++++++ .../scss/quotes/__snapshots__/jsfmt.spec.js.snap | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js index c7ebe7e561f4..f1aa6ba425fb 100644 --- a/src/language-css/printer-postcss.js +++ b/src/language-css/printer-postcss.js @@ -550,6 +550,17 @@ function genericPrint(path, options, print) { continue; } + // Ignore SCSS @forward prefix + if ( + insideAtRuleNode(path, "forward") && + iNode.type === "value-word" && + iNode.value.endsWith("-") && + iNextNode.type === "value-operator" && + iNextNode.value === "*" + ) { + continue; + } + // Ignore after latest node (i.e. before semicolon) if (!iNextNode) { continue; diff --git a/tests/format/scss/quotes/__snapshots__/jsfmt.spec.js.snap b/tests/format/scss/quotes/__snapshots__/jsfmt.spec.js.snap index 042fdbb3bf79..4d368ad98852 100644 --- a/tests/format/scss/quotes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/scss/quotes/__snapshots__/jsfmt.spec.js.snap @@ -47,7 +47,7 @@ singleQuote: true @forward 'library' hide gradient; -@forward 'library' as btn- *; +@forward 'library' as btn-*; ================================================================================ `; @@ -98,7 +98,7 @@ printWidth: 80 @forward "library" hide gradient; -@forward "library" as btn- *; +@forward "library" as btn-*; ================================================================================ `;