Skip to content

Commit

Permalink
Fix eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
smrtrfszm committed Dec 27, 2023
1 parent 4993911 commit c79de7d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
12 changes: 2 additions & 10 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { A, useLocation, useNavigate } from '@solidjs/router'
import { FaSolidBars, FaSolidChevronDown, FaSolidMagnifyingGlass, FaSolidXmark } from 'solid-icons/fa'
import {
createContext,
createEffect,
createMemo,
createSignal,
ParentComponent,
Setter,
useContext,
VoidComponent,
} from 'solid-js'
import { createContext, createMemo, createSignal, ParentComponent, Setter, useContext, VoidComponent } from 'solid-js'
import styles from './Header.module.scss'
import Logo from './Logo'
import kretalogo from '/assets/icons/kreta.png'
Expand Down Expand Up @@ -56,6 +47,7 @@ const MenuItem: ParentComponent<{ href: string }> = (props) => {
const setLinks = useContext(DropdownContext)

if (setLinks !== undefined) {
// eslint-disable-next-line solid/reactivity
setLinks((links) => [...links, props.href])
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ImageViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ImageViewer: VoidComponent<ImageViewerProps> = (props) => {
})

createEffect(
on([() => props.images], (v, prevV) => {
on([() => props.images], () => {
elements.forEach((e) => observer.unobserve(e))
elements = Array.from(scroller!.querySelectorAll('figure'))
elements.forEach((e) => observer.observe(e))
Expand Down
12 changes: 6 additions & 6 deletions src/pages/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { createAsync, RouteSectionProps } from '@solidjs/router'
import { Meta } from '@solidjs/meta'
import { queryPostById } from '~/data/post.data'

// eslint-disable-next-line solid/no-destructure
const PostPage: Component<RouteSectionProps> = ({ params }) => {
const data = createAsync(() => queryPostById(params.id), {
deferStream: true,
})

const searchLink = () => `/search?author=${encodeURIComponent(data()!.author.id)}`
const images = () => data()?.images

return (
Expand All @@ -25,7 +25,7 @@ const PostPage: Component<RouteSectionProps> = ({ params }) => {
<Meta property="og:description" content={data()!.description} />
<Meta property="og:image" content={data()!.indexImage} />
<Show when={data()!.author}>
<Meta property="og:author" content={data()!.author.name} />
<Meta property="og:author" content={data()!.author!.name} />
</Show>
<Meta property="og:type" content="article" />
<Meta property="twitter:card" content="summary" />
Expand All @@ -38,11 +38,11 @@ const PostPage: Component<RouteSectionProps> = ({ params }) => {
<h1 class={styles.title}>{data()!.title}</h1>
<div class={styles.meta}>
<Show when={data()!.author}>
<Show when={data()!.author.image !== null}>
<img class={styles.authorImage} src={data()!.author.image!} alt={data()!.author.name} />
<Show when={data()!.author!.image !== null}>
<img class={styles.authorImage} src={data()!.author!.image!} alt={data()!.author!.name} />
</Show>
<a class={styles.author} href={searchLink()}>
{data()!.author.name}
<a class={styles.author} href={`/search?author=${encodeURIComponent(data()!.author!.id)}`}>
{data()!.author!.name}
</a>
<span class={styles.dot} aria-hidden="true">
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import Title from '~/components/Title'
import { querySearchPage } from '~/data/search.data'
import styles from './Search.module.scss'

// eslint-disable-next-line solid/no-destructure
export const SearchPageRedirect: Component<RouteSectionProps> = ({ params }) => {
const pathToNavigate = `/search?${encodeURIComponent(params.type)}=${encodeURIComponent(params.value)}`
return <Navigate href={pathToNavigate} />
}

// eslint-disable-next-line solid/no-destructure
const SearchPage: Component<RouteSectionProps> = ({ location }) => {
const data = createAsync(() => querySearchPage(location.query))

Expand Down

0 comments on commit c79de7d

Please sign in to comment.