Solution:

In order to allow single-line blocks in VSCode using Prettier - Code formatter extension, please take the following steps:

  1. Enable stylelint integration by adding this in the VSCode Settings (JSON): "prettier.stylelintIntegration": true
  2. Install stylelint and stylelint-prettier npm modules in your project directory. npm install stylelint stylelint-prettier --save-dev
  3. Add a .stylelintrc.json file at the root of your project directory with the following code:
    {
        "plugins": ["stylelint-prettier"],
        "rules": {
            "block-closing-brace-newline-after": "always-multi-line",
            "block-closing-brace-empty-line-before": "never",
            "block-closing-brace-space-before": "always",
            "block-opening-brace-space-after": "always",
            "block-opening-brace-space-before": "always",
            "block-closing-brace-newline-before": "always-multi-line",
            "block-opening-brace-newline-after": "always-multi-line",
            "indentation": 4
        }
    }

You can add/customize more stylelint rules, see the entire list of rules here.

Took me a while to understand how to configure these options, if you're starting out with stylelint, I highly recommend you read its guidelines first.

Answer from Arslan Akram on Stack Overflow
🌐
GitHub
github.com › prettier › stylelint-config-prettier-scss
GitHub - prettier/stylelint-config-prettier-scss: Turns off all CSS and SCSS rules that are unnecessary or might conflict with prettier.
Turns off all CSS and SCSS rules that are unnecessary or might conflict with Prettier (extends stylelint-config-prettier).
Starred by 25 users
Forked by 3 users
Languages   JavaScript 98.1% | SCSS 1.9% | JavaScript 98.1% | SCSS 1.9%
Discussions

Prettier not formatting css
Is your file a .css with just working (not broken) css in it? More on reddit.com
🌐 r/vscode
11
0
September 24, 2024
Error: Extension 'Prettier - Code formatter' cannot format 'src\sass\styles.scss'
Hi folks, I'm using VSCode and prettier since a few weeks ago. I'm trying to format my SCSS file but I don't seem to achieve it. These are the details of my issue: Prettier 4.5.0 over V... More on github.com
🌐 github.com
4
May 4, 2020
format - Prettier doesn't work for CSS - Stack Overflow
If you download and check my example, you will see that the Prettier is not working for the CSS files. ... javascript · flow · typescript · css · scss · less · jsx · vue · graphql · json · markdown · More on stackoverflow.com
🌐 stackoverflow.com
Is using Prettier to format code bad.
It sounds to me though that you formatted some huge file that wasn't previously formatted with prettier (vs your own changes) And that is annoying af. Just incredibly noisy if it's a bug fix. Propose your refactor but do it outside of a bug fix. More on reddit.com
🌐 r/Frontend
120
99
May 23, 2023
🌐
Prettier
prettier.io › blog › 2017 › 06 › 03 › 1.4.0
Prettier 1.4: TypeScript and CSS support · Prettier
June 3, 2017 - This release introduces support for TypeScript, CSS, Less, and SCSS languages to Prettier!
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
Try It OnlineInstall Prettier · Limited edition tshirts are now available to buy! $10 per tshirt goes to maintain the project. An opinionated code formatter · Supports many languages · Integrates with most editors · Has few options » · Your code is formatted on save · No need to discuss style in code review · Saves you time and energy · And more » · JavaScript · JSX · Flow · TypeScript · JSON · CSS · Less · SCSS ·
🌐
npm
npmjs.com › package › stylelint-config-prettier-scss
stylelint-config-prettier-scss - npm
May 11, 2023 - Turns off all CSS and SCSS rules that are unnecessary or might conflict with Prettier (extends stylelint-config-prettier).
      » npm install stylelint-config-prettier-scss
    
Published   May 11, 2023
Version   1.0.0
Author   Shannon Moeller
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 117
Prettier doesn't format *.css and *.scss files. · Issue #117 · prettier/prettier-vscode
Here are my settings: "prettier.eslintIntegration": true, "prettier.singleQuote": true, "prettier.printWidth": 80, "prettier.trailingComma": "all", "prettier.cssEnable": [ "css", "less", "sass" ], But there is no "Format document" option...
Author   ghost
🌐
Reddit
reddit.com › r/vscode › prettier not formatting css
r/vscode on Reddit: Prettier not formatting css
September 24, 2024 -

