From d8bd20f370473a27e47e1032d6b46603e70112c0 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 12 Aug 2024 12:54:20 +0200 Subject: [PATCH] formatting fixes --- src/getRedirects.ts | 8 +++++--- src/index.ts | 2 +- test/redirects.test.ts | 4 +--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/getRedirects.ts b/src/getRedirects.ts index d62f6e7..5761a80 100644 --- a/src/getRedirects.ts +++ b/src/getRedirects.ts @@ -20,17 +20,19 @@ export async function getRedirects( const frontmatter = await getMarkdownFrontmatter(path.join(srcDir, file)) let redirectFrom: string[] = [] - if (frontmatter?.redirect_from){ + if (frontmatter?.redirect_from) { if (typeof frontmatter?.redirect_from === 'string') { redirectFrom = [frontmatter.redirect_from] } else if (Array.isArray(frontmatter?.redirect_from)) { redirectFrom = frontmatter.redirect_from } else { - logger.warn(`Unexpected type ${typeof frontmatter?.redirect_from} for redirect_from in file: ${file}`) + logger.warn( + `Unexpected type ${typeof frontmatter?.redirect_from} for redirect_from in file: ${file}` + ) } } - redirectFrom = redirectFrom.filter(redirect => { + redirectFrom = redirectFrom.filter((redirect) => { if (isValidDomainRelativePath(redirect)) { return true } diff --git a/src/index.ts b/src/index.ts index eaad926..4f713fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ -import path from 'node:path' import fs from 'node:fs' +import path from 'node:path' import type { AstroIntegration } from 'astro' import { getRedirects } from './getRedirects.js' import { getMarkdownFiles, getSlugFromFilePath, writeJson } from './utils.js' diff --git a/test/redirects.test.ts b/test/redirects.test.ts index c2e51f5..5350785 100644 --- a/test/redirects.test.ts +++ b/test/redirects.test.ts @@ -3,8 +3,6 @@ import { createRedirect } from '../src/createRedirect' import { getRedirects } from '../src/getRedirects' import { getMarkdownFiles, getSlugFromFilePath } from '../src/utils' - - describe('getRedirects', async () => { // handling this more as an integration test const srcDir = './test/__fixtures__/markdown' @@ -23,7 +21,7 @@ describe('getRedirects', async () => { '/hello-astro-old': '/hello-astroooooo', '/hello-astro-old-234837': '/hello-astroooooo', '/hello-world-old': '/posts/hello-world', - "/hello-once": "/posts/hello-once", + '/hello-once': '/posts/hello-once', '/hello-world-old-234837': '/posts/hello-world', '/hello-markdown-old': '/hello-markdown', '/hello-markdown-old-234837': '/hello-markdown'