Skip to content

Commit

Permalink
Consistently quote Sass modules strings
Browse files Browse the repository at this point in the history
Fixes #11053.
  • Loading branch information
niksy committed Sep 7, 2021
1 parent bf2a24f commit 212f339
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/language-css/parser-postcss.js
Expand Up @@ -525,7 +525,7 @@ function parseNestedCSS(node, options) {
return node;
}

if (lowercasedName === "import") {
if (["import", "use", "forward"].includes(lowercasedName)) {
node.import = true;
delete node.filename;
node.params = parseValue(params, options);
Expand Down
34 changes: 34 additions & 0 deletions tests/format/scss/quotes/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,34 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`quotes.scss - {"singleQuote":true} format 1`] = `
====================================options=====================================
parsers: ["scss"]
printWidth: 80
singleQuote: true
| printWidth
=====================================input======================================
@use "module";
@forward "module";
=====================================output=====================================
@use 'module';
@forward 'module';
================================================================================
`;

exports[`quotes.scss format 1`] = `
====================================options=====================================
parsers: ["scss"]
printWidth: 80
| printWidth
=====================================input======================================
@use "module";
@forward "module";
=====================================output=====================================
@use "module";
@forward "module";
================================================================================
`;
2 changes: 2 additions & 0 deletions tests/format/scss/quotes/jsfmt.spec.js
@@ -0,0 +1,2 @@
run_spec(__dirname, ["scss"]);
run_spec(__dirname, ["scss"], { singleQuote: true });
2 changes: 2 additions & 0 deletions tests/format/scss/quotes/quotes.scss
@@ -0,0 +1,2 @@
@use "module";
@forward "module";

0 comments on commit 212f339

Please sign in to comment.