mirror of
https://github.com/ArthurDanjou/artsite.git
synced 2026-01-25 17:52:37 +01:00
Change linter config to antfu config and lint code
This commit is contained in:
@@ -3,10 +3,10 @@ export default defineAppConfig({
|
||||
gray: 'neutral',
|
||||
primary: 'gray',
|
||||
container: {
|
||||
constrained: 'max-w-3xl'
|
||||
constrained: 'max-w-3xl',
|
||||
},
|
||||
icons: {
|
||||
dynamic: true
|
||||
}
|
||||
}
|
||||
dynamic: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
24
app/app.vue
24
app/app.vue
@@ -1,3 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
useHead({
|
||||
link: [{ rel: 'icon', type: 'image/png', href: '/favicon.png' }],
|
||||
})
|
||||
|
||||
const head = useLocaleHead({
|
||||
addDirAttribute: true,
|
||||
identifierAttribute: 'id',
|
||||
addSeoAttributes: true,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Html
|
||||
:dir="head.htmlAttrs.dir"
|
||||
@@ -40,18 +52,6 @@
|
||||
</Html>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
useHead({
|
||||
link: [{ rel: 'icon', type: 'image/png', href: '/favicon.png' }]
|
||||
})
|
||||
|
||||
const head = useLocaleHead({
|
||||
addDirAttribute: true,
|
||||
identifierAttribute: 'id',
|
||||
addSeoAttributes: true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
font-family: 'DM Sans', sans-serif;
|
||||
|
||||
@@ -3,26 +3,27 @@ const socials = [
|
||||
{
|
||||
icon: 'i-ph-x-logo-duotone',
|
||||
label: 'Twitter',
|
||||
link: 'https://twitter.com/ArthurDanj'
|
||||
link: 'https://twitter.com/ArthurDanj',
|
||||
},
|
||||
{
|
||||
icon: 'i-ph-github-logo-duotone',
|
||||
label: 'GitHub',
|
||||
link: 'https://github.com/ArthurDanjou'
|
||||
link: 'https://github.com/ArthurDanjou',
|
||||
},
|
||||
{
|
||||
icon: 'i-ph-linkedin-logo-duotone',
|
||||
label: 'LinkedIn',
|
||||
link: 'https://www.linkedin.com/in/arthurdanjou/'
|
||||
}, {
|
||||
link: 'https://www.linkedin.com/in/arthurdanjou/',
|
||||
},
|
||||
{
|
||||
icon: 'i-ph-discord-logo-duotone',
|
||||
label: 'Discord',
|
||||
link: 'https://discordapp.com/users/179635349100691456'
|
||||
}
|
||||
link: 'https://discordapp.com/users/179635349100691456',
|
||||
},
|
||||
]
|
||||
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -63,7 +64,7 @@ const { t } = useI18n({
|
||||
<div class="mt-8 w-full flex justify-center text-xs">
|
||||
{{
|
||||
t('copyright', {
|
||||
date: new Date().getFullYear()
|
||||
date: new Date().getFullYear(),
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
|
||||
@@ -10,52 +10,52 @@ const navs = [
|
||||
{
|
||||
label: {
|
||||
en: 'home',
|
||||
fr: 'accueil'
|
||||
fr: 'accueil',
|
||||
},
|
||||
to: '/',
|
||||
icon: 'i-ph-house-line-duotone',
|
||||
shortcut: {
|
||||
en: 'h',
|
||||
fr: 'a'
|
||||
}
|
||||
fr: 'a',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: {
|
||||
en: 'uses',
|
||||
fr: 'usages'
|
||||
fr: 'usages',
|
||||
},
|
||||
to: '/uses',
|
||||
icon: 'i-ph-backpack-duotone',
|
||||
shortcut: {
|
||||
en: 'u',
|
||||
fr: 'u'
|
||||
}
|
||||
fr: 'u',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: {
|
||||
en: 'writings',
|
||||
fr: 'écrits'
|
||||
fr: 'écrits',
|
||||
},
|
||||
to: '/writings',
|
||||
icon: 'i-ph-books-duotone',
|
||||
shortcut: {
|
||||
en: 'w',
|
||||
fr: 'e'
|
||||
}
|
||||
fr: 'e',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: {
|
||||
en: 'resume',
|
||||
fr: 'cv'
|
||||
fr: 'cv',
|
||||
},
|
||||
to: config.public.cloud.resume,
|
||||
target: '_blank',
|
||||
icon: 'i-ph-address-book-duotone',
|
||||
shortcut: {
|
||||
en: 'r',
|
||||
fr: 'c'
|
||||
}
|
||||
}
|
||||
fr: 'c',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
async function toggleTheme() {
|
||||
@@ -69,6 +69,9 @@ async function toggleTheme() {
|
||||
document.body.style.animation = ''
|
||||
}
|
||||
|
||||
const { locale, setLocale, locales, t } = useI18n()
|
||||
const currentLocale = computed(() => locales.value.filter(l => l.code === locale.value)[0])
|
||||
|
||||
async function changeLocale() {
|
||||
document.body.style.animation = 'switch-on .2s'
|
||||
await new Promise(resolve => setTimeout(resolve, 200))
|
||||
@@ -81,8 +84,6 @@ async function changeLocale() {
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
const { locale, setLocale, locales, t } = useI18n()
|
||||
const currentLocale = computed(() => locales.value.filter(l => l.code === locale.value)[0])
|
||||
defineShortcuts({
|
||||
h: () => router.push('/'),
|
||||
a: () => router.push('/'),
|
||||
@@ -93,7 +94,7 @@ defineShortcuts({
|
||||
c: () => window.open(config.public.cloud.resume, '_blank'),
|
||||
t: () => toggleTheme(),
|
||||
l: () => changeLocale(),
|
||||
backspace: () => router.back()
|
||||
backspace: () => router.back(),
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ const { locale, locales } = useI18n()
|
||||
const currentLocale = computed(() => locales.value.find(l => l.code === locale.value))
|
||||
|
||||
const getActivity = computed(() => {
|
||||
if (!codingActivity.value) return
|
||||
if (!codingActivity.value)
|
||||
return
|
||||
|
||||
const { name, details, state, timestamps } = codingActivity.value
|
||||
const isActive = name === 'Visual Studio Code'
|
||||
@@ -44,14 +45,14 @@ const getActivity = computed(() => {
|
||||
.trim(),
|
||||
formated: {
|
||||
date: formatDate(timestamps.start, 'DD MMM YYYY'),
|
||||
time: formatDate(timestamps.start, 'HH:mm:ss')
|
||||
}
|
||||
}
|
||||
time: formatDate(timestamps.start, 'HH:mm:ss'),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
<script lang="ts" setup>
|
||||
const { width } = useWindowSize()
|
||||
const { t } = useI18n({
|
||||
useScope: 'local',
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ClientOnly>
|
||||
<div
|
||||
@@ -13,13 +20,6 @@
|
||||
</ClientOnly>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const { width } = useWindowSize()
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
})
|
||||
</script>
|
||||
|
||||
<i18n lang="json">
|
||||
{
|
||||
"en": {
|
||||
|
||||
@@ -4,15 +4,15 @@ import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
text: {
|
||||
type: [String, Number],
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
hover: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
position: {
|
||||
type: String as PropType<'top' | 'right' | 'bottom' | 'left'>
|
||||
}
|
||||
type: String as PropType<'top' | 'right' | 'bottom' | 'left'>,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
href: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: '',
|
||||
},
|
||||
target: {
|
||||
type: String as PropType<'_blank' | '_parent' | '_self' | '_top' | (string & object) | null | undefined>,
|
||||
default: undefined,
|
||||
required: false
|
||||
}
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, useRuntimeConfig } from '#imports'
|
||||
|
||||
const props = defineProps<{ id?: string }>()
|
||||
|
||||
const { headings } = useRuntimeConfig().public.mdc
|
||||
const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h2)))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h2
|
||||
:id="id"
|
||||
@@ -12,12 +21,3 @@
|
||||
<slot v-else />
|
||||
</h2>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, useRuntimeConfig } from '#imports'
|
||||
|
||||
const props = defineProps<{ id?: string }>()
|
||||
|
||||
const { headings } = useRuntimeConfig().public.mdc
|
||||
const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h2)))
|
||||
</script>
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, useRuntimeConfig } from '#imports'
|
||||
|
||||
const props = defineProps<{ id?: string }>()
|
||||
|
||||
const { headings } = useRuntimeConfig().public.mdc
|
||||
const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h2)))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h2
|
||||
:id="id"
|
||||
@@ -12,12 +21,3 @@
|
||||
<slot v-else />
|
||||
</h2>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, useRuntimeConfig } from '#imports'
|
||||
|
||||
const props = defineProps<{ id?: string }>()
|
||||
|
||||
const { headings } = useRuntimeConfig().public.mdc
|
||||
const generate = computed(() => props.id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h2)))
|
||||
</script>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
defineProps({
|
||||
icon: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
<script lang="ts" setup>
|
||||
const { t } = useI18n({
|
||||
useScope: 'local',
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center gap-2 mt-4">
|
||||
<div class="flex items-center">
|
||||
@@ -17,12 +23,6 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
})
|
||||
</script>
|
||||
|
||||
<i18n lang="json">
|
||||
{
|
||||
"en": {
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Stats } from '~~/types'
|
||||
|
||||
const { data: stats } = await useFetch<Stats>('/api/stats')
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
defineProps({
|
||||
label: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
href: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
icon: {
|
||||
type: String
|
||||
type: String,
|
||||
},
|
||||
blanked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import type { UsesItem } from '#components'
|
||||
defineProps({
|
||||
item: {
|
||||
type: Object as PropType<typeof UsesItem>,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const { locale } = useI18n()
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
<script lang="ts" setup>
|
||||
defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-8">
|
||||
<UDivider
|
||||
@@ -9,12 +18,3 @@
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script lang="ts" setup>
|
||||
const { locale } = useI18n()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="!max-w-none prose dark:prose-invert">
|
||||
<ContentDoc :path="`/home/${locale}`" />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const { locale } = useI18n()
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: 'Things I use',
|
||||
description: t('description')
|
||||
description: t('description'),
|
||||
})
|
||||
|
||||
const { data: items } = await useAsyncData('uses', () => queryContent('/uses').find()
|
||||
const { data: items } = await useAsyncData('uses', () => queryContent('/uses').find(),
|
||||
)
|
||||
|
||||
const hardware = items.value!.filter(item => item.category === 'hardware')
|
||||
|
||||
@@ -3,33 +3,33 @@ const route = useRoute()
|
||||
const { data: post } = await useAsyncData(`writing:${route.params.slug}`, () => queryContent(`/writings/${route.params.slug}`).findOne())
|
||||
const {
|
||||
data: postDB,
|
||||
refresh
|
||||
refresh,
|
||||
} = await useAsyncData(`writing:${route.params.slug}:db`, () => $fetch(`/api/posts/${route.params.slug}`, { method: 'POST' }))
|
||||
|
||||
const { locale, locales } = useI18n()
|
||||
const currentLocale = computed(() => locales.value.filter(l => l.code === locale.value)[0])
|
||||
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
|
||||
function top() {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: 'smooth'
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
|
||||
const { copy, copied } = useClipboard({
|
||||
source: `https://arthurdanjou.fr/writings/${route.params.slug}`,
|
||||
copiedDuring: 4000
|
||||
copiedDuring: 4000,
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: post.value?.title,
|
||||
description: post.value?.description,
|
||||
author: 'Arthur Danjou'
|
||||
author: 'Arthur Danjou',
|
||||
})
|
||||
|
||||
function getDetails() {
|
||||
@@ -43,11 +43,12 @@ function getDetails() {
|
||||
}
|
||||
|
||||
const likeCookie = useCookie<boolean>(`post:like:${route.params.slug}`, {
|
||||
maxAge: 7200
|
||||
maxAge: 7200,
|
||||
})
|
||||
|
||||
async function handleLike() {
|
||||
if (likeCookie.value) return
|
||||
if (likeCookie.value)
|
||||
return
|
||||
await $fetch(`/api/posts/like/${route.params.slug}`, { method: 'PUT' })
|
||||
await refresh()
|
||||
likeCookie.value = true
|
||||
@@ -133,7 +134,7 @@ async function handleLike() {
|
||||
<div class="flex gap-4 items-center flex-wrap">
|
||||
<UButton
|
||||
:label="postDB?.likes > 1 ? `${postDB?.likes} likes` : `${postDB?.likes} like`"
|
||||
:color="likeCookie ? 'red': 'white'"
|
||||
:color="likeCookie ? 'red' : 'white'"
|
||||
icon="i-ph-heart-duotone"
|
||||
size="lg"
|
||||
variant="solid"
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
const { t, locale } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
useSeoMeta({
|
||||
title: 'My Shelf',
|
||||
description: t('description')
|
||||
description: t('description'),
|
||||
})
|
||||
|
||||
const { data: writings } = await useAsyncData('all-writings', () =>
|
||||
queryContent('/writings').sort({ published: -1 }).without('body').find()
|
||||
)
|
||||
queryContent('/writings').sort({ published: -1 }).without('body').find())
|
||||
|
||||
const { data: writingsDB } = await useAsyncData('all-writings-db', () =>
|
||||
$fetch(`/api/posts`)
|
||||
)
|
||||
$fetch(`/api/posts`))
|
||||
|
||||
function getDetails(slug: string) {
|
||||
const writing = writingsDB.value!.find(writing => writing.slug === slug)
|
||||
if (!writing) return ''
|
||||
if (!writing)
|
||||
return ''
|
||||
|
||||
const like = writing.likes! > 1 ? t('likes.many') : t('likes.one')
|
||||
const view = writing.views! > 1 ? t('views.many') : t('views.one')
|
||||
|
||||
Reference in New Issue
Block a user