🎨 Fix lint errors using Biome
This commit is contained in:
@ -16,7 +16,10 @@ interface Props {
|
|||||||
const { project } = Astro.props
|
const { project } = Astro.props
|
||||||
|
|
||||||
const entry = await getEntry("projects", project)
|
const entry = await getEntry("projects", project)
|
||||||
const { Content } = await render(entry!)
|
if (!entry) {
|
||||||
|
throw new Error("Project not found")
|
||||||
|
}
|
||||||
|
const { Content } = await render(entry)
|
||||||
const {
|
const {
|
||||||
lang,
|
lang,
|
||||||
title,
|
title,
|
||||||
@ -28,7 +31,7 @@ const {
|
|||||||
source,
|
source,
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
} = entry!.data
|
} = entry.data
|
||||||
|
|
||||||
function localeDateString(isoString: string): string {
|
function localeDateString(isoString: string): string {
|
||||||
let template = "DD-MM-YYYY"
|
let template = "DD-MM-YYYY"
|
||||||
|
@ -52,9 +52,8 @@ export function localizePathname(
|
|||||||
const rest = pathnameParts.slice(2)
|
const rest = pathnameParts.slice(2)
|
||||||
if (rest.length > 0) {
|
if (rest.length > 0) {
|
||||||
return `${localizedPathname}/${rest.join("/")}`
|
return `${localizedPathname}/${rest.join("/")}`
|
||||||
} else {
|
|
||||||
return localizedPathname
|
|
||||||
}
|
}
|
||||||
|
return localizedPathname
|
||||||
}
|
}
|
||||||
return pathname
|
return pathname
|
||||||
}
|
}
|
||||||
@ -71,13 +70,14 @@ export function isAbsolutePathname(path: string): path is AbsolutePathname {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isNavLink(path: string): path is NavLink {
|
export function isNavLink(path: string): path is NavLink {
|
||||||
|
let basePath = path
|
||||||
if (path.startsWith("/en")) {
|
if (path.startsWith("/en")) {
|
||||||
path = path.slice(2)
|
basePath = path.slice(2)
|
||||||
}
|
}
|
||||||
if (paths.has(path as NavLink)) {
|
if (paths.has(basePath as NavLink)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
const pathSplit = path.split("/").slice(1)
|
const pathSplit = basePath.split("/").slice(1)
|
||||||
return (
|
return (
|
||||||
pathSplit.length === 2 &&
|
pathSplit.length === 2 &&
|
||||||
pathSplit[0] === "projects" &&
|
pathSplit[0] === "projects" &&
|
||||||
|
Reference in New Issue
Block a user