Skip to content

Commit

Permalink
format and lint using biomejs
Browse files Browse the repository at this point in the history
  • Loading branch information
JLex11 committed Aug 5, 2024
1 parent 517b715 commit 01c7307
Show file tree
Hide file tree
Showing 32 changed files with 744 additions and 755 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"**/.vscode": true,
"**/logs": true,
"**/node_modules": false
}
},
"editor.defaultFormatter": "biomejs.biome"
}
37 changes: 37 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"useImportType": {
"level": "warn",
"fix": "none"
}
},
"complexity": {
"noUselessTypeConstraint": {
"level": "warn",
"fix": "none"
}
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingCommas": "es5",
"arrowParentheses": "asNeeded",
"bracketSpacing": true,
"jsxQuoteStyle": "single",
"quoteProperties": "asNeeded",
"lineWidth": 120,
"indentWidth": 2
}
}
}
Binary file modified bun.lockb
Binary file not shown.
83 changes: 40 additions & 43 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,49 @@
const IMAGE_DAYS_CACHE = 30

const images = {
minimumCacheTTL: IMAGE_DAYS_CACHE * 24 * 60 * 60,
remotePatterns: [
{
protocol: 'https',
hostname: 'anime-scrapper-alpha.vercel.app',
port: '',
pathname: '/api/image/**'
},
{
protocol: 'http',
hostname: 'anime-scrapper-alpha.vercel.app',
port: '',
pathname: '/api/image/**'
},
{
protocol: 'http',
hostname: 'anime-scrapper-2rl4-dev.fl0.io',
port: '',
pathname: '/api/image/**'
},
{
protocol: 'https',
hostname: 'anime-scrapper-2rl4-dev.fl0.io',
port: '',
pathname: '/api/image/**'
},
{
protocol: 'https',
hostname: 'anime-scrapper-3c3n.onrender.com',
port: '',
pathname: '/api/image/**'
},
{
protocol: 'http',
hostname: 'anime-scrapper-3c3n.onrender.com',
port: '',
pathname: '/api/image/**'
}
]
minimumCacheTTL: IMAGE_DAYS_CACHE * 24 * 60 * 60,
remotePatterns: [
{
protocol: 'https',
hostname: 'anime-scrapper-alpha.vercel.app',
port: '',
pathname: '/api/image/**',
},
{
protocol: 'http',
hostname: 'anime-scrapper-alpha.vercel.app',
port: '',
pathname: '/api/image/**',
},
{
protocol: 'http',
hostname: 'anime-scrapper-2rl4-dev.fl0.io',
port: '',
pathname: '/api/image/**',
},
{
protocol: 'https',
hostname: 'anime-scrapper-2rl4-dev.fl0.io',
port: '',
pathname: '/api/image/**',
},
{
protocol: 'https',
hostname: 'anime-scrapper-3c3n.onrender.com',
port: '',
pathname: '/api/image/**',
},
{
protocol: 'http',
hostname: 'anime-scrapper-3c3n.onrender.com',
port: '',
pathname: '/api/image/**',
},
],
}

const nextConfig = {
images
/* experimental: {
ppr: true,
}, */
images,
}

