Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/rules/require-toggle-inside-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ module.exports = {
if (utils.isCustomComponent(element)) {
return
}

/** @type VElement */ // @ts-expect-error
const parent = element.parent
if (utils.hasAttribute(parent, 'appear')) {
return
}

if (
element.name !== 'slot' &&
!utils.hasDirective(element, 'if') &&
!utils.hasDirective(element, 'show')
!utils.hasDirective(element, 'show') &&
!utils.hasDirective(element, 'bind', 'key')
) {
context.report({
node: element.startTag,
Expand All @@ -51,6 +60,7 @@ module.exports = {
if (child !== node) {
return
}

verifyInsideElement(node)
}
})
Expand Down
12 changes: 12 additions & 0 deletions tests/lib/rules/require-toggle-inside-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ tester.run('require-toggle-inside-transition', rule, {
{
filename: 'test.vue',
code: '<template><transition><template v-if="show"><div /></template></transition></template>'
},
{
filename: 'test.vue',
code: '<template><transition><slot /></transition></template>'
},
{
filename: 'test.vue',
code: '<template><transition><div :key="k" /></transition></template>'
},
{
filename: 'test.vue',
code: '<template><transition appear><div /></transition></template>'
}
],
invalid: [
Expand Down