pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
vue/v-on-function-call |
enforce or forbid parentheses after method calls without arguments in `v-on` directives |
v5.2.0 |
enforce or forbid parentheses after method calls without arguments in
v-on
directives
- ⛔ This rule was removed in eslint-plugin-vue v10.0.0 and replaced by vue/v-on-handler-style rule.
This rule aims to enforce to bind methods to v-on
or call methods on v-on
when without arguments.
<template>
<!-- ✓ GOOD -->
<button v-on:click="closeModal">Close</button>
<!-- ✗ BAD -->
<button v-on:click="closeModal()">Close</button>
</template>
Default is set to never
.
{
"vue/v-on-function-call": ["error",
"always"|"never",
{
"ignoreIncludesComment": false
}
]
}
"always"
... Always use parentheses inv-on
directives."never"
... Never use parentheses inv-on
directives for method calls without arguments. this is default.ignoreIncludesComment
... Iftrue
, do not report expressions containing comments. defaultfalse
.
<template>
<!-- ✓ GOOD -->
<button v-on:click="closeModal()">Close</button>
<!-- ✗ BAD -->
<button v-on:click="closeModal">Close</button>
</template>
<template>
<!-- ✓ GOOD -->
<button v-on:click="closeModal">Close</button>
<button v-on:click="closeModal(arg)">Close</button>
<!-- ✗ BAD -->
<button v-on:click="closeModal()">Close</button>
</template>
<template>
<!-- ✓ GOOD -->
<button v-on:click="closeModal">Close</button>
<button v-on:click="closeModal() /* comment */">Close</button>
<!-- ✗ BAD -->
<button v-on:click="closeModal()">Close</button>
</template>
This rule was introduced in eslint-plugin-vue v5.2.0