vuejs / vetur

Vue tooling for VS Code.
https://vuejs.github.io/vetur/
MIT License
5.75k stars 593 forks source link

Prettier-Stylelint Support #712

Open psg2 opened 6 years ago

psg2 commented 6 years ago

Would It be feasible to add support for prettier-stylelint like prettier-eslint?

I love working on VSCode using prettier-vscode and not so long ago they added support for prettier-stylint, but that only works for css and related files. So I would like to have the same facility when working on .vue files.

I could start working on it with some guidance if It is considered as a good addition to Vetur I already started reading through the source code to have some understanding of how it could be done.

octref commented 6 years ago

prettier-eslint is added to address the lack of space-before-function-paren in its config, which I consider a reasonable use-case.

What's a similar use-case for css? I don't want Vetur to become a hodgepodge of every formatter.

psg2 commented 6 years ago

For the projects that I use stylelint, the first fixable error that comes to my mind is using the order rule. But it certainly isn't a big issue as the space-before-function-paren from eslint. But I guess it's just about fixable errors that every linter/formatter can have.

Vetur certainly should not become a hodgepodge of every formatter. I thought about the support for prettier-stylelint because it seemed to me that wouldn't be so different from prettier-eslint as both format files with prettier, which Vetur already has support, and then apply the --fix from the respective linters.

But if it is not feasible or in the direction of the project, what if it was possible to allow users to use custom formatters from outside the Vetur project through configuration?

itwasmattgregg commented 6 years ago

I would also love this feature. Or someone to explain how to get it to work. I need Vetur to use prettier for js in vue files with my eslint configuration and prettier for postcss in vue files with a stylelint configuration. I have prettier.eslintIntegration and prettier.stylelintIntegration turned on in my settings but it doesn't appear to respect my stylelint settings. Surprised more people don't have this issue.

octref commented 6 years ago

You can follow this repo's guide to setup stylelint: https://github.com/chrisvfritz/vue-enterprise-boilerplate/blob/master/docs/editors.md

tigerclaw-az commented 6 years ago

@octref your link doesn't provide any information on how to get vetur to work with prettier-stylelint. The problem I have is that whenever I save my .vue file it automatically formats the SCSS under <style> with default formatting of prettier and not my stylelint configuration.

octref commented 6 years ago

@ejwaibel That's right, we don't have integration with prettier-stylelint yet. The error-checking are provided by the StyleLint extension.

patrickcate commented 6 years ago

I'd love to see prettier-stylelint support as well.

ghost commented 6 years ago

I would also love to see prettier-stylelint integration with vetur - i find (opinion) eslint & stylelint the 2 most common formatting tools for js & css languages amongst the different development teams i've worked with for trying to maintain some kind of code style uniformity.

multics commented 5 years ago

+1

Linting style files, like css, less, etc. is as important as linting js files. Please consider to support it.

nilsdjupvik commented 5 years ago

+1

Ishadimu commented 5 years ago

+1

vxow commented 5 years ago

+1

ux-engineer commented 5 years ago

+1

selfagency commented 4 years ago

can't believe that pull request has been sitting there for six months

multics commented 4 years ago

unbelievable

skylingfly commented 4 years ago

unbelievable

octref commented 4 years ago

I merged origin/master into #1567 and it's not working. It seems https://github.com/hugomrdias/prettier-stylelint is abondonded and https://github.com/prettier/stylelint-prettier is now active.

PR welcome as I'm focusing on other tasks.