Linted code

This commit is contained in:
2025-07-29 15:24:29 +00:00
parent 8b4e8553a4
commit 4ab0dad6a0
11 changed files with 57 additions and 53 deletions

View File

@@ -3,7 +3,7 @@ on: push
jobs: jobs:
deploy: deploy:
name: "Deploy to NuxtHub" name: Deploy to NuxtHub
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: environment:
name: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }} name: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
@@ -22,7 +22,7 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: 'pnpm' cache: pnpm
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install
@@ -32,4 +32,4 @@ jobs:
- name: Deploy to NuxtHub - name: Deploy to NuxtHub
uses: nuxt-hub/action@v1 uses: nuxt-hub/action@v1
id: deploy id: deploy

View File

@@ -1,12 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import { navColors, type NavColor } from '~~/types' import type { NavColor } from '~~/types'
import { navColors } from '~~/types'
const route = useRoute() const route = useRoute()
const colorMode = useColorMode() const colorMode = useColorMode()
const colors = computed((): NavColor[] => { const colors = computed((): NavColor[] => {
const navColor = navColors.find(nav => route.name === nav.name) const navColor = navColors.find(nav => route.name === nav.name)
if (navColor?.colors) return navColor.colors if (navColor?.colors)
return navColor.colors
const fallbackColor = colorMode.value === 'dark' ? '#000000' : '#ffffff' const fallbackColor = colorMode.value === 'dark' ? '#000000' : '#ffffff'
const fallbackGradient = { color: fallbackColor, x: 0, y: 0, radius: 0 } const fallbackGradient = { color: fallbackColor, x: 0, y: 0, radius: 0 }
@@ -15,14 +17,14 @@ const colors = computed((): NavColor[] => {
const backgroundStyle = computed(() => { const backgroundStyle = computed(() => {
const gradients = colors.value const gradients = colors.value
.map(({ color, radius, x, y }) => .map(({ color, radius, x, y }) =>
`radial-gradient(circle ${radius}px at ${x}% ${y}%, ${color}4D, transparent)` `radial-gradient(circle ${radius}px at ${x}% ${y}%, ${color}4D, transparent)`,
) )
.join(', ') .join(', ')
return { return {
backgroundImage: gradients, backgroundImage: gradients,
backgroundSize: Array(colors.value.length).fill('100% 100%').join(', ') backgroundSize: Array.from({ length: colors.value.length }).fill('100% 100%').join(', '),
} }
}) })
</script> </script>

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
defineProps({ defineProps({
title: { title: {
type: Object as PropType<{ en: string; fr: string; es: string }>, type: Object as PropType<{ en: string, fr: string, es: string }>,
required: true, required: true,
}, },
}) })

View File

@@ -93,9 +93,9 @@ const { copy, copied } = useClipboard({
/> />
<ClientOnly> <ClientOnly>
<ContentRenderer <ContentRenderer
:value="project" :value="project"
class="!max-w-none prose dark:prose-invert" class="!max-w-none prose dark:prose-invert"
/> />
</ClientOnly> </ClientOnly>
<div class="space-y-4 mt-8"> <div class="space-y-4 mt-8">
<PostFooter /> <PostFooter />

View File

@@ -159,9 +159,9 @@ function scrollToSection(id: string) {
<article class="mt-8"> <article class="mt-8">
<ClientOnly> <ClientOnly>
<ContentRenderer <ContentRenderer
:value="post" :value="post"
class="!max-w-none prose dark:prose-invert" class="!max-w-none prose dark:prose-invert"
/> />
</ClientOnly> </ClientOnly>
<div class="space-y-4 mt-8"> <div class="space-y-4 mt-8">
<PostFooter /> <PostFooter />

View File

@@ -6,4 +6,4 @@
"es": "Utilizo mi Beelink como primer servidor de mi homelab, con Proxmox, para alojar servicios autogestionados, ejecutar contenedores Docker y probar herramientas de código abierto." "es": "Utilizo mi Beelink como primer servidor de mi homelab, con Proxmox, para alojar servicios autogestionados, ejecutar contenedores Docker y probar herramientas de código abierto."
}, },
"category": "homelab" "category": "homelab"
} }

View File

@@ -6,4 +6,4 @@
"es": "Utilizo mi switch TP-Link de 5 puertos para conectar mis distintos dispositivos de red a mi servidor principal y garantizar una comunicación local rápida y estable." "es": "Utilizo mi switch TP-Link de 5 puertos para conectar mis distintos dispositivos de red a mi servidor principal y garantizar una comunicación local rápida y estable."
}, },
"category": "homelab" "category": "homelab"
} }

View File

@@ -6,4 +6,4 @@
"es": "Uptime Kuma, Beszel, Traefik, Cloudflare, MySpeed, AdGuard Home, Portainer, Home Assistant, Minio, Immich, Vaultwarden, Tailscale, Palmr y Cap.so" "es": "Uptime Kuma, Beszel, Traefik, Cloudflare, MySpeed, AdGuard Home, Portainer, Home Assistant, Minio, Immich, Vaultwarden, Tailscale, Palmr y Cap.so"
}, },
"category": "homelab" "category": "homelab"
} }

