vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.75k stars 6.33k forks source link

multiple params in slot-scope occurs parsing errors (vue TS ant-design-vue) #5259

Open wendyzhaogogo opened 4 years ago

wendyzhaogogo commented 4 years ago

Version

4.2.3

Reproduction link

Environment info

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 11.7.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.13.0 - C:\Users\wendy\AppData\Roaming\npm\yarn.CMD
    npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 41.16299.611.0
  npmPackages:
    @ant-design/icons-vue:  2.0.0
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.1.2
    @vue/babel-preset-app:  4.1.2
    @vue/babel-preset-jsx:  1.1.2
    @vue/babel-sugar-functional-vue:  1.1.2
    @vue/babel-sugar-inject-h:  1.1.2
    @vue/babel-sugar-v-model:  1.1.2
    @vue/babel-sugar-v-on:  1.1.2
    @vue/cli-overlay:  4.1.2
    @vue/cli-plugin-babel: ^4.1.0 => 4.1.2
    @vue/cli-plugin-eslint: ^4.1.0 => 4.1.2
    @vue/cli-plugin-router:  4.1.2
    @vue/cli-plugin-typescript: ^4.1.0 => 4.1.2
    @vue/cli-plugin-vuex:  4.1.2
    @vue/cli-service: ^4.1.0 => 4.1.2
    @vue/cli-shared-utils:  4.1.2
    @vue/component-compiler-utils:  3.1.1
    @vue/eslint-config-prettier: ^5.0.0 => 5.1.0
    @vue/eslint-config-typescript: ^4.0.0 => 4.0.0
    @vue/preload-webpack-plugin:  1.1.1
    @vue/web-component-wrapper:  1.2.0
    ant-design-vue: ^1.4.10 => 1.4.10
    babel-helper-vue-jsx-merge-props:  2.0.3
    eslint-plugin-vue: ^5.0.0 => 5.2.3
    typescript: 3.7.4 => 3.7.4
    vue: ^2.6.10 => 2.6.11
    vue-class-component: ^7.0.2 => 7.2.2
    vue-echarts: ^4.1.0 => 4.1.0
    vue-eslint-parser:  5.0.0
    vue-hot-reload-api:  2.3.4
    vue-js-modal: https://github.com/euvl/vue-js-modal.git => 1.3.31
    vue-loader:  15.8.3
    vue-property-decorator: ^8.3.0 => 8.3.0
    vue-ref:  1.0.6
    vue-router: ^3.1.3 => 3.1.5
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.10 => 2.6.11
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.1.2 => 3.1.2
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

just edit your template part of *.vue with multiple params slot-scope

        <template v-slot:handle="data, obj">
          {{ obj }}
        </template>

the above code will throw errors below:

warning: Replace data,·obj with (data,·obj) (prettier/prettier)

What is expected?

works

What is actually happening?

errors

haoqunjiang commented 4 years ago

I believe it's a bug in prettier.

wendyzhaogogo commented 4 years ago

I believe it's a bug in prettier.

yes,that's it. but i can't figure out which rule controls this after i look at in https://prettier.io/docs/en/options.html in detail.

the config below does not avoid that error


module.exports = {
  arrowParens: "avoid"
}
``
haoqunjiang commented 4 years ago

You can do this:

<!-- eslint-disable-next-line prettier/prettier -->
<template v-slot:handle="data, obj">
  {{ obj }}
</template>
wendyzhaogogo commented 4 years ago

@sodatea yes, I have covered the problem in your way, but another thing is which rule causes this.... prettier/prettier is a rule collection, i'm confused with it