Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consistently quote Sass modules strings (#11461)
* Consistently quote Sass modules strings Fixes #11053. * Add module rule name check function * Add more tests for `@use` and `@forward` * Lint changelog * Lint files Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
- Loading branch information
1 parent
ce1bb16
commit 1c4da1e
Showing
6 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#### Consistently quote Sass modules strings (#11461 by @niksy) | ||
|
||
<!-- prettier-ignore --> | ||
```scss | ||
// Input | ||
@use "sass:math"; | ||
@forward "list"; | ||
|
||
// Prettier stable | ||
@use "sass:math"; | ||
@forward "list"; | ||
|
||
// Prettier main | ||
@use 'sass:math'; | ||
@forward 'list'; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
tests/format/scss/quotes/__snapshots__/jsfmt.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`quotes.scss - {"singleQuote":true} format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["scss"] | ||
printWidth: 80 | ||
singleQuote: true | ||
| printWidth | ||
=====================================input====================================== | ||
@use "library"; | ||
@use "library" with ( | ||
$black: #222, | ||
$border-radius: 0.1rem | ||
$font-family: "Helvetica, sans-serif" | ||
); | ||
@use "library" as *; | ||
@use "library" as f; | ||
@use "sass:map"; | ||
@forward "library"; | ||
@forward "library" show border, $border-color; | ||
@forward "library" hide gradient; | ||
@forward "library" as btn-*; | ||
=====================================output===================================== | ||
@use 'library'; | ||
@use 'library' with | ||
($black: #222, $border-radius: 0.1rem $font-family: 'Helvetica, sans-serif'); | ||
@use 'library' as *; | ||
@use 'library' as f; | ||
@use 'sass:map'; | ||
@forward 'library'; | ||
@forward 'library' show border, $border-color; | ||
@forward 'library' hide gradient; | ||
@forward 'library' as btn- *; | ||
================================================================================ | ||
`; | ||
|
||
exports[`quotes.scss format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["scss"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
@use "library"; | ||
@use "library" with ( | ||
$black: #222, | ||
$border-radius: 0.1rem | ||
$font-family: "Helvetica, sans-serif" | ||
); | ||
@use "library" as *; | ||
@use "library" as f; | ||
@use "sass:map"; | ||
@forward "library"; | ||
@forward "library" show border, $border-color; | ||
@forward "library" hide gradient; | ||
@forward "library" as btn-*; | ||
=====================================output===================================== | ||
@use "library"; | ||
@use "library" with | ||
($black: #222, $border-radius: 0.1rem $font-family: "Helvetica, sans-serif"); | ||
@use "library" as *; | ||
@use "library" as f; | ||
@use "sass:map"; | ||
@forward "library"; | ||
@forward "library" show border, $border-color; | ||
@forward "library" hide gradient; | ||
@forward "library" as btn- *; | ||
================================================================================ | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
run_spec(__dirname, ["scss"]); | ||
run_spec(__dirname, ["scss"], { singleQuote: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@use "library"; | ||
|
||
@use "library" with ( | ||
$black: #222, | ||
$border-radius: 0.1rem | ||
$font-family: "Helvetica, sans-serif" | ||
); | ||
|
||
@use "library" as *; | ||
|
||
@use "library" as f; | ||
|
||
@use "sass:map"; | ||
|
||
@forward "library"; | ||
|
||
@forward "library" show border, $border-color; | ||
|
||
@forward "library" hide gradient; | ||
|
||
@forward "library" as btn-*; |