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

2267
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@onwidget/astrowind", "name": "@onwidget/astrowind",
"version": "1.0.0-beta.40", "version": "1.0.0-beta.41",
"description": "AstroWind: A free template using Astro 4.0 and Tailwind CSS. Astro starter theme.", "description": "AstroWind: A free template using Astro 4.0 and Tailwind CSS. Astro starter theme.",
"type": "module", "type": "module",
"private": true, "private": true,
@@ -40,13 +40,13 @@
"@types/eslint__js": "^8.42.3", "@types/eslint__js": "^8.42.3",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",
"@types/lodash.merge": "^4.6.9", "@types/lodash.merge": "^4.6.9",
"@typescript-eslint/eslint-plugin": "^7.16.1", "@types/mdx": "^2.0.13",
"@typescript-eslint/parser": "^7.16.1", "@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"astro-compress": "2.3.1", "astro-compress": "2.3.1",
"astro-eslint-parser": "^1.0.2", "astro-eslint-parser": "^1.0.2",
"eslint": "8.57.0", "eslint": "^9.9.1",
"eslint-plugin-astro": "^1.2.3", "eslint-plugin-astro": "^1.2.3",
"eslint-plugin-jsx-a11y": "^6.9.0",
"globals": "^15.9.0", "globals": "^15.9.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"mdast-util-to-string": "^4.0.0", "mdast-util-to-string": "^4.0.0",
@@ -58,6 +58,6 @@
"tailwind-merge": "^2.5.2", "tailwind-merge": "^2.5.2",
"tailwindcss": "^3.4.10", "tailwindcss": "^3.4.10",
"typescript": "^5.5.4", "typescript": "^5.5.4",
"typescript-eslint": "^7.16.1" "typescript-eslint": "^8.2.0"
} }
} }

View File

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

View File

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

View File

@@ -1,7 +1,6 @@
--- ---
import Image from '~/components/common/Image.astro'; import Image from '~/components/common/Image.astro';
import Button from '~/components/ui/Button.astro'; import Button from '~/components/ui/Button.astro';
import Background from '~/components/ui/Background.astro';
import type { Hero as Props } from '~/types'; 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 posts = await fetchPosts();
const categories = {}; const categories = {};
posts.map((post) => { 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) => return Array.from(Object.keys(categories)).flatMap((categorySlug) =>
@@ -222,10 +224,11 @@ export const getStaticPathsBlogTag = async ({ paginate }: { paginate: PaginateFu
const posts = await fetchPosts(); const posts = await fetchPosts();
const tags = {}; const tags = {};
posts.map((post) => { posts.map((post) => {
Array.isArray(post.tags) && if (Array.isArray(post.tags)) {
post.tags.map((tag) => { post.tags.map((tag) => {
tags[tag?.slug] = tag; tags[tag?.slug] = tag;
}); });
}
}); });
return Array.from(Object.keys(tags)).flatMap((tagSlug) => 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'; type Layout = 'fixed' | 'constrained' | 'fullWidth' | 'cover' | 'responsive' | 'contained';
export interface AttributesProps extends HTMLAttributes<'img'> {}
export interface ImageProps extends Omit<HTMLAttributes<'img'>, 'src'> { export interface ImageProps extends Omit<HTMLAttributes<'img'>, 'src'> {
src?: string | ImageMetadata | null; src?: string | ImageMetadata | null;
width?: string | number | null; width?: string | number | null;
@@ -263,7 +261,7 @@ export async function getImagesOptimized(
image: ImageMetadata | string, image: ImageMetadata | string,
{ src: _, width, height, sizes, aspectRatio, widths, layout = 'constrained', style = '', ...rest }: ImageProps, { src: _, width, height, sizes, aspectRatio, widths, layout = 'constrained', style = '', ...rest }: ImageProps,
transform: ImagesOptimizer = () => Promise.resolve([]) transform: ImagesOptimizer = () => Promise.resolve([])
): Promise<{ src: string; attributes: AttributesProps }> { ): Promise<{ src: string; attributes: HTMLAttributes<'img'> }> {
if (typeof image !== 'string') { if (typeof image !== 'string') {
width ||= Number(image.width) || undefined; width ||= Number(image.width) || undefined;
height ||= typeof width === 'number' ? computeHeight(width, image.width / image.height) : 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; let images: Record<string, () => Promise<unknown>> | undefined = undefined;
try { try {
images = import.meta.glob('~/assets/images/**/*.{jpeg,jpg,png,tiff,webp,gif,svg,JPEG,JPG,PNG,TIFF,WEBP,GIF,SVG}'); 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 // continue regardless of error
} }
return images; return images;

View File

@@ -105,7 +105,8 @@ export default ({ config: _themeConfig = 'src/config.yaml' } = {}) => {
}); });
} }
} }
} catch (err) { // eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
/* empty */ /* empty */
} }
}, },

View File

@@ -78,7 +78,9 @@ export interface AnalyticsConfig {
}; };
} }
export interface UIConfig {} export interface UIConfig {
theme: string;
}
const DEFAULT_SITE_NAME = 'Website'; const DEFAULT_SITE_NAME = 'Website';