diff --git a/lib/rules/require-toggle-inside-transition.js b/lib/rules/require-toggle-inside-transition.js
index 365fbc713..bdbb5c2dd 100644
--- a/lib/rules/require-toggle-inside-transition.js
+++ b/lib/rules/require-toggle-inside-transition.js
@@ -47,7 +47,8 @@ module.exports = {
return utils.defineTemplateBodyVisitor(context, {
/** @param {VElement} node */
"VElement[name='transition'] > VElement"(node) {
- if (node.parent.children[0] !== node) {
+ const child = node.parent.children.find(utils.isVElement)
+ if (child !== node) {
return
}
verifyInsideElement(node)
diff --git a/tests/lib/rules/require-toggle-inside-transition.js b/tests/lib/rules/require-toggle-inside-transition.js
index 73ec47206..0b64daaa3 100644
--- a/tests/lib/rules/require-toggle-inside-transition.js
+++ b/tests/lib/rules/require-toggle-inside-transition.js
@@ -97,6 +97,11 @@ tester.run('require-toggle-inside-transition', rule, {
filename: 'test.vue',
code: '',
errors: [{ messageId: 'expected' }]
+ },
+ {
+ filename: 'test.vue',
+ code: ' ',
+ errors: [{ messageId: 'expected' }]
}
]
})