stylelint / vscode-stylelint

The official Visual Studio Code extension for Stylelint
https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint
MIT License
319 stars 31 forks source link

[Feature]: Enable support for stylelint as SCSS formatter #384

Open wedi opened 2 years ago

wedi commented 2 years ago

What problem does this feature solve?

It would be cool, if the stylelint extension could be enabled as formatter for SCSS files just like it's possible to enable it for validation.

I gave it a shot but I wasn't very surprised it didn't work.

{
  "[scss]": {
    "editor.defaultFormatter": "stylelint.vscode-stylelint"
  }
}

grafik

To enable validating SCSS files, you need to tweak a setting like so

{
"stylelint.validate": ["css", "scss"]
}

It would be amazing if you could add a similar option for formatting to enable SCSS.

I looked into your pull request #200 @adalinesimonian but I have no experience with coding VSCode extensions at all and it's hard to tell where to start with this.

How does this feature solve the problem?

It allows to use stylelint for SCSS (and possibly more postcss files).

What are some alternatives to this feature?

No response

Code of Conduct

ccornici commented 2 years ago

Came here as I was baffled that a linter isn't integrated with the actual formatting command lol. Glad I'm not the only one.

wdzeng commented 10 months ago

Not only SCSS, but also cannot format CSS files.

Amazing ... A VSCode formatter extension that cannot format any file ...

RickyMarou commented 6 months ago

You can enable format on save by adding this to your config:

"editor.codeActionsOnSave": {
    "source.fixAll.stylelint": "explicit"
  }

It's in the README of the project. I agree it's a bit strange to configure it this way compared to other formatters, but heh it works 🤷