Skip to content

Commit

Permalink
chore(prettier): 🤖 ✨ (#135)
Browse files Browse the repository at this point in the history
Co-authored-by: ecospark[bot] <128108030+ecospark[bot]@users.noreply.github.com>
  • Loading branch information
ecospark[bot] authored Jan 30, 2025
1 parent 7958747 commit 852bb3b
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 69 deletions.
5 changes: 1 addition & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>sanity-io/renovate-config:starter-template",
":reviewer(team:ecosystem)"
]
"extends": ["github>sanity-io/renovate-config:starter-template", ":reviewer(team:ecosystem)"]
}
14 changes: 6 additions & 8 deletions remix-app/app/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Link } from '@remix-run/react'
import type { EncodeDataAttributeCallback } from '@sanity/react-loader'
import { formatDate } from '~/utils/formatDate'
import { urlFor } from '~/sanity/image'
import type { Post } from '~/sanity/types'
import {Link} from '@remix-run/react'
import type {EncodeDataAttributeCallback} from '@sanity/react-loader'
import {formatDate} from '~/utils/formatDate'
import {urlFor} from '~/sanity/image'
import type {Post} from '~/sanity/types'

export default function Card({
post,
Expand Down Expand Up @@ -32,9 +32,7 @@ export default function Card({
<h3 className="card__title">{post.title}</h3>
</Link>
<p className="card__excerpt">{post.excerpt}</p>
{post._createdAt && (
<p className="card__date">{formatDate(post._createdAt)}</p>
)}
{post._createdAt && <p className="card__date">{formatDate(post._createdAt)}</p>}
</div>
</div>
)
Expand Down
8 changes: 4 additions & 4 deletions remix-app/app/components/LiveVisualEditing.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useLiveMode } from '@sanity/react-loader'
import { VisualEditing } from '@sanity/visual-editing/remix'
import {useLiveMode} from '@sanity/react-loader'
import {VisualEditing} from '@sanity/visual-editing/remix'

import { client } from '~/sanity/client'
import {client} from '~/sanity/client'

export default function LiveVisualEditing() {
// Enable live queries using the client configuration
useLiveMode({ client })
useLiveMode({client})

return <VisualEditing />
}
12 changes: 6 additions & 6 deletions remix-app/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type LinksFunction, json } from '@remix-run/node'
import {type LinksFunction, json} from '@remix-run/node'
import styles from './styles/index.css'
import {
Link,
Expand All @@ -10,7 +10,7 @@ import {
ScrollRestoration,
useLoaderData,
} from '@remix-run/react'
import { Suspense, lazy } from 'react'
import {Suspense, lazy} from 'react'

const LiveVisualEditing = lazy(() => import('~/components/LiveVisualEditing'))

Expand All @@ -27,9 +27,9 @@ export const loader = () => {

export const links: LinksFunction = () => {
return [
{ rel: 'stylesheet', href: styles },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.com' },
{rel: 'stylesheet', href: styles},
{rel: 'preconnect', href: 'https://fonts.googleapis.com'},
{rel: 'preconnect', href: 'https://fonts.gstatic.com'},
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;700&family=Inter:wght@500;700;800&family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap',
Expand All @@ -38,7 +38,7 @@ export const links: LinksFunction = () => {
}

export default function App() {
const { ENV } = useLoaderData<typeof loader>()
const {ENV} = useLoaderData<typeof loader>()

return (
<html lang="en">
Expand Down
26 changes: 10 additions & 16 deletions remix-app/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import { useLoaderData, type MetaFunction } from '@remix-run/react'
import { useQuery } from '@sanity/react-loader'
import {useLoaderData, type MetaFunction} from '@remix-run/react'
import {useQuery} from '@sanity/react-loader'
import Card from '~/components/Card'
import Welcome from '~/components/Welcome'
import { loadQuery } from '~/sanity/loader.server'
import { POSTS_QUERY } from '~/sanity/queries'
import { Post } from '~/sanity/types'
import {loadQuery} from '~/sanity/loader.server'
import {POSTS_QUERY} from '~/sanity/queries'
import {Post} from '~/sanity/types'

export const meta: MetaFunction = () => {
return [{ title: 'New Remix App' }]
return [{title: 'New Remix App'}]
}

export const loader = async () => {
const initial = await loadQuery<Post[]>(POSTS_QUERY)

return { initial, query: POSTS_QUERY, params: {} }
return {initial, query: POSTS_QUERY, params: {}}
}

export default function Index() {
const { initial, query, params } = useLoaderData<typeof loader>()
const { data, loading, error, encodeDataAttribute } = useQuery<
typeof initial.data
>(query, params, {
const {initial, query, params} = useLoaderData<typeof loader>()
const {data, loading, error, encodeDataAttribute} = useQuery<typeof initial.data>(query, params, {
// @ts-expect-error -- TODO fix the typing here
initial,
})
Expand All @@ -35,11 +33,7 @@ export default function Index() {
<section>
{data?.length ? (
data.map((post, i) => (
<Card
key={post._id}
post={post}
encodeDataAttribute={encodeDataAttribute.scope([i])}
/>
<Card key={post._id} post={post} encodeDataAttribute={encodeDataAttribute.scope([i])} />
))
) : (
<Welcome />
Expand Down
32 changes: 14 additions & 18 deletions remix-app/app/routes/post.$slug.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import { PortableText } from '@portabletext/react'
import { type LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { useQuery } from '@sanity/react-loader'
import { formatDate } from '~/utils/formatDate'
import { urlFor } from '~/sanity/image'
import { loadQuery } from '~/sanity/loader.server'
import { POST_QUERY } from '~/sanity/queries'
import { Post } from '~/sanity/types'
import {PortableText} from '@portabletext/react'
import {type LoaderFunctionArgs} from '@remix-run/node'
import {useLoaderData} from '@remix-run/react'
import {useQuery} from '@sanity/react-loader'
import {formatDate} from '~/utils/formatDate'
import {urlFor} from '~/sanity/image'
import {loadQuery} from '~/sanity/loader.server'
import {POST_QUERY} from '~/sanity/queries'
import {Post} from '~/sanity/types'

export const loader = async ({ params }: LoaderFunctionArgs) => {
export const loader = async ({params}: LoaderFunctionArgs) => {
const initial = await loadQuery<Post>(POST_QUERY, params)

return { initial, query: POST_QUERY, params }
return {initial, query: POST_QUERY, params}
}

export default function PostRoute() {
const { initial, query, params } = useLoaderData<typeof loader>()
const { data, loading, error, encodeDataAttribute } = useQuery<
typeof initial.data
>(query, params, {
const {initial, query, params} = useLoaderData<typeof loader>()
const {data, loading, error, encodeDataAttribute} = useQuery<typeof initial.data>(query, params, {
// @ts-expect-error -- TODO fix the typing here
initial,
})
Expand All @@ -44,9 +42,7 @@ export default function PostRoute() {
<div className="post__container">
<h1 className="post__title">{data?.title}</h1>
<p className="post__excerpt">{data?.excerpt}</p>
{data?._createdAt && (
<p className="post__date">{formatDate(data._createdAt)}</p>
)}
{data?._createdAt && <p className="post__date">{formatDate(data._createdAt)}</p>}
{data?.body && (
<div className="post__content">
<PortableText value={data.body} />
Expand Down
4 changes: 2 additions & 2 deletions remix-app/app/sanity/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createClient } from '@sanity/client/stega'
import { stegaEnabled, projectId, dataset, studioUrl } from './projectDetails'
import {createClient} from '@sanity/client/stega'
import {stegaEnabled, projectId, dataset, studioUrl} from './projectDetails'

// Do not import this into client-side components unless lazy-loaded
export const client = createClient({
Expand Down
6 changes: 3 additions & 3 deletions remix-app/app/sanity/image.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import imageUrlBuilder from '@sanity/image-url'
import type { Image } from '@sanity/types'
import type {Image} from '@sanity/types'

import { projectId, dataset } from '~/sanity/projectDetails'
import {projectId, dataset} from '~/sanity/projectDetails'

const builder = imageUrlBuilder({ projectId, dataset })
const builder = imageUrlBuilder({projectId, dataset})

export function urlFor(source: Image) {
return builder.image(source)
Expand Down
4 changes: 2 additions & 2 deletions remix-app/app/sanity/loader.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as queryStore from '@sanity/react-loader'
import { client } from '~/sanity/client'
import {client} from '~/sanity/client'

export const { loadQuery } = queryStore
export const {loadQuery} = queryStore

// We need to set the client used by `loadQuery` here, it only affects the server and ensures the browser bundle isn't bloated
queryStore.setServerClient(client)
3 changes: 1 addition & 2 deletions remix-app/app/sanity/projectDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ export const stegaEnabled = SANITY_STUDIO_STEGA_ENABLED === 'true'
if (!projectId) throw new Error('Missing SANITY_STUDIO_PROJECT_ID in .env')
if (!dataset) throw new Error('Missing SANITY_STUDIO_DATASET in .env')
if (!studioUrl) throw new Error('Missing SANITY_STUDIO_URL in .env')
if (!stegaEnabled)
throw new Error(`Missing SANITY_STUDIO_STEGA_ENABLED in .env`)
if (!stegaEnabled) throw new Error(`Missing SANITY_STUDIO_STEGA_ENABLED in .env`)
4 changes: 2 additions & 2 deletions remix-app/app/sanity/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PortableTextBlock } from '@portabletext/types'
import type { ImageAsset, Slug } from '@sanity/types'
import type {PortableTextBlock} from '@portabletext/types'
import type {ImageAsset, Slug} from '@sanity/types'

export interface Post {
_type: 'post'
Expand Down
4 changes: 2 additions & 2 deletions studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "studio",
"private": true,
"scripts": {
"build": "sanity build",
"dev": "sanity dev",
"start": "sanity start",
"build": "sanity build"
"start": "sanity start"
},
"dependencies": {
"@sanity/vision": "3.72.1",
Expand Down

0 comments on commit 852bb3b

Please sign in to comment.