Update eslint dependencies and fix eslint errors

This commit is contained in:
prototypa
2024-08-26 01:03:42 -04:00
parent a268583964
commit 0202552ab1
11 changed files with 516 additions and 1798 deletions

View File

@@ -16,8 +16,6 @@ interface Link {
icon?: string;
}
interface ActionLink extends CallToAction {}
interface MenuLink extends Link {
links?: Array<MenuLink>;
}
@@ -25,7 +23,7 @@ interface MenuLink extends Link {
export interface Props {
id?: string;
links?: Array<MenuLink>;
actions?: Array<ActionLink>;
actions?: Array<CallToAction>;
isSticky?: boolean;
isDark?: boolean;
isFullWidth?: boolean;

View File

@@ -1,7 +1,6 @@
---
import Image from '~/components/common/Image.astro';
import Button from '~/components/ui/Button.astro';
import Background from '~/components/ui/Background.astro';
import type { Hero as Props } from '~/types';

View File

@@ -1,7 +1,6 @@
---
import Image from '~/components/common/Image.astro';
import Button from '~/components/ui/Button.astro';
import Background from '~/components/ui/Background.astro';
import type { Hero as Props } from '~/types';

View File

@@ -200,7 +200,9 @@ export const getStaticPathsBlogCategory = async ({ paginate }: { paginate: Pagin
const posts = await fetchPosts();
const categories = {};
posts.map((post) => {
post.category?.slug && (categories[post.category?.slug] = post.category);
if (post.category?.slug) {
categories[post.category?.slug] = post.category;
}
});
return Array.from(Object.keys(categories)).flatMap((categorySlug) =>
@@ -222,10 +224,11 @@ export const getStaticPathsBlogTag = async ({ paginate }: { paginate: PaginateFu
const posts = await fetchPosts();
const tags = {};
posts.map((post) => {
Array.isArray(post.tags) &&
if (Array.isArray(post.tags)) {
post.tags.map((tag) => {
tags[tag?.slug] = tag;
});
}
});
return Array.from(Object.keys(tags)).flatMap((tagSlug) =>

View File

@@ -6,8 +6,6 @@ import type { HTMLAttributes } from 'astro/types';
type Layout = 'fixed' | 'constrained' | 'fullWidth' | 'cover' | 'responsive' | 'contained';
export interface AttributesProps extends HTMLAttributes<'img'> {}
export interface ImageProps extends Omit<HTMLAttributes<'img'>, 'src'> {
src?: string | ImageMetadata | null;
width?: string | number | null;
@@ -263,7 +261,7 @@ export async function getImagesOptimized(
image: ImageMetadata | string,
{ src: _, width, height, sizes, aspectRatio, widths, layout = 'constrained', style = '', ...rest }: ImageProps,
transform: ImagesOptimizer = () => Promise.resolve([])
): Promise<{ src: string; attributes: AttributesProps }> {
): Promise<{ src: string; attributes: HTMLAttributes<'img'> }> {
if (typeof image !== 'string') {
width ||= Number(image.width) || undefined;
height ||= typeof width === 'number' ? computeHeight(width, image.width / image.height) : undefined;

View File

@@ -6,7 +6,8 @@ const load = async function () {
let images: Record<string, () => Promise<unknown>> | undefined = undefined;
try {
images = import.meta.glob('~/assets/images/**/*.{jpeg,jpg,png,tiff,webp,gif,svg,JPEG,JPG,PNG,TIFF,WEBP,GIF,SVG}');
} catch (e) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
// continue regardless of error
}
return images;