View File

@@ -6,4 +6,4 @@
"es": "Diseñado para la flexibilidad y el rendimiento, Visual Studio Code es mi entorno de desarrollo principal. Ligero pero potente, admite Python, JavaScript, TypeScript, SQL y mucho más. Aprovecho sus extensiones e integraciones con IA para programar más rápido, mejor y con un control total de mi entorno." "es": "Diseñado para la flexibilidad y el rendimiento, Visual Studio Code es mi entorno de desarrollo principal. Ligero pero potente, admite Python, JavaScript, TypeScript, SQL y mucho más. Aprovecho sus extensiones e integraciones con IA para programar más rápido, mejor y con un control total de mi entorno."
}, },
"category": "ide" "category": "ide"
} }

View File

@@ -1,20 +1,4 @@
import { H3Event } from 'h3' import type { H3Event } from 'h3'
export default defineEventHandler(async (event) => {
const [coding, editors, os, languages] = await Promise.all([
cachedWakatimeCoding(event),
cachedWakatimeEditors(event),
cachedWakatimeOs(event),
cachedWakatimeLanguages(event)
])
return {
coding,
editors,
os,
languages
}
})
const cachedWakatimeCoding = defineCachedFunction(async (event: H3Event) => { const cachedWakatimeCoding = defineCachedFunction(async (event: H3Event) => {
const config = useRuntimeConfig(event) const config = useRuntimeConfig(event)
@@ -23,7 +7,7 @@ const cachedWakatimeCoding = defineCachedFunction(async (event: H3Event) => {
}, { }, {
maxAge: 24 * 60 * 60, maxAge: 24 * 60 * 60,
name: 'wakatime', name: 'wakatime',
getKey: () => 'coding' getKey: () => 'coding',
}) })
const cachedWakatimeEditors = defineCachedFunction(async (event: H3Event) => { const cachedWakatimeEditors = defineCachedFunction(async (event: H3Event) => {
@@ -33,7 +17,7 @@ const cachedWakatimeEditors = defineCachedFunction(async (event: H3Event) => {
}, { }, {
maxAge: 24 * 60 * 60, maxAge: 24 * 60 * 60,
name: 'wakatime', name: 'wakatime',
getKey: () => 'editors' getKey: () => 'editors',
}) })
const cachedWakatimeOs = defineCachedFunction(async (event: H3Event) => { const cachedWakatimeOs = defineCachedFunction(async (event: H3Event) => {
@@ -43,7 +27,7 @@ const cachedWakatimeOs = defineCachedFunction(async (event: H3Event) => {
}, { }, {
maxAge: 24 * 60 * 60, maxAge: 24 * 60 * 60,
name: 'wakatime', name: 'wakatime',
getKey: () => 'os' getKey: () => 'os',
}) })
const cachedWakatimeLanguages = defineCachedFunction(async (event: H3Event) => { const cachedWakatimeLanguages = defineCachedFunction(async (event: H3Event) => {
@@ -53,5 +37,21 @@ const cachedWakatimeLanguages = defineCachedFunction(async (event: H3Event) => {
}, { }, {
maxAge: 24 * 60 * 60, maxAge: 24 * 60 * 60,
name: 'wakatime', name: 'wakatime',
getKey: () => 'languages' getKey: () => 'languages',
}) })
export default defineEventHandler(async (event) => {
const [coding, editors, os, languages] = await Promise.all([
cachedWakatimeCoding(event),
cachedWakatimeEditors(event),
cachedWakatimeOs(event),
cachedWakatimeLanguages(event),
])
return {
coding,
editors,
os,
languages,
}
})

View File

@@ -68,16 +68,18 @@ interface ActivityMessages {
invalid: string invalid: string
} }
const createTimeUnit = (singular: string, plural: string, pastSingular?: string, futureSingular?: string): TimeUnit => function createTimeUnit(singular: string, plural: string, pastSingular?: string, futureSingular?: string): TimeUnit {
(n: number, past = true) => { return (n: number, past = true) => {
if (n === 1) { if (n === 1) {
return past ? (pastSingular || `last ${singular}`) : (futureSingular || `next ${singular}`) return past ? (pastSingular || `last ${singular}`) : (futureSingular || `next ${singular}`)
} }
return `${n} ${plural}` return `${n} ${plural}`
} }
}
const createSimpleTimeUnit = (unit: string): TimeUnit => function createSimpleTimeUnit(unit: string): TimeUnit {
(n: number) => `${n} ${unit}${n > 1 ? 's' : ''}` return (n: number) => `${n} ${unit}${n > 1 ? 's' : ''}`
}
export const activityMessages: Record<'en' | 'fr' | 'es', ActivityMessages> = { export const activityMessages: Record<'en' | 'fr' | 'es', ActivityMessages> = {
en: { en: {
@@ -94,11 +96,11 @@ export const activityMessages: Record<'en' | 'fr' | 'es', ActivityMessages> = {
invalid: '', invalid: '',
}, },
fr: { fr: {
justNow: "à l'instant", justNow: 'à l\'instant',
past: (n: string) => n.match(/\d/) ? `il y a ${n}` : n, past: (n: string) => n.match(/\d/) ? `il y a ${n}` : n,
future: (n: string) => n.match(/\d/) ? `dans ${n}` : n, future: (n: string) => n.match(/\d/) ? `dans ${n}` : n,
month: (n: number, past = true) => n === 1 ? (past ? 'le mois dernier' : 'le mois prochain') : `${n} mois`, month: (n: number, past = true) => n === 1 ? (past ? 'le mois dernier' : 'le mois prochain') : `${n} mois`,
year: (n: number, past = true) => n === 1 ? (past ? "l'année dernière" : "l'année prochaine") : `${n} ans`, year: (n: number, past = true) => n === 1 ? (past ? 'l\'année dernière' : 'l\'année prochaine') : `${n} ans`,
day: (n: number, past = true) => n === 1 ? (past ? 'hier' : 'demain') : `${n} jours`, day: (n: number, past = true) => n === 1 ? (past ? 'hier' : 'demain') : `${n} jours`,
week: (n: number, past = true) => n === 1 ? (past ? 'la semaine dernière' : 'la semaine prochaine') : `${n} semaines`, week: (n: number, past = true) => n === 1 ? (past ? 'la semaine dernière' : 'la semaine prochaine') : `${n} semaines`,
hour: createSimpleTimeUnit('heure'), hour: createSimpleTimeUnit('heure'),
@@ -169,11 +171,11 @@ export const navs: readonly Nav[] = [
{ label: { en: 'uses', fr: 'usages', es: 'usos' }, to: '/uses', icon: 'backpack-duotone' }, { label: { en: 'uses', fr: 'usages', es: 'usos' }, to: '/uses', icon: 'backpack-duotone' },
{ label: { en: 'writings', fr: 'écrits', es: 'escritos' }, to: '/writings', icon: 'books-duotone' }, { label: { en: 'writings', fr: 'écrits', es: 'escritos' }, to: '/writings', icon: 'books-duotone' },
{ label: { en: 'projects', fr: 'projets', es: 'proyectos' }, to: '/projects', icon: 'code-duotone' }, { label: { en: 'projects', fr: 'projets', es: 'proyectos' }, to: '/projects', icon: 'code-duotone' },
{ {
label: { en: 'resume', fr: 'cv', es: 'currículum' }, label: { en: 'resume', fr: 'cv', es: 'currículum' },
icon: 'address-book-duotone', icon: 'address-book-duotone',
to: 'https://files.arthurdanjou.fr/s/resume', to: 'https://files.arthurdanjou.fr/s/resume',
target: '_blank' target: '_blank',
}, },
] as const ] as const