Skip to content

Commit 4b92a26

Browse files
committed
feat(require-toggle-inside-transition): check directive
1 parent ca7daff commit 4b92a26

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ module.exports = {
3535

3636
/** @type VElement */ // @ts-expect-error
3737
const parent = element.parent
38-
if (utils.hasAttribute(parent, 'appear')) {
38+
if (
39+
utils.hasAttribute(parent, 'appear') ||
40+
utils.hasDirective(parent, 'bind', 'appear')
41+
) {
3942
return
4043
}
4144

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ tester.run('require-toggle-inside-transition', rule, {
6868
{
6969
filename: 'test.vue',
7070
code: '<template><transition appear><div /></transition></template>'
71+
},
72+
{
73+
// https://github.com/vuejs/eslint-plugin-vue/issues/2467
74+
filename: 'test.vue',
75+
code: '<template><transition :appear="isLoaded"><div /></transition></template>'
7176
}
7277
],
7378
invalid: [
@@ -113,6 +118,11 @@ tester.run('require-toggle-inside-transition', rule, {
113118
filename: 'test.vue',
114119
code: '<template><Transition> <div /></Transition></template>',
115120
errors: [{ messageId: 'expected' }]
121+
},
122+
{
123+
filename: 'test.vue',
124+
code: '<template><transition @appear="isLoaded"><div /></transition></template>',
125+
errors: [{ messageId: 'expected' }]
116126
}
117127
]
118128
})

0 commit comments

Comments
 (0)