Skip to content
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

valid-v-on does not accept an anonymous function #716

Closed
bdiz opened this issue Dec 7, 2018 · 1 comment
Closed

valid-v-on does not accept an anonymous function #716

bdiz opened this issue Dec 7, 2018 · 1 comment

Comments

@bdiz
Copy link

bdiz commented Dec 7, 2018

Tell us about your environment

  • ESLint version: 4.19.1
  • eslint-plugin-vue version: 4.7.1
  • Node version: 10.5.0

Please show your full configuration:

{
  "root": true,
  "parserOptions": {
    "ecmaVersion": 2017
  },  
  "env": {
    "node": true
  },  
  "extends": [
    "plugin:vue/essential",
    "eslint:recommended"
  ],  
  "rules": {
    "indent": ["error", 2], 
    "linebreak-style": ["error", "unix"],
    "quotes": ["error", "double"],
    "semi": ["error", "always"],

    "comma-dangle": ["error", "never"]
  },  
  "globals": {
    "nw": false,
    "GIT_VERSION": false,
    "APP_VERSION": false
  }
}

What did you do?

<template>
<!-- ... -->
        <v-checkbox
          label="Includes a master"
          hide-details
          :input-value="uvc.hasMaster"
          @change="function(hasMaster) { uvc.update({ hasMaster }) }"
        />
<!-- ... -->
</template>

What did you expect to happen?
I expected eslint vue/valid-v-on checks to pass.

What actually happened?

error: 'v-on' directives require that attribute value or verb modifiers (vue/valid-v-on) at src/views/uvcs/edit.vue:155:11:
  153 |           hide-details
  154 |           :input-value="uvc.hasMaster"
> 155 |           @change="function(hasMaster) { uvc.update({ hasMaster }) }"
      |           ^
  156 |         />
  157 |         <vue-slide-up-down :active="uvc.hasMaster">
  158 |           <code-area
@ota-meshi
Copy link
Member

Thank you for this issue.

It was reproduced on vue-eslint-demo.

Perhaps a parse error occurs in vue-eslint-parser.

I think the parser can not parse the code that starts with function.
Vue seems to process correctly.
https://github.com/vuejs/vue/blob/master/src/compiler/codegen/events.js#L3

mysticatea added a commit that referenced this issue Jan 5, 2019
Fixes #716
Fiees #722
Fixes #733

As a side effect, it gets ignoring expressions on outside of the
template.
michalsnik pushed a commit that referenced this issue Jan 26, 2019
* Chore: update vue-eslint-parser

Fixes #716
Fiees #722
Fixes #733

As a side effect, it gets ignoring expressions on outside of the
template.

* Update tests cases
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