Skip to content

Commit

Permalink
fix: add stricts eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomez committed Nov 25, 2023
1 parent dbbd76a commit a5fa24c
Show file tree
Hide file tree
Showing 64 changed files with 459 additions and 339 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"prisma:generate": "prisma generate"
},
"dependencies": {
"@aulasoftwarelibre/next-auth-firewall": "^1.0.1",
"@aulasoftwarelibre/next-auth-firewall": "^1.0.2",
"@auth/core": "^0.0.0-manual.e9863699",
"@auth/prisma-adapter": "^1.0.8",
"@heroicons/react": "^2.0.18",
Expand Down Expand Up @@ -76,6 +76,7 @@
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-sort": "^2.11.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unicorn": "^49.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
Expand Down Expand Up @@ -108,6 +109,7 @@
},
"extends": [
"next",
"plugin:unicorn/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:storybook/recommended"
Expand Down Expand Up @@ -146,14 +148,15 @@
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"neverthrow/must-use-result": "error",
"no-shadow": "off",
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error",
"sort/destructuring-properties": "error",
"sort/object-properties": "error",
"sort/type-properties": "error",
"unused-imports/no-unused-imports": "error",
"neverthrow/must-use-result": "error"
"unicorn/prefer-node-protocol": "off",
"unused-imports/no-unused-imports": "error"
}
}
}
2 changes: 1 addition & 1 deletion src/app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import AuthModal from '@/components/AuthModal/AuthModal'
import AuthModal from '@/components/auth-modal'

