fix: lint
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
kolaente 2024-09-22 17:37:11 +02:00
parent 404ec4f6b0
commit 29af22032e
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 30 additions and 19 deletions

View File

@ -1,6 +1,14 @@
---
// @ts-nocheck
import {marked} from 'marked'
import {generateConfigHeadingId} from '../helpers/configHeadingLink'
import {type ConfigItem, generateConfigHeadingId} from '../helpers/config'
interface Props {
item: ConfigItem
parent: string | undefined
level: number
}
const {item, parent = '', level = 0} = Astro.props
const fullPath = parent ? `${parent.replace('undefined', '0')}.${item.key}` : item.key

View File

@ -1,8 +1,10 @@
---
// @ts-nocheck
import ConfigOption from '../ConfigOption.astro'
import {type ConfigItem} from '../../helpers/config'
const response = await fetch('https://kolaente.dev/vikunja/vikunja/raw/branch/main/config-raw.json')
const data = await response.json()
const data: ConfigItem = await response.json()
---
<hr/>
{data.children.map(c => (<ConfigOption item={c}/><hr/>))}
{data.children?.map(c => (<ConfigOption item={c}/><hr/>))}

View File

@ -1,4 +1,4 @@
export function generateConfigHeadingId(level: number, parent: string, key: string): string {
export function generateConfigHeadingId(level: number, parent: string, key: string | undefined): string {
return [
level,
parent,
@ -6,21 +6,22 @@ export function generateConfigHeadingId(level: number, parent: string, key: stri
].join('-')
}
interface ConfigItem {
key?: string;
value?: string;
comment?: string;
children?: ConfigItem[];
export interface ConfigItem {
key?: string
value?: string
comment?: string
default_value?: string
children?: ConfigItem[]
}
interface ConfigHeadingEntr {
slug: string;
depth: number;
text: string;
interface ConfigHeadingEntry {
slug: string
depth: number
text: string
}
export function generateConfigHeadings(data: ConfigItem, parentSlug: string = '', depth: number = 0): ConfigHeadingEntr[] {
let result: ConfigHeadingEntr[] = []
export function generateConfigHeadings(data: ConfigItem, parentSlug: string = '', depth: number = 0): ConfigHeadingEntry[] {
let result: ConfigHeadingEntry[] = []
if (data.key) {
const slug = generateConfigHeadingId(depth, parentSlug, data.key)

View File

@ -1,7 +1,7 @@
---
import {type CollectionEntry, getCollection} from 'astro:content'
import Docs from '../../layouts/Docs.astro'
import {generateConfigHeadings} from '../../helpers/configHeadingLink'
import {type ConfigItem, generateConfigHeadings} from '../../helpers/config'
export async function getStaticPaths() {
const docs = await getCollection('docs')
@ -18,8 +18,8 @@ const post = Astro.props
const {Content, headings} = await post.render()
if (post.slug === 'config-options') {
const response = await fetch('https://kolaente.dev/vikunja/vikunja/raw/branch/main/config-raw.json')
const data = await response.json()
data.children.forEach(c => headings.push(...generateConfigHeadings(c)))
const data: ConfigItem = await response.json()
data.children?.forEach(c => headings.push(...generateConfigHeadings(c)))
}
---
<Docs headings={headings} {...post.data}>