module.exports = nextConfig
72 changes: 37 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
{
"name": "n-anime-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbo",
"tscheck": "tsc --noEmit",
"build": "next build",
"start": "next start",
"lint": "next lint",
"format:fix": "prettier --write --ignore-path .gitignore .",
"preview": "next build && next start"
},
"dependencies": {
"@algolia/autocomplete-core": "1.17.0",
"clsx": "2.1.1",
"next": "^14.2.2",
"next-view-transitions": "^0.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hotkeys-hook": "4.5.0",
"sharp": "^0.33.1"
},
"devDependencies": {
"@locator/babel-jsx": "^0.4.3",
"@types/node": "20.12.7",
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
"eslint": "8.57.0",
"eslint-config-next": "^14.1.4",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.2.5",
"prettier-plugin-css-order": "^2.1.2",
"typescript": "5.4.5"
}
}
"name": "n-anime-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbo",
"tscheck": "tsc --noEmit",
"build": "next build",
"start": "next start",
"lint": "next lint",
"format:fix": "prettier --write --ignore-path .gitignore .",
"preview": "next build && next start"
},
"dependencies": {
"@algolia/autocomplete-core": "1.17.4",
"clsx": "2.1.1",
"cmdk": "^1.0.0",
"next": "^15.0.0-rc.0",
"next-view-transitions": "^0.3.0",
"react": "^19.0.0-rc-378b305958-20240710",
"react-dom": "^19.0.0-rc-378b305958-20240710",
"react-hotkeys-hook": "4.5.0",
"sharp": "0.33.1"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@locator/babel-jsx": "^0.4.3",
"@types/node": "22.1.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"eslint": "8.57.0",
"eslint-config-next": "^14.2.5",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.3",
"prettier-plugin-css-order": "^2.1.2",
"typescript": "5.5.3"
}
}
23 changes: 11 additions & 12 deletions src/app/animes/[animeId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { AnimeCarousel } from '@/components/AnimePage/AnimeCarousel'
import { AnimeMain } from '@/components/AnimePage/AnimeMain'
import { Metadata } from 'next'
import { PageProps, generateMetadataFromAnimeId, generatePageStaticParams } from './pageMisc'
import type { Metadata } from 'next'
import { generateMetadataFromAnimeId, generatePageStaticParams, type PageProps } from './pageMisc'

export default async function AnimePage({ params, searchParams }: PageProps) {
const { animeId } = params
const { limit } = searchParams
export default async function AnimePage({ params }: PageProps) {
const { animeId } = params

return (
<>
<AnimeCarousel animeId={animeId} />
<AnimeMain animeId={animeId} limit={limit} />
</>
)
return (
<>
<AnimeCarousel animeId={animeId} />
<AnimeMain animeId={animeId} />
</>
)
}

export const generateMetadata = ({ params }: PageProps): Promise<Metadata> =>
generateMetadataFromAnimeId(params.animeId)
generateMetadataFromAnimeId(params.animeId)
export const generateStaticParams = generatePageStaticParams
52 changes: 23 additions & 29 deletions src/app/animes/[animeId]/pageMisc.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,39 @@
import { getAnime } from '@/services/getAnime'
import { getBroadcastAnimes } from '@/services/getBroadcastAnimes'
import { getRatingAnimes } from '@/services/getRatingAnimes'
import { Anime } from '@/types'
import type { Anime } from '@/types'
import { normalizeAnimeId } from '@/utils/normalizeAnimeId'
import { Metadata } from 'next'
import type { Metadata } from 'next'

export interface PageProps {
params: { animeId: string }
searchParams: { limit: string }
params: { animeId: string }
}

export async function generateMetadataFromAnimeId(
animeId: PageProps['params']['animeId']
): Promise<Metadata> {
const anime = await getAnime(animeId)
if (!anime) return {}

return {
title: anime.title ?? normalizeAnimeId(animeId),
description: anime.description,
keywords: `${anime.genres.join(', ')} ${anime.title} ${anime.otherTitles.join(', ')}`
}
export async function generateMetadataFromAnimeId(animeId: PageProps['params']['animeId']): Promise<Metadata> {
const anime = await getAnime(animeId)
if (!anime) return {}

return {
title: anime.title ?? normalizeAnimeId(animeId),
description: anime.description,
keywords: `${anime.genres.join(', ')} ${anime.title} ${anime.otherTitles.join(', ')}`,
}
}

export async function generatePageStaticParams(): Promise<{ animeId: string }[]> {
const animesPromises = [getRatingAnimes(25), getBroadcastAnimes()]
const animesPromises = [getRatingAnimes(25), getBroadcastAnimes()]

const animesIdSettled = await Promise.allSettled(
animesPromises.map(animePromise =>
animePromise.then(anime => anime.map(({ animeId }) => animeId))
)
)
const animesIdSettled = await Promise.allSettled(
animesPromises.map(animePromise => animePromise.then(anime => anime.map(({ animeId }) => animeId)))
)

const filteredAnimesId = animesIdSettled.filter(
(animesId): animesId is PromiseFulfilledResult<Anime['animeId'][]> =>
animesId.status === 'fulfilled'
)
const filteredAnimesId = animesIdSettled.filter(
(animesId): animesId is PromiseFulfilledResult<Anime['animeId'][]> => animesId.status === 'fulfilled'
)

const mappedAnimesId = filteredAnimesId.flatMap(filteredAnimesId =>
filteredAnimesId.value.map(animeId => ({ animeId }))
)
const mappedAnimesId = filteredAnimesId.flatMap(filteredAnimesId =>
filteredAnimesId.value.map(animeId => ({ animeId }))
)

return mappedAnimesId
return mappedAnimesId
}
50 changes: 25 additions & 25 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@ import LocalFont from 'next/font/local'
import '../globals.css'

export const metadata = {
title: 'One Anime',
description:
'Descubre un mundo lleno de tus animes favoritos y sumérgete en la magia del entretenimiento en línea. En este lugar, podrás disfrutar de una amplia selección de series animadas japonesas que te transportarán a emocionantes aventuras, intrigantes historias y personajes inolvidables. Desde los clásicos más queridos hasta los lanzamientos más recientes, aquí encontrarás todo lo que necesitas para saciar tu pasión por el anime. No importa si eres un fanático de la acción, la comedia, el romance o la fantasía, nuestra plataforma te brinda la oportunidad de disfrutar de tus animes favoritos en cualquier momento y en cualquier lugar. ¡Únete a nuestra comunidad anime y déjate llevar por la emoción de este fascinante universo!',
icons: {
icon: '/Nika_Logo.svg',
apple: '/Nika_Logo.svg'
}
title: 'One Anime',
description:
'Descubre un mundo lleno de tus animes favoritos y sumérgete en la magia del entretenimiento en línea. En este lugar, podrás disfrutar de una amplia selección de series animadas japonesas que te transportarán a emocionantes aventuras, intrigantes historias y personajes inolvidables. Desde los clásicos más queridos hasta los lanzamientos más recientes, aquí encontrarás todo lo que necesitas para saciar tu pasión por el anime. No importa si eres un fanático de la acción, la comedia, el romance o la fantasía, nuestra plataforma te brinda la oportunidad de disfrutar de tus animes favoritos en cualquier momento y en cualquier lugar. ¡Únete a nuestra comunidad anime y déjate llevar por la emoción de este fascinante universo!',
icons: {
icon: '/Nika_Logo.svg',
apple: '/Nika_Logo.svg',
},
}

const montserratFont = Montserrat({
subsets: ['latin'],
variable: '--montserrat-font',
preload: true,
adjustFontFallback: true
subsets: ['latin'],
variable: '--montserrat-font',
preload: true,
adjustFontFallback: true,
})

const animeAceBBFont = LocalFont({
src: 'fonts/Anime Ace BB/animeace2_reg.woff2',
variable: '--anime-ace-bb-font',
preload: true
src: 'fonts/Anime Ace BB/animeace2_reg.woff2',
variable: '--anime-ace-bb-font',
preload: true,
})

interface Props {
children: React.ReactNode
children: React.ReactNode
}

export default function RootLayout({ children }: Props) {
return (
<ViewTransitions>
<html lang='es'>
<body className={clsx(montserratFont.className, animeAceBBFont.variable)}>
<Header />
{children}
</body>
</html>
</ViewTransitions>
)
return (
<ViewTransitions>
<html lang='es'>
<body className={clsx(montserratFont.className, animeAceBBFont.variable)}>
<Header />
{children}
</body>
</html>
</ViewTransitions>
)
}
Loading

0 comments on commit 01c7307

Please sign in to comment.