export default function RootLayout({
children,
Expand Down
9 changes: 5 additions & 4 deletions src/app/(auth)/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { Metadata } from 'next'
import { redirect } from 'next/navigation'
import React from 'react'

import AuthModalFooter from '@/components/AuthModal/AuthModalFooter'
import AuthModalHeader from '@/components/AuthModal/AuthModalHeader'
import SignInEmailForm from '@/components/SignInEmailForm/SignInEmailForm'
import AuthModalFooter from '@/components/auth-modal/auth-modal-footer'
import AuthModalHeader from '@/components/auth-modal/auth-modal-header'
import { auth } from '@/lib/auth/auth'

import SignInEmailForm from '../../../components/sign-in-email-form'

export const metadata: Metadata = {
description: 'Biblioteca del Aula de Software Libre',
title: 'Codex | Login',
title: 'Iniciar sesión | Codex',
}

export default async function Page() {
Expand Down
8 changes: 4 additions & 4 deletions src/app/(auth)/signout/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { Metadata } from 'next'
import { redirect } from 'next/navigation'
import React from 'react'

import AuthModalHeader from '@/components/AuthModal/AuthModalHeader'
import SignOutForm from '@/components/SignOutForm/SignOutForm'
import AuthModalHeader from '@/components/auth-modal/auth-modal-header'
import Index from '@/components/sign-out-form'
import { auth } from '@/lib/auth/auth'

export const metadata: Metadata = {
description: 'Biblioteca del Aula de Software Libre',
title: 'Codex | Cerrar sesión',
title: 'Cerrar sesión | Codex',
}

export default async function Page() {
Expand All @@ -21,7 +21,7 @@ export default async function Page() {
return (
<>
<AuthModalHeader title="Cerrar sesión en">
<SignOutForm />
<Index />
</AuthModalHeader>
</>
)
Expand Down
6 changes: 3 additions & 3 deletions src/app/(auth)/verify/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import Link from 'next/link'
import { redirect } from 'next/navigation'
import React from 'react'

import AuthModalFooter from '@/components/AuthModal/AuthModalFooter'
import AuthModalHeader from '@/components/AuthModal/AuthModalHeader'
import AuthModalFooter from '@/components/auth-modal/auth-modal-footer'
import AuthModalHeader from '@/components/auth-modal/auth-modal-header'
import { auth } from '@/lib/auth/auth'

export const metadata: Metadata = {
description: 'Biblioteca del Aula de Software Libre',
title: 'Codex | Verifica tu correo',
title: 'Verifica tu correo | Codex',
}

const WEBMAIL_URL = process.env.WEBMAIL_URL as string
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/mailer/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export async function POST(request: Request) {
)
}

const params: SendVerificationRequestParams = await request.json()
const parameters: SendVerificationRequestParams = await request.json()

await new SmtpClient(
process.env.MAILER_DSN as string,
).sendVerificationRequest(params)
).sendVerificationRequest(parameters)

return Response.json({ success: true })
}
23 changes: 17 additions & 6 deletions src/app/books/new/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import BookForm from '@/components/BookForm/BookForm'
import { createBook } from '@/core/book/infrastructure/actions'
import { Card, CardBody, CardHeader } from '@nextui-org/react'
import { Metadata } from 'next'

import BookForm from '@/components/book-form'

export const metadata: Metadata = {
description: 'Biblioteca del Aula de Software Libre',
title: 'Añadir un nuevo libro | Codex',
}

export default async function Page() {
return (
<main>
<h1>
<strong>Crear Nuevo Libro</strong>
</h1>
<BookForm create={createBook} />
<Card className="grid grid-cols-1 lg:grid-cols-3 xl:grid-cols-4 items-start p-4">
<CardHeader>
<h1 className="text-2xl font-extrabold">Añadir un nuevo libro</h1>
</CardHeader>
<CardBody className="col-span-1 lg:col-span-2 xl:col-span-3">
<BookForm />
</CardBody>
</Card>
</main>
)
}
6 changes: 3 additions & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import './globals.css'
import type { Metadata } from 'next'
import { Nunito } from 'next/font/google'

import Header from '@/components/Header/Header'
import { Providers } from '@/components/Providers/Providers'
import Header from '@/components/header'
import { Providers } from '@/components/providers'
import { findUser } from '@/core/user/infrastructure/actions'
import { auth } from '@/lib/auth/auth'

Expand All @@ -30,7 +30,7 @@ export default async function RootLayout({
>
<Providers>
<Header user={user} />
<div className="container mx-auto pt-5">{children}</div>
<div className="container mx-auto pt-4 px-4">{children}</div>
</Providers>
</body>
</html>
Expand Down
4 changes: 2 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BookGrid from '@/components/BookGrid/BookGrid'
import { findBooks } from '@/core/book/infrastructure/actions'
import BookGrid from '@/components/book-grid'
import { findBooks } from '@/core/book/infrastructure/actions/find-books'

export default async function Home() {
const books = await findBooks()
Expand Down
6 changes: 3 additions & 3 deletions src/app/settings/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { redirect } from 'next/navigation'

import EditProfileForm from '@/components/EditProfileForm/EditProfileForm'
import EditProfileForm from '@/components/edit-profile-form'
import { FindUserResponse } from '@/core/user/application/types'
import { findUser, updateUser } from '@/core/user/infrastructure/actions'
import { findUser } from '@/core/user/infrastructure/actions'
import { auth } from '@/lib/auth/auth'

export default async function Page() {
Expand All @@ -16,7 +16,7 @@ export default async function Page() {

return (
<>
<EditProfileForm user={user} update={updateUser} />
<EditProfileForm user={user} />
</>
)
}
19 changes: 0 additions & 19 deletions src/components/AuthModal/AuthModalFooter.tsx

This file was deleted.

80 changes: 0 additions & 80 deletions src/components/BookForm/BookForm.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/BookGrid/BookGrid.tsx

This file was deleted.

19 changes: 19 additions & 0 deletions src/components/auth-modal/auth-modal-footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { CardFooter } from '@nextui-org/react'
import React, { ReactNode } from 'react'

interface AuthModalFooterProperties {
children: ReactNode
}

function useController(properties: AuthModalFooterProperties) {
return { ...properties }
}

export default function AuthModalFooter(properties: AuthModalFooterProperties) {
const { children } = useController(properties)
return (
<CardFooter>
<p className="text-small text-center">{children}</p>
</CardFooter>
)
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { CardBody } from '@nextui-org/react'
import React, { ReactNode } from 'react'

interface AuthModalHeaderProps {
interface AuthModalHeaderProperties {
children: ReactNode
title: string
}

export default function AuthModalHeader(props: AuthModalHeaderProps) {
const { children, title } = { ...props }
export default function AuthModalHeader(properties: AuthModalHeaderProperties) {
const { children, title } = { ...properties }
return (
<CardBody className="flex-col gap-4">
<h1 className="text-2xl font-bold text-center">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { Card, CardHeader } from '@nextui-org/react'
import React, { ReactNode } from 'react'

import ThemeImage from '@/components/ThemeImage/ThemeImage'
import Index from '@/components/theme-image'

interface AuthModalProps {
interface AuthModalProperties {
children: ReactNode
}

export default function AuthModal(props: AuthModalProps) {
const { children } = { ...props }
export default function AuthModal(properties: AuthModalProperties) {
const { children } = { ...properties }
return (
<>
<div className="flex h-[calc(100vh-6rem)] items-center justify-center">
<Card className="max-w-[650px] w-[650px]">
<CardHeader>
<ThemeImage
<Index
className="mx-auto block"
width={130}
height={130}
Expand Down
Loading

0 comments on commit a5fa24c

Please sign in to comment.