diff --git a/lib/rules/attribute-hyphenation.js b/lib/rules/attribute-hyphenation.js
index 0ef2a0420..99861c1e4 100644
--- a/lib/rules/attribute-hyphenation.js
+++ b/lib/rules/attribute-hyphenation.js
@@ -18,7 +18,7 @@ function getAttributeName(node) {
}
if (
- node.key.name.name === 'bind' &&
+ (node.key.name.name === 'bind' || node.key.name.name === 'model') &&
node.key.argument &&
node.key.argument.type === 'VIdentifier'
) {
diff --git a/lib/rules/require-prop-types.js b/lib/rules/require-prop-types.js
index 4102ad039..af2a956a4 100644
--- a/lib/rules/require-prop-types.js
+++ b/lib/rules/require-prop-types.js
@@ -75,7 +75,7 @@ module.exports = {
return
}
const hasType =
- prop.type === 'array' ? false : optionHasType(prop.value) ?? true
+ prop.type === 'array' ? false : (optionHasType(prop.value) ?? true)
if (!hasType) {
const { node, propName } = prop
diff --git a/tests/lib/rules/attribute-hyphenation.js b/tests/lib/rules/attribute-hyphenation.js
index 4d867d15e..c29479eb2 100644
--- a/tests/lib/rules/attribute-hyphenation.js
+++ b/tests/lib/rules/attribute-hyphenation.js
@@ -26,6 +26,11 @@ ruleTester.run('attribute-hyphenation', rule, {
code: '
',
options: ['always']
},
+ {
+ filename: 'test.vue',
+ code: '
',
+ options: ['always']
+ },
{
filename: 'test.vue',
code: '
',
@@ -209,6 +214,48 @@ ruleTester.run('attribute-hyphenation', rule, {
}
]
},
+ {
+ // https://github.com/vuejs/eslint-plugin-vue/issues/2510
+ filename: 'test.vue',
+ code: '
',
+ output:
+ '
',
+ options: ['never'],
+ errors: [
+ {
+ message: "Attribute 'v-model:my-prop' can't be hyphenated.",
+ type: 'VDirectiveKey',
+ line: 1
+ }
+ ]
+ },
+ {
+ filename: 'test.vue',
+ code: '
',
+ output:
+ '
',
+ options: ['always'],
+ errors: [
+ {
+ message: "Attribute 'v-model:myProp' must be hyphenated.",
+ type: 'VDirectiveKey',
+ line: 1
+ }
+ ]
+ },
+ {
+ filename: 'test.vue',
+ code: '
',
+ output: null,
+ options: ['always'],
+ errors: [
+ {
+ message: "Attribute 'v-model:MyProp' must be hyphenated.",
+ type: 'VDirectiveKey',
+ line: 1
+ }
+ ]
+ },
{
filename: 'test.vue',
code: `