Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ddc0525

Browse filesBrowse files
authored
fix(attribute-hyphenation): skip auto-fix when suffixed with .sync (#2533)
1 parent a4aed0a commit ddc0525
Copy full SHA for ddc0525

File tree

2 files changed

+40
-0
lines changed
Filter options

2 files changed

+40
-0
lines changed

‎lib/rules/attribute-hyphenation.js

Copy file name to clipboardExpand all lines: lib/rules/attribute-hyphenation.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ module.exports = {
101101
return null
102102
}
103103

104+
if (text.endsWith('.sync')) {
105+
return null
106+
}
107+
104108
if (/^[A-Z]/.test(name)) {
105109
return null
106110
}

‎tests/lib/rules/attribute-hyphenation.js

Copy file name to clipboardExpand all lines: tests/lib/rules/attribute-hyphenation.js
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ ruleTester.run('attribute-hyphenation', rule, {
7070
filename: 'test.vue',
7171
code: '<template><div><custom :attr_ff="prop"></custom></div></template>',
7272
options: ['never']
73+
},
74+
{
75+
filename: 'test.vue',
76+
code: '<template><div><custom :my-name.sync="prop"></custom></div></template>',
77+
options: ['always']
78+
},
79+
{
80+
filename: 'test.vue',
81+
code: '<template><div><custom :myName.sync="prop"></custom></div></template>',
82+
options: ['never']
7383
}
7484
],
7585

@@ -367,6 +377,32 @@ ruleTester.run('attribute-hyphenation', rule, {
367377
line: 1
368378
}
369379
]
380+
},
381+
{
382+
filename: 'test.vue',
383+
code: '<template><div><custom :myAge.sync="prop"></custom></div></template>',
384+
output: null,
385+
options: ['always'],
386+
errors: [
387+
{
388+
message: "Attribute ':myAge.sync' must be hyphenated.",
389+
type: 'VDirectiveKey',
390+
line: 1
391+
}
392+
]
393+
},
394+
{
395+
filename: 'test.vue',
396+
code: '<template><div><custom :my-age.sync="prop"></custom></div></template>',
397+
output: null,
398+
options: ['never'],
399+
errors: [
400+
{
401+
message: "Attribute ':my-age.sync' can't be hyphenated.",
402+
type: 'VDirectiveKey',
403+
line: 1
404+
}
405+
]
370406
}
371407
]
372408
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.