Skip to content

@vue/eslint-config-prettier fails since 4.0.0 #2960

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
houd1ni opened this issue Nov 15, 2018 · 7 comments
Closed

@vue/eslint-config-prettier fails since 4.0.0 #2960

houd1ni opened this issue Nov 15, 2018 · 7 comments

Comments

@houd1ni
Copy link

houd1ni commented Nov 15, 2018

Version

3.1.1

Node and OS info

latest node, latest win10 and MacOS High Sierra.

Steps to reproduce

Create a project with vue-cli and @vue/[email protected] or 4.0.1.
Add vue/max-attributes-per-line rule.

The prettier makes carriage return without tabulation, then linter fails very often with the same error:

error: Attribute "icon" should be on a new line (vue/max-attributes-per-line) at src\views\View.vue:33:24:
  31 |         <template slot-scope="{ row }">
  32 |           <router-link :to="{ name: 'name', params: { param: value } }">
> 33 |             <el-button icon="el-icon"
     |                        ^
  34 | size="small" />
  35 |           </router-link>
  36 |         </template>

What is expected?

prettier makes my code pretty.

What is actually happening?

prettier makes my code ugly.


Since 4.0.0. We've checked all other deps.

@LinusBorg
Copy link
Member

I assume that should be solved by #2932

@houd1ni
Copy link
Author

houd1ni commented Nov 15, 2018

@LinusBorg Thanx! I'll wait for the merge and test again, then close the issue if OK.

@houd1ni
Copy link
Author

houd1ni commented Nov 15, 2018

@LinusBorg I see this is actually merged. How can I install this package from github?

@houd1ni
Copy link
Author

houd1ni commented Nov 15, 2018

After hard replacing in node_modules and npm i there, all works as expected!

When the new version will be published?

@haoqunjiang
Copy link
Member

  1. The PR has already been shipped in @vue/eslint-config-prettier v4.0.1, so you might need to clean your cache.
  2. Prettier is incompatible with the rule vue/max-attributes-per-line
    That's why it's disabled in eslint-config-prettier/vue

@houd1ni
Copy link
Author

houd1ni commented Nov 15, 2018

@sodatea
Cache doesn't fix the issue.
So, to fix it, should we disable the rule?
Are there any thoughts about warning if using the rule, if it is the cause?

@haoqunjiang
Copy link
Member

The prettier config is quite different from other configs, that is, it is used to disable certain rules rather than enabling rules.
So it might be a better practice to always put it at the end of the extends array to ensure the rule override has taken effect. For your own custom rules, put them into a separate config file and prepend the path to extends in .eslintrc.js.

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

No branches or pull requests

3 participants