SCSS Formatting: mixin/function close parens
See original GitHub issueFor background: I’m the lead designer of Sass, and also the tech lead of the CSS/Sass infrastructure team at Google. I’m considering adopting Prettier as the official recommended formatter for Sass, and as the internal formatter we use for all of Google’s CSS and Sass. If we decide to move forward with Prettier, we’d be happy to contribute some improvements and bug fixes upstream. However, we’d like its formatting to match the formatting we’ve historically recommended for Sass as well as the formatting in use within Google (and the formatting of similar constructs in other languages).
The biggest blocker for this is the way long mixin and function argument lists are formatted, with the closing )
on its own line rather than on the same line as the final argument. If this could be fixed, we’d be mostly fine with the rest of the formatting.
Prettier 1.19.1 Playground link
--parser scss
Input:
@mixin name($that-takes-a-very-long: argument list, $so-long-it-will-need-to: wrap to a new line) {
// No content
}
@include name(with very long argument list, full of lots of things, that goes past the line length);
Output:
@mixin name(
$that-takes-a-very-long: argument list,
$so-long-it-will-need-to: wrap to a new line
) {
// No content
}
@include name(
with very long argument list,
full of lots of things,
that goes past the line length
);
I’d expect:
@mixin name(
$that-takes-a-very-long: argument list,
$so-long-it-will-need-to: wrap to a new line) {
// No content
}
@include name(
with very long argument list,
full of lots of things,
that goes past the line length);
Issue Analytics
- State:
- Created 4 years ago
- Reactions:39
- Comments:6 (2 by maintainers)
Where do you see the advantages in the formating as recommended by you, except that it fits your companys current practices?
For me the closing braket of the params on it’s own line improves readability compared to the solution sugested by you.
It’s like formatting function in JS (TS) this way
Looks awful honestly. Do you format functions like this in Google?