Skip to content

Commit 467631e

Browse files
authored
Fixed false negatives for whitespace in vue/require-toggle-inside-transition rule (#2293)
1 parent 15b99af commit 467631e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/rules/require-toggle-inside-transition.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ module.exports = {
4747
return utils.defineTemplateBodyVisitor(context, {
4848
/** @param {VElement} node */
4949
"VElement[name='transition'] > VElement"(node) {
50-
if (node.parent.children[0] !== node) {
50+
const child = node.parent.children.find(utils.isVElement)
51+
if (child !== node) {
5152
return
5253
}
5354
verifyInsideElement(node)

tests/lib/rules/require-toggle-inside-transition.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ tester.run('require-toggle-inside-transition', rule, {
9797
filename: 'test.vue',
9898
code: '<template><transition><template v-for="e in list"><div /></template></transition></template>',
9999
errors: [{ messageId: 'expected' }]
100+
},
101+
{
102+
filename: 'test.vue',
103+
code: '<template><Transition> <div /></Transition></template>',
104+
errors: [{ messageId: 'expected' }]
100105
}
101106
]
102107
})

0 commit comments

Comments
 (0)