Hey everyone, for the life of me I can't figure out why prettier won't format css. I have gone over all of my setting, format on save, setting prettier as the default format, and checked the setting.json file. Still can't figure out what is going on. Any help would be appreciated!

Find elsewhere
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
SCSS Formatter - Visual Studio Marketplace
Extension for Visual Studio Code - A Visual Studio Code Extension to format SCSS
🌐
npm
npmjs.com › package › prettier-plugin-css-order
prettier-plugin-css-order - npm
April 1, 2024 - A Prettier plugin to sort CSS, SCSS or Less declarations based on their property names.
      » npm install prettier-plugin-css-order
    
Published   Jan 02, 2026
Version   2.2.0
Author   Selwyn
🌐
GitHub
github.com › prettier › stylelint-config-prettier-scss › blob › main › RELEASE.md
stylelint-config-prettier-scss/RELEASE.md at main · prettier/stylelint-config-prettier-scss
Turns off all CSS and SCSS rules that are unnecessary or might conflict with prettier. - prettier/stylelint-config-prettier-scss
Author   prettier
🌐
Reddit
reddit.com › r/frontend › is using prettier to format code bad.
r/Frontend on Reddit: Is using Prettier to format code bad.
May 23, 2023 -

Recently joined a agency as an Contract React developer. I was assigned a task to edit some inline Scss code.

Being a Prettier user I formatted the code, made the necessary changes and submitted a pull request.

Next day the senior developer reviewed my code and asked me to stop using Prettier and assigned me a task to change back the Scss code manually to inline Scss.

When I asked why should I not use prettier to format code. He said it's bad and time consuming and other team members started telling me a story how one time prettier wasn't working and started throwing errors.

That's why they never use it.

I wanted to say that It was showing error because you were doing something wrong.

Just because you once had an bad experience doesn't mean it's bad.

Plus they use one big single Scss file for the whole project.

When I question it too and asked them to use separate files and how it can effect the performance.

One team member answered it doesn't matter, how they don't care about the performance and I should be open minded and learn from them. The boss has 18 years of experience.

What should I learn why not to follow good practices!

🌐
Prettier
prettier.io › blog › 2018 › 02 › 26 › 1.11.0.html
Prettier 1.11: CSS fixes and new TypeScript feature support · Prettier
February 26, 2018 - Prettier was printing the !default directive in an odd way: $theme-checkbox-colors: ( default: $theme-color-border, checked: $theme-color-checked, disabled: $theme-color-disabled, disabled-font: $theme-color-font-secondary ) !default; ... $theme-checkbox-colors: ( default: $theme-color-border, checked: $theme-color-checked, disabled: $theme-color-disabled, disabled-font: $theme-color-font-secondary ) !default; SCSS has a feature that lets you output some text at build-time using @warn or @error:
🌐
JetBrains
jetbrains.com › help › webstorm › prettier.html
Prettier | WebStorm Documentation
Prettier is a tool to format files in various languages, like TypeScript, JavaScript, CSS, HTML, JSON, and others. With WebStorm, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier action.
🌐
CSS-Tricks
css-tricks.com › prettier-stylelint-writing-clean-css-keeping-clean-code-two-tool-game
Prettier + Stylelint: Writing Very Clean CSS (Or, Keeping Clean Code is a Two-Tool Game) | CSS-Tricks
October 17, 2017 - Stylelint is exactly that. In fact, in that GIF above show Prettier do it’s thing, you saw some red dots and red outlines in my Sublime Text editor. That wasn’t Prettier showing me what it was going to fix (Prettier displays no errors, it just fixes what it can).
🌐
GitHub
github.com › prettier › prettier › issues › 3012
CSS/SCSS indenting · Issue #3012 · prettier/prettier
September 3, 2017 - Would you be open to accepting a patch to indent CSS/SCSS blocks based on the previous selector? I think the formatting rule could be that if the previous selector is a prefix of the current selector then we consider that to be nesting and the block is nested a level. Any name that doesn't match would be formatted as Prettier currently does it (pushed left-most).
Author   holloway