Skip to content

Prettier does not play well with vue/recommended #2920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
duckness opened this issue Nov 8, 2018 · 10 comments
Closed

Prettier does not play well with vue/recommended #2920

duckness opened this issue Nov 8, 2018 · 10 comments

Comments

@duckness
Copy link

duckness commented Nov 8, 2018

Version

3.1.1

Reproduction link

https://github.com/duckness/linttest

Node and OS info

Node 10.11.0 / yarn 1.12.1 / Windows 10

Steps to reproduce

  1. vue create a new app and select the Eslint + Prettier option
  2. Change plugin:vue/essential to either plugin:vue/recommended or plugin:vue/strongly-recommended in your ESLint config
  3. run yarn lint

What is expected?

All lint errors auto-fixed with no error message.

What is actually happening?

Lint errors cannot be fixed and it will throw an error every time.

@LinusBorg
Copy link
Member

@duckness
Copy link
Author

duckness commented Nov 9, 2018

Nope that didn't work. Prettier recently had an update https://prettier.io/blog/2018/11/07/1.15.0.html to format html in vue files, this might be the cause.

@duckness
Copy link
Author

duckness commented Nov 9, 2018

prettier issue: prettier/prettier#5363

@andylima
Copy link

andylima commented Nov 13, 2018

The way that issue is being handled by Prettier devs (and other issues related to Vue support) is very telling — Prettier is not interested in supporting any Vue / React / Angular Style Guides that go against its style.

…And its style, as you know, tends to be non-configurable.

Vue ESLint rules are much more useful for us Vue devs than whatever "special" formatting the Prettier people may think is best for us.

…That's why I stopped using Prettier, and suggest you do the same.

For this reason, I suggest that Vue CLI stops using / suggesting eslint-config-prettier by default. Prettier is NOT the best for Vue devs.

@duckness
Copy link
Author

duckness commented Nov 14, 2018

I agree, I have dropped prettier in my project for now

@haoqunjiang
Copy link
Member

Seems to have been fixed by #2932

@visualjerk
Copy link

If someone runs into this issue, try reinstalling @vue/eslint-config-prettier.

yarn remove @vue/eslint-config-prettier
yarn add @vue/eslint-config-prettier --dev

@bys1123
Copy link

bys1123 commented Mar 15, 2020

Wow, this fixed my problem.

@hvitis
Copy link

hvitis commented May 1, 2020

Update prettier workspace settings and delete or overwrite your main settings.json that can keep breaking your local linting

@AchlysLove
Copy link

HI, if you are going to use webstorm with the same setup. Go to the Preference/Language & Framework/JavaScript/Prettier section, for "Run for files" input, use "{**/,}.{js,ts,jsx,tsx,vue}"(+ vue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants