Better eslint configuration and format some files
This commit is contained in:
@@ -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;
|
||||
|
@@ -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 } : {}) };
|
||||
};
|
||||
};
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user