Skip to content

Commit

Permalink
fix(require-toggle-inside-transition): should respect the attribute "…
Browse files Browse the repository at this point in the history
…appear"
  • Loading branch information
williamc committed Oct 27, 2023
1 parent e6cab77 commit e2f1a8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/rules/require-toggle-inside-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ 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') &&
Expand All @@ -50,7 +57,7 @@ module.exports = {
/** @param {VElement} node */
"VElement[name='transition'] > VElement"(node) {
verifyInsideElement(node)
},
}
})
}
}
4 changes: 4 additions & 0 deletions tests/lib/rules/require-toggle-inside-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ tester.run('require-toggle-inside-transition', rule, {
filename: 'test.vue',
code: '<template><transition><div :key="k" /></transition></template>'
},
{
filename: 'test.vue',
code: '<template><transition appear><div /></transition></template>'
}
],
invalid: [
{
Expand Down

0 comments on commit e2f1a8d

Please sign in to comment.