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
🌐
npm
npmjs.com › package › stylelint-config-prettier-scss
stylelint-config-prettier-scss - npm
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
🌐
npm
npmjs.com › package › prettier-plugin-css-order
prettier-plugin-css-order - npm
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 › Siilwyn › prettier-plugin-css-order
GitHub - Siilwyn/prettier-plugin-css-order: Prettier plugin to sort CSS declarations in a certain order. · GitHub
A Prettier plugin to sort CSS, SCSS or Less declarations based on their property names.
Starred by 173 users
Forked by 15 users
Languages   JavaScript
🌐
GitHub
github.com › tailwindlabs › prettier-plugin-tailwindcss
GitHub - tailwindlabs/prettier-plugin-tailwindcss: A Prettier plugin for Tailwind CSS that automatically sorts classes based on our recommended class order. · GitHub
A Prettier v3+ plugin for Tailwind CSS v3.0+ that automatically sorts classes based on our recommended class order.
Starred by 7K users
Forked by 175 users
Languages   TypeScript 97.6% | JavaScript 2.4%
🌐
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!
🌐
npm
npmjs.com › package › @fredluetkemeier › prettier-plugin-css-order
@fredluetkemeier/prettier-plugin-css-order - npm
A Prettier plugin to sort CSS, SCSS or Less declarations based on their property names.
      » npm install @fredluetkemeier/prettier-plugin-css-order
    
Published   Apr 06, 2022
Version   1.2.2
Author   Fred Luetkemeier
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
🌐
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
🌐
Tailwind CSS
tailwindcss.com › blog › automatic-class-sorting-with-prettier
Automatic Class Sorting with Prettier - Tailwind CSS
People have been talking about the best way to sort your utility classes in Tailwind projects for at least four years. Today we're excited to announce that you can finally stop worrying about it with the release of our official Prettier plugin for Tailwind CSS.
🌐
GitHub
github.com › tujoworker › prettier-plugin-rational-order
GitHub - tujoworker/prettier-plugin-rational-order: Prettier Plugin for rational CSS styling order
Prettier Plugin for rational CSS styling order. Contribute to tujoworker/prettier-plugin-rational-order development by creating an account on GitHub.
Author   tujoworker
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
SCSS · styled-components 💅 · styled-jsx · HTML · Vue · Angular · Ember / Handlebars · Lightning Web Components (LWC) MJML · YAML · Markdown · CommonMark · GitHub-Flavored Markdown · MDX v1 · GraphQL · GraphQL Schemas · Community Plugins · Apex · Elm (via elm-format) Java · PHP · Ruby · Rust · TOML · XML · And more... prettier-js prettier.el Apheleia ·
🌐
GitHub
github.com › prettier › stylelint-prettier
GitHub - prettier/stylelint-prettier: Stylelint plugin for Prettier formatting · GitHub
Runs Prettier as a Stylelint rule and reports differences as individual Stylelint issues.
Starred by 380 users
Forked by 19 users
Languages   JavaScript
🌐
Prettier
prettier.io › docs › plugins
Plugins · Prettier
Thus, the two print functions – the one from the core and the one from the plugin – call each other while descending down the AST recursively. Here’s a simplified example to give an idea of what a typical implementation of print looks like: import * as prettier from "prettier"; const { group, indent, join, line, softline } = prettier.doc.builders; function print(path, options, print) { const node = path.node; switch (node.type) { case "list": return group([ "(", indent([softline, join(line, path.map(print, "elements"))]), softline, ")", ]); case "pair": return group([ "(", indent([softline, print("left"), line, ".
🌐
CodeSandbox
codesandbox.io › s › prettier-plugin-css-order-28gnui
prettier-plugin-css-order - CodeSandbox
November 29, 2024 - Sort CSS declarations in a certain order.
Published   Apr 20, 2023
🌐
DEV Community
dev.to › kachidk › common-prettier-plugins-installation-30hc
Common Prettier Plugins & Installation - DEV Community
February 29, 2024 - One limitation with this approach is that prettier-plugin-tailwindcss must be loaded last.