Skip to content

Commit ca41132

Browse files
committed
ignore native HTML elements
1 parent 83e4311 commit ca41132

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

lib/rules/prefer-true-attribute-shorthand.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ module.exports = {
4141

4242
return utils.defineTemplateBodyVisitor(context, {
4343
VAttribute(node) {
44+
if (!utils.isCustomComponent(node.parent.parent)) {
45+
return
46+
}
47+
4448
if (option === 'never' && !node.directive && !node.value) {
4549
context.report({
4650
node,

tests/lib/rules/prefer-true-attribute-shorthand.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,39 @@ tester.run('prefer-true-attribute-shorthand', rule, {
115115
</template>
116116
`,
117117
options: ['never']
118+
},
119+
{
120+
filename: 'test.vue',
121+
code: `
122+
<template>
123+
<input v-bind:checked="true" />
124+
</template>
125+
`
126+
},
127+
{
128+
filename: 'test.vue',
129+
code: `
130+
<template>
131+
<input :checked="true" />
132+
</template>
133+
`
134+
},
135+
{
136+
filename: 'test.vue',
137+
code: `
138+
<template>
139+
<input checked="checked" />
140+
</template>
141+
`
142+
},
143+
{
144+
filename: 'test.vue',
145+
code: `
146+
<template>
147+
<input checked />
148+
</template>
149+
`,
150+
options: ['never']
118151
}
119152
],
120153
invalid: [

0 commit comments

Comments
 (0)