Skip to content

Commit

Permalink
Fixed false negatives for whitespace in `vue/require-toggle-inside-tr…
Browse files Browse the repository at this point in the history
…ansition` rule (#2293)
  • Loading branch information
ota-meshi committed Oct 24, 2023
1 parent 15b99af commit 467631e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rules/require-toggle-inside-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/rules/require-toggle-inside-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ tester.run('require-toggle-inside-transition', rule, {
filename: 'test.vue',
code: '<template><transition><template v-for="e in list"><div /></template></transition></template>',
errors: [{ messageId: 'expected' }]
},
{
filename: 'test.vue',
code: '<template><Transition> <div /></Transition></template>',
errors: [{ messageId: 'expected' }]
}
]
})

0 comments on commit 467631e

Please sign in to comment.