Skip to content

Commit 7904536

Browse files
armano2mysticatea
authored andcommitted
Update: add support for v-on="listeners" (#89) (#90)
1 parent 1d00dd6 commit 7904536

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

lib/rules/no-invalid-v-on.js

-7
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ const VERB_MODIFIERS = new Set([
3333
function create (context) {
3434
utils.registerTemplateBodyVisitor(context, {
3535
"VAttribute[directive=true][key.name='on']" (node) {
36-
if (!node.key.argument) {
37-
context.report({
38-
node,
39-
loc: node.loc,
40-
message: "'v-on' directives require event names."
41-
})
42-
}
4336
for (const modifier of node.key.modifiers) {
4437
if (!VALID_MODIFIERS.has(modifier) && !Number.isInteger(parseInt(modifier, 10))) {
4538
context.report({

tests/lib/rules/no-invalid-v-bind.js

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ tester.run('no-invalid-v-bind', rule, {
7070
{
7171
filename: 'test.vue',
7272
code: "<template><div :aaa.camel='bbb'></div></template>"
73+
},
74+
{
75+
filename: 'test.vue',
76+
code: "<template><input v-bind='$attrs' /></template>"
7377
}
7478
],
7579
invalid: [

tests/lib/rules/no-invalid-v-on.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@ tester.run('no-invalid-v-on', rule, {
5454
{
5555
filename: 'test.vue',
5656
code: '<template><div v-on:click.native.stop></div></template>'
57+
},
58+
{
59+
filename: 'test.vue',
60+
code: '<template><div v-on="$listeners"></div></template>'
5761
}
5862
],
5963
invalid: [
60-
{
61-
filename: 'test.vue',
62-
code: '<template><div v-on="foo"></div></template>',
63-
errors: ["'v-on' directives require event names."]
64-
},
6564
{
6665
filename: 'test.vue',
6766
code: '<template><div v-on:click.aaa="foo"></div></template>',

0 commit comments

Comments
 (0)