Skip to content

vue/v-on-function-call rule, code is broken by the autofix when the comment is included. #1203

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
ota-meshi opened this issue Jun 8, 2020 · 0 comments · Fixed by #1204
Closed
Labels

Comments

@ota-meshi
Copy link
Member

Tell us about your environment

  • ESLint version: 7.0.0
  • eslint-plugin-vue version: 7.0.0-alpha.6
  • Node version: 12

Please show your full configuration:

{
  "rules": {
    "vue/v-on-function-call": ["error", "never"]
  }
}

What did you do?

<template>
  <div @click="/*cmment*/fn()"></div>
  <div @click="fn()/*cmment*/"></div>
</template>

What did you expect to happen?

The code will not be bloken even if it is autofixed.

What actually happened?

The autofix changes the code as follows:

<template>
  <div @click="/*cmment*/fn"></div>
  <div @click="fn/*cmment*/"></div>
</template>

The autofix will change to the following code. But this is not the case.

<template>
  <div @click="fn"></div>
  <div @click="fn"></div>
</template>

If the comment is included, the Vue template compiler will compile it into a statement instead of an expression.
So, it breaks the code.

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