Skip to content

Commit 790099f

Browse files
committed
Use raw values instead & fix rule
1 parent f19dd91 commit 790099f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/rules/attribute-hyphenation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function create (context) {
4747
VAttribute (node) {
4848
if (!utils.isCustomComponent(node.parent.parent)) return
4949

50-
const name = !node.directive ? node.key.name : node.key.name === 'bind' ? node.key.argument : false
50+
const name = !node.directive ? node.key.rawName : node.key.name === 'bind' ? node.key.raw.argument : false
5151
if (!name || isIgnoredAttribute(name)) return
5252

5353
reportIssue(node, name)

tests/lib/rules/attribute-hyphenation.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ ruleTester.run('attribute-hyphenation', rule, {
4848
invalid: [
4949
{
5050
filename: 'test.vue',
51-
code: '<template><div><custom my-prop="prop"></custom></div></template>',
52-
output: '<template><div><custom myProp="prop"></custom></div></template>',
51+
code: '<template><div><custom my-prop="foo"></custom></div></template>',
52+
output: '<template><div><custom myProp="foo"></custom></div></template>',
5353
options: ['never'],
5454
errors: [{
5555
message: "Attribute 'my-prop' cann't be hyphenated.",
@@ -59,8 +59,8 @@ ruleTester.run('attribute-hyphenation', rule, {
5959
},
6060
{
6161
filename: 'test.vue',
62-
code: '<template><div><custom MyProp="prop"></custom></div></template>',
63-
output: '<template><div><custom my-prop="prop"></custom></div></template>',
62+
code: '<template><div><custom MyProp="Bar"></custom></div></template>',
63+
output: '<template><div><custom my-prop="Bar"></custom></div></template>',
6464
options: ['always'],
6565
errors: [{
6666
message: "Attribute 'MyProp' must be hyphenated.",

0 commit comments

Comments
 (0)