vscode-stylelint icon indicating copy to clipboard operation
vscode-stylelint copied to clipboard

[Feature]: Enable support for stylelint as SCSS formatter

Open wedi opened this issue 2 years ago • 3 comments

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

  • [X] I agree to follow vscode-stylelint's Code of Conduct

wedi avatar Mar 05 '22 00:03 wedi

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.

ccornici avatar Jul 20 '22 09:07 ccornici

Not only SCSS, but also cannot format CSS files.

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

wdzeng avatar Jan 06 '24 18:01 wdzeng

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 🤷

RickyMarou avatar Apr 26 '24 06:04 RickyMarou