File tree Expand file tree Collapse file tree 2 files changed +48
-1
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +48
-1
lines changed
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ function getAttributeName(node) {
18
18
}
19
19
20
20
if (
21
- node . key . name . name === 'bind' &&
21
+ ( node . key . name . name === 'bind' || node . key . name . name === 'model' ) &&
22
22
node . key . argument &&
23
23
node . key . argument . type === 'VIdentifier'
24
24
) {
Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ ruleTester.run('attribute-hyphenation', rule, {
26
26
code : '<template><div><custom data-id="foo" aria-test="bar" slot-scope="{ data }" my-prop="prop"></custom></div></template>' ,
27
27
options : [ 'always' ]
28
28
} ,
29
+ {
30
+ filename : 'test.vue' ,
31
+ code : '<template><div><custom :my-prop="prop" v-model:foo-bar="fooBar"></custom></div></template>' ,
32
+ options : [ 'always' ]
33
+ } ,
29
34
{
30
35
filename : 'test.vue' ,
31
36
code : '<template><div><custom data-id="foo" aria-test="bar" slot-scope="{ data }" myProp="prop"></custom></div></template>' ,
@@ -219,6 +224,48 @@ ruleTester.run('attribute-hyphenation', rule, {
219
224
}
220
225
]
221
226
} ,
227
+ {
228
+ // https://github.com/vuejs/eslint-plugin-vue/issues/2510
229
+ filename : 'test.vue' ,
230
+ code : '<template><div><custom v-model:my-prop="prop"></custom></div></template>' ,
231
+ output :
232
+ '<template><div><custom v-model:myProp="prop"></custom></div></template>' ,
233
+ options : [ 'never' ] ,
234
+ errors : [
235
+ {
236
+ message : "Attribute 'v-model:my-prop' can't be hyphenated." ,
237
+ type : 'VDirectiveKey' ,
238
+ line : 1
239
+ }
240
+ ]
241
+ } ,
242
+ {
243
+ filename : 'test.vue' ,
244
+ code : '<template><div><custom v-model:myProp="prop"></custom></div></template>' ,
245
+ output :
246
+ '<template><div><custom v-model:my-prop="prop"></custom></div></template>' ,
247
+ options : [ 'always' ] ,
248
+ errors : [
249
+ {
250
+ message : "Attribute 'v-model:myProp' must be hyphenated." ,
251
+ type : 'VDirectiveKey' ,
252
+ line : 1
253
+ }
254
+ ]
255
+ } ,
256
+ {
257
+ filename : 'test.vue' ,
258
+ code : '<template><div><custom v-model:MyProp="prop"></custom></div></template>' ,
259
+ output : null ,
260
+ options : [ 'always' ] ,
261
+ errors : [
262
+ {
263
+ message : "Attribute 'v-model:MyProp' must be hyphenated." ,
264
+ type : 'VDirectiveKey' ,
265
+ line : 1
266
+ }
267
+ ]
268
+ } ,
222
269
{
223
270
filename : 'test.vue' ,
224
271
code : `
You can’t perform that action at this time.
0 commit comments