Better eslint configuration and format some files

This commit is contained in:
prototypa
2023-08-22 22:52:01 -04:00
parent da8ef74b38
commit c1f36e9f79
10 changed files with 37 additions and 43 deletions

View File

@ -37,8 +37,8 @@ The styling mechanism consists of the following files (all paths are prefixed wi
header section. See next.
</DListItem>
<DListItem dt="layouts/Layout.astro">
This layout is used for all of the pages rendered by _AstroWind_. The contents of _tailwind.css_ and _CustomStyles.astro_ component,
described above, is injected into the html header.
This layout is used for all of the pages rendered by _AstroWind_. The contents of _tailwind.css_ and
_CustomStyles.astro_ component, described above, is injected into the html header.
</DListItem>
### Dark Mode

View File

@ -14,9 +14,9 @@ export const GET = async () => {
const posts = await fetchPosts();
const { body = "" } = await rss({
const { body = '' } = await rss({
title: `${SITE.name}s Blog`,
description: METADATA?.description || "",
description: METADATA?.description || '',
site: import.meta.env.SITE,
items: posts.map((post) => ({
@ -27,12 +27,12 @@ export const GET = async () => {
})),
trailingSlash: SITE.trailingSlash,
})
});
return new Response(body, {
status: 200,
headers: {
"Content-Type": "application/xml"
}
'Content-Type': 'application/xml',
},
});
};

View File

@ -20,7 +20,7 @@ export interface MetaDataConfig extends Omit<MetaData, 'title'> {
export interface I18NConfig {
language: string;
textDirection: string;
dateFormatter: unknown;
dateFormatter?: Intl.DateTimeFormat;
}
export interface AppBlogConfig {
isEnabled: boolean;

View File

@ -21,7 +21,9 @@ export const fetchLocalImages = async () => {
};
/** */
export const findImage = async (imagePath?: string | ImageMetadata | null): Promise<string | ImageMetadata | undefined | null> => {
export const findImage = async (
imagePath?: string | ImageMetadata | null
): Promise<string | ImageMetadata | undefined | null> => {
// Not string
if (typeof imagePath !== 'string') {
return imagePath;
@ -94,4 +96,4 @@ export const adaptOpenGraphImages = async (
);
return { ...openGraph, ...(adaptedImages ? { images: adaptedImages } : {}) };
};
};

View File

@ -1,6 +1,6 @@
import { I18N } from '~/utils/config';
const formatter =
const formatter: Intl.DateTimeFormat =
I18N?.dateFormatter ||
new Intl.DateTimeFormat('en', {
year: 'numeric',
@ -9,13 +9,7 @@ const formatter =
timeZone: 'UTC',
});
/* eslint-disable no-mixed-spaces-and-tabs */
export const getFormattedDate = (date: Date) =>
date
? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-ignore */
formatter.format(date)
: '';
export const getFormattedDate = (date: Date): string => (date ? formatter.format(date) : '');
export const trim = (str = '', ch?: string) => {
let start = 0,