File tree Expand file tree Collapse file tree 4 files changed +37
-11
lines changed
test/fixtures/components/app Expand file tree Collapse file tree 4 files changed +37
-11
lines changed Original file line number Diff line number Diff line change 11// @ts -check
22import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
33
4- // Run `npx @eslint/config-inspector` to inspect the resolved config interactively
54export default createConfigForNuxt ( {
65 features : {
7- // Rules for module authors
86 tooling : true ,
9- // Rules for formatting
107 stylistic : true ,
118 } ,
129 dirs : {
@@ -15,6 +12,7 @@ export default createConfigForNuxt({
1512 ] ,
1613 } ,
1714} ) . overrideRules ( {
15+ '@typescript-eslint/no-empty-object-type' : 'off' ,
1816 '@typescript-eslint/no-explicit-any' : 'off' ,
1917 'vue/multi-word-component-names' : [ 'error' , {
2018 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">
22import type { Component } from ' vue'
33import type { BouncerAbility , BouncerArgs } from ' ../../utils'
44import { Primitive } from ' ./Primitive'
55import { allows , ref , watchEffect } from ' #imports'
66
7- const props = defineProps < {
7+ export interface BouncerProps {
88 ability: Ability | Ability []
99 args? : BouncerArgs <Ability > | BouncerArgs <Ability >[]
1010 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 >()
1224
1325const can = ref (await resolve ())
1426
@@ -31,10 +43,11 @@ async function resolve() {
3143 <Primitive
3244 :as =" props.as"
3345 >
34- <slot
35- v-if =" $slots.default"
36- :can
37- />
46+ <template v-if =" slots .default " >
47+ <slot
48+ :can
49+ />
50+ </template >
3851 <template v-else >
3952 <slot
4053 v-if =" can"
Original file line number Diff line number Diff line change 1- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
21export interface ModuleOptions { }
Original file line number Diff line number Diff line change @@ -84,6 +84,22 @@ const cannot = defineAbility(() => {
8484 </div >
8585 </Cannot >
8686
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+
87103 <Bouncer
88104 :ability =" can"
89105 >
You can’t perform that action at this time.
0 commit comments