File tree 4 files changed +37
-11
lines changed
test/fixtures/components/app
4 files changed +37
-11
lines changed Original file line number Diff line number Diff line change 1
1
// @ts -check
2
2
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
3
3
4
- // Run `npx @eslint/config-inspector` to inspect the resolved config interactively
5
4
export default createConfigForNuxt ( {
6
5
features : {
7
- // Rules for module authors
8
6
tooling : true ,
9
- // Rules for formatting
10
7
stylistic : true ,
11
8
} ,
12
9
dirs : {
@@ -15,6 +12,7 @@ export default createConfigForNuxt({
15
12
] ,
16
13
} ,
17
14
} ) . overrideRules ( {
15
+ '@typescript-eslint/no-empty-object-type' : 'off' ,
18
16
'@typescript-eslint/no-explicit-any' : 'off' ,
19
17
'vue/multi-word-component-names' : [ 'error' , {
20
18
ignores : [ 'Can' , 'Cannot' , 'Bouncer' ] ,
Original file line number Diff line number Diff line change 1
- <script lang="ts" setup generic = " Ability extends BouncerAbility < any > " >
1
+ <script lang="ts">
2
2
import type { Component } from ' vue'
3
3
import type { BouncerAbility , BouncerArgs } from ' ../../utils'
4
4
import { Primitive } from ' ./Primitive'
5
5
import { allows , ref , watchEffect } from ' #imports'
6
6
7
- const props = defineProps < {
7
+ export interface BouncerProps {
8
8
ability: Ability | Ability []
9
9
args? : BouncerArgs <Ability > | BouncerArgs <Ability >[]
10
10
as? : string | Component
11
- }>()
11
+ }
12
+ export interface BouncerEmits {}
13
+ export interface BouncerSlots {
14
+ default? : (props ? : { can: boolean }) => any
15
+ can? : (props ? : object ) => any
16
+ cannot? : (props ? : object ) => any
17
+ }
18
+ </script >
19
+
20
+ <script lang="ts" setup generic =" Ability extends BouncerAbility <any >" >
21
+ const props = defineProps <BouncerProps >()
22
+ defineEmits <BouncerEmits >()
23
+ const slots = defineSlots <BouncerSlots >()
12
24
13
25
const can = ref (await resolve ())
14
26
@@ -31,10 +43,11 @@ async function resolve() {
31
43
<Primitive
32
44
:as =" props.as"
33
45
>
34
- <slot
35
- v-if =" $slots.default"
36
- :can
37
- />
46
+ <template v-if =" slots .default " >
47
+ <slot
48
+ :can
49
+ />
50
+ </template >
38
51
<template v-else >
39
52
<slot
40
53
v-if =" can"
Original file line number Diff line number Diff line change 1
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
2
1
export interface ModuleOptions { }
Original file line number Diff line number Diff line change @@ -84,6 +84,22 @@ const cannot = defineAbility(() => {
84
84
</div >
85
85
</Cannot >
86
86
87
+ <Bouncer :ability =" can" >
88
+ <div data-testid =" bouncer-default-visible" >
89
+ Bouncer Default Visible
90
+ </div >
91
+ <template #can >
92
+ <div data-testid =" bouncer-default-can-invisible" >
93
+ Bouncer Can Invisible
94
+ </div >
95
+ </template >
96
+ <template #cannot >
97
+ <div data-testid =" bouncer-default-cannot-invisible" >
98
+ Bouncer Cannot Invisible
99
+ </div >
100
+ </template >
101
+ </Bouncer >
102
+
87
103
<Bouncer
88
104
:ability =" can"
89
105
>
You can’t perform that action at this time.
0 commit comments