From 4bcaf9703f6f01c30e40cc89c9bcdc720ce6cce6 Mon Sep 17 00:00:00 2001 From: Nick Wylynko Date: Tue, 11 Mar 2025 00:39:39 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20prettier=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/build-docs.test.ts | 42 +++++++++++++++++++------------------- scripts/build-docs.ts | 7 ++++--- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/scripts/build-docs.test.ts b/scripts/build-docs.test.ts index 84f5064731..aadbce5d83 100644 --- a/scripts/build-docs.test.ts +++ b/scripts/build-docs.test.ts @@ -137,33 +137,33 @@ Testing with a simple page.`, }) test('Warning on missing description in frontmatter', async () => { - // Create temp environment with minimal files array - const { tempDir, pathJoin } = await createTempFiles([ - { - path: './docs/manifest.json', - content: JSON.stringify({ - navigation: [[{ title: 'Simple Test', href: '/docs/simple-test' }]], - }), - }, - { - path: './docs/simple-test.mdx', - content: `--- + // Create temp environment with minimal files array + const { tempDir, pathJoin } = await createTempFiles([ + { + path: './docs/manifest.json', + content: JSON.stringify({ + navigation: [[{ title: 'Simple Test', href: '/docs/simple-test' }]], + }), + }, + { + path: './docs/simple-test.mdx', + content: `--- title: Simple Test --- # Simple Test Page Testing with a simple page.`, - }, - ]) - - const output = await build( - createConfig({ - ...baseConfig, - basePath: tempDir, - validSdks: ['nextjs', 'react'], - }), - ) + }, + ]) + + const output = await build( + createConfig({ + ...baseConfig, + basePath: tempDir, + validSdks: ['nextjs', 'react'], + }), + ) expect(output).toContain('warning Frontmatter should have a "description" property') }) diff --git a/scripts/build-docs.ts b/scripts/build-docs.ts index 2873f843a4..de6edb97e0 100644 --- a/scripts/build-docs.ts +++ b/scripts/build-docs.ts @@ -552,9 +552,10 @@ const parseInMarkdownFile = // @ts-expect-error - If the heading has a id in it, this will pick it up // eg # test {{ id: 'my-heading' }} // This is for remapping the hash to the custom id - const id = node?.children?.find((child) => child?.type === 'mdxTextExpression')?.data?.estree?.body?.find((child) => child?.type === 'ExpressionStatement')?.expression?.properties?.find((prop) => prop?.key?.name === 'id')?.value?.value as - | string - | undefined + const id = node?.children + ?.find((child) => child?.type === 'mdxTextExpression') + ?.data?.estree?.body?.find((child) => child?.type === 'ExpressionStatement') + ?.expression?.properties?.find((prop) => prop?.key?.name === 'id')?.value?.value as string | undefined if (id !== undefined) { headingsHashs.push(id)