diff --git a/lib/rules/attribute-hyphenation.js b/lib/rules/attribute-hyphenation.js index 0ef2a0420..54ac77791 100644 --- a/lib/rules/attribute-hyphenation.js +++ b/lib/rules/attribute-hyphenation.js @@ -101,6 +101,10 @@ module.exports = { return null } + if (text.endsWith('.sync')) { + return null + } + if (/^[A-Z]/.test(name)) { return null } diff --git a/tests/lib/rules/attribute-hyphenation.js b/tests/lib/rules/attribute-hyphenation.js index 4d867d15e..16f6e4e10 100644 --- a/tests/lib/rules/attribute-hyphenation.js +++ b/tests/lib/rules/attribute-hyphenation.js @@ -70,6 +70,16 @@ ruleTester.run('attribute-hyphenation', rule, { filename: 'test.vue', code: '', options: ['never'] + }, + { + filename: 'test.vue', + code: '', + options: ['always'] + }, + { + filename: 'test.vue', + code: '', + options: ['never'] } ], @@ -367,6 +377,32 @@ ruleTester.run('attribute-hyphenation', rule, { line: 1 } ] + }, + { + filename: 'test.vue', + code: '', + output: null, + options: ['always'], + errors: [ + { + message: "Attribute ':myAge.sync' must be hyphenated.", + type: 'VDirectiveKey', + line: 1 + } + ] + }, + { + filename: 'test.vue', + code: '', + output: null, + options: ['never'], + errors: [ + { + message: "Attribute ':my-age.sync' can't be hyphenated.", + type: 'VDirectiveKey', + line: 1 + } + ] } ] })