Fix lint for two specific components. (#28)

This commit is contained in:
Alessandro Jean 2023-09-08 17:03:32 -03:00 committed by GitHub
parent 18fe3d7044
commit f8a1fecae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 22 deletions

View File

@ -1,12 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue" import { computed } from "vue"
import { type DefaultTheme, useData } from "vitepress" import { useData } from "vitepress"
import type { DefaultTheme } from "vitepress/theme"
import { data as release } from "../data/release.data"
import VPNavBarMenuLink from "vitepress/dist/client/theme-default/components/VPNavBarMenuLink.vue" import VPNavBarMenuLink from "vitepress/dist/client/theme-default/components/VPNavBarMenuLink.vue"
import VPNavBarMenuGroup from "vitepress/dist/client/theme-default/components/VPNavBarMenuGroup.vue" import VPNavBarMenuGroup from "vitepress/dist/client/theme-default/components/VPNavBarMenuGroup.vue"
import { data as release } from "../data/release.data"
const { theme } = useData<DefaultTheme.Config>() const { theme } = useData<DefaultTheme.Config>()
/** /**
@ -21,7 +22,7 @@ const nav = computed(() => {
const appVersion = release.stable.tag_name.substring(1) const appVersion = release.stable.tag_name.substring(1)
return <DefaultTheme.NavItemWithChildren> { return {
...item, ...item,
text: item.text === "{app_version}" ? appVersion : item.text, text: item.text === "{app_version}" ? appVersion : item.text,
items: (item as DefaultTheme.NavItemWithChildren).items.map((child) => { items: (item as DefaultTheme.NavItemWithChildren).items.map((child) => {
@ -29,12 +30,12 @@ const nav = computed(() => {
return child return child
} }
return <DefaultTheme.NavItemWithLink> { return {
...child, ...child,
link: child.link.replace("{app_version}", appVersion), link: child.link.replace("{app_version}", appVersion),
} } satisfies DefaultTheme.NavItemWithLink
}), }),
} } satisfies DefaultTheme.NavItemWithChildren
}) })
}) })
</script> </script>

View File

@ -2,11 +2,11 @@
import { computed } from "vue" import { computed } from "vue"
import { type DefaultTheme, useData } from "vitepress" import { type DefaultTheme, useData } from "vitepress"
import { data as release } from "../data/release.data"
import VPNavScreenMenuLink from "vitepress/dist/client/theme-default/components/VPNavScreenMenuLink.vue" import VPNavScreenMenuLink from "vitepress/dist/client/theme-default/components/VPNavScreenMenuLink.vue"
import VPNavScreenMenuGroup from "vitepress/dist/client/theme-default/components/VPNavScreenMenuGroup.vue" import VPNavScreenMenuGroup from "vitepress/dist/client/theme-default/components/VPNavScreenMenuGroup.vue"
import { data as release } from "../data/release.data"
const { theme } = useData<DefaultTheme.Config>() const { theme } = useData<DefaultTheme.Config>()
/** /**
@ -21,7 +21,7 @@ const nav = computed(() => {
const appVersion = release.stable.tag_name.substring(1) const appVersion = release.stable.tag_name.substring(1)
return <DefaultTheme.NavItemWithChildren> { return {
...item, ...item,
text: item.text === "{app_version}" ? appVersion : item.text, text: item.text === "{app_version}" ? appVersion : item.text,
items: (item as DefaultTheme.NavItemWithChildren).items.map((child) => { items: (item as DefaultTheme.NavItemWithChildren).items.map((child) => {
@ -29,12 +29,12 @@ const nav = computed(() => {
return child return child
} }
return <DefaultTheme.NavItemWithLink> { return {
...child, ...child,
link: child.link.replace("{app_version}", appVersion), link: child.link.replace("{app_version}", appVersion),
} } satisfies DefaultTheme.NavItemWithLink
}), }),
} } satisfies DefaultTheme.NavItemWithChildren
}) })
}) })
</script> </script>
@ -42,15 +42,15 @@ const nav = computed(() => {
<template> <template>
<nav v-if="nav" class="VPNavScreenMenu"> <nav v-if="nav" class="VPNavScreenMenu">
<template v-for="item in nav" :key="item.text"> <template v-for="item in nav" :key="item.text">
<VPNavScreenMenuLink <VPNavScreenMenuLink
v-if="'link' in item" v-if="'link' in item"
:item="item" :item="item"
/> />
<VPNavScreenMenuGroup <VPNavScreenMenuGroup
v-else v-else
:text="item.text || ''" :text="item.text || ''"
:items="item.items" :items="item.items"
/> />
</template> </template>
</nav> </nav>
</template> </template>