Skip to content

Commit

Permalink
refactor: enable import/no-default-export eslint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomez committed Mar 27, 2024
1 parent 6990f78 commit 0516283
Show file tree
Hide file tree
Showing 193 changed files with 795 additions and 857 deletions.
4 changes: 2 additions & 2 deletions e2e/global.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { test as setup } from '@playwright/test'
import fs from 'fs'

import { ADMIN_AUTH_FILE, USER_AUTH_FILE } from './tests/constants'
import LoginPage from './tests/pages/login.page'
import SettingsPage from './tests/pages/settings.page'
import { LoginPage } from './tests/pages/login.page'
import { SettingsPage } from './tests/pages/settings.page'

setup('authenticate as user', async ({ page, request }) => {
if (fs.existsSync(USER_AUTH_FILE)) {
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { test as base } from '@playwright/test'

import BookPage from './pages/book.page'
import CatalogPage from './pages/catalog.page'
import SettingsPage from './pages/settings.page'
import { BookPage } from './pages/book.page'
import { CatalogPage } from './pages/catalog.page'
import { SettingsPage } from './pages/settings.page'

export * from '@playwright/test'

Expand Down
5 changes: 0 additions & 5 deletions e2e/tests/helpers/prisma.ts

This file was deleted.

11 changes: 0 additions & 11 deletions e2e/tests/helpers/ulid.ts

This file was deleted.

6 changes: 2 additions & 4 deletions e2e/tests/pages/book.page.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Page } from '@playwright/test'
import { ulid } from 'ulid'

import prisma from '../helpers/prisma'
import { prisma } from '@/lib/prisma/prisma'

class BookPage {
export class BookPage {
constructor(private readonly page: Page) {}

async goto(id?: string) {
Expand Down Expand Up @@ -63,5 +63,3 @@ class BookPage {
await prisma.book.deleteMany({ where: { id: { in: ids } } })
}
}

export default BookPage
4 changes: 1 addition & 3 deletions e2e/tests/pages/catalog.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page } from '@playwright/test'

class CatalogPage {
export class CatalogPage {
constructor(private readonly page: Page) {}

async goto() {
Expand All @@ -27,5 +27,3 @@ class CatalogPage {
.waitFor({ state: 'visible' })
}
}

export default CatalogPage
4 changes: 1 addition & 3 deletions e2e/tests/pages/login.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page } from '@playwright/test'

class LoginPage {
export class LoginPage {
constructor(private readonly page: Page) {}

async goto() {
Expand Down Expand Up @@ -28,5 +28,3 @@ class LoginPage {
return webMailPage
}
}

export default LoginPage
9 changes: 3 additions & 6 deletions e2e/tests/pages/settings.page.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Page } from '@playwright/test'

import gravatar from '@/lib/utils/gravatar'
import { prisma } from '@/lib/prisma/prisma'
import { gravatar } from '@/lib/utils/gravatar'

import prisma from '../helpers/prisma'

class SettingsPage {
export class SettingsPage {
constructor(private readonly page: Page) {}

async goto() {
Expand Down Expand Up @@ -47,5 +46,3 @@ class SettingsPage {
})
}
}

export default SettingsPage
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"eqeqeq": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-default-export": "error",
"import/no-duplicates": "error",
"no-shadow": "off",
"simple-import-sort/exports": "error",
Expand All @@ -171,6 +172,20 @@
"unicorn/no-useless-undefined": "off",
"unicorn/prefer-node-protocol": "off",
"unused-imports/no-unused-imports": "error"
}
},
"overrides": [
{
"files": [
"./src/app/**/*.{tsx,ts,js,jsx}",
"./stories/**/*.{tsx,ts,js,jsx}"
],
"excludedFiles": [
"./src/app/**/{actions,components}/*.{tsx,ts,js,jsx}"
],
"rules": {
"import/no-default-export": "off"
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { z } from 'zod'

import { signIn } from '@/lib/auth/auth'
import FormResponse from '@/lib/zod/form-response'
import { FormResponse } from '@/lib/zod/form-response'

export interface SignInForm {
email?: string
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function useController(properties: AuthModalFooterProperties) {
return { ...properties }
}

export default function AuthCardFooter(properties: AuthModalFooterProperties) {
export function AuthCardFooter(properties: AuthModalFooterProperties) {
const { children } = useController(properties)
return (
<CardFooter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface AuthModalHeaderProperties {
title: string
}

export default function AuthCardHeader(properties: AuthModalHeaderProperties) {
export function AuthCardHeader(properties: AuthModalHeaderProperties) {
const { children, title } = { ...properties }
return (
<CardBody className="flex-col gap-4">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Card, CardHeader } from '@nextui-org/react'
import React, { ReactNode } from 'react'

import ThemeImage from '@/components/theme-image/theme-image'
import { ThemeImage } from '@/components/image/theme-image'

interface AuthModalProperties {
children: ReactNode
}

export default function AuthCard(properties: AuthModalProperties) {
export function AuthCard(properties: AuthModalProperties) {
const { children } = { ...properties }
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { Button } from '@nextui-org/react'
import React from 'react'
import { useFormState } from 'react-dom'

import { signInAction } from '@/app/(auth)/signin/_components/sign-in-email-form/actions'
import InputForm from '@/components/input-form/input-form'
import FormResponse from '@/lib/zod/form-response'
import { signInAction } from '@/app/(auth)/actions/sign-in-action'
import { InputForm } from '@/components/form/input-form'
import { FormResponse } from '@/lib/zod/form-response'

export default function SignInEmailForm() {
export function SignInEmailForm() {
const [state, action] = useFormState(
signInAction,
FormResponse.initialState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { ArrowRightStartOnRectangleIcon } from '@heroicons/react/24/outline'
import { Button } from '@nextui-org/react'
import React from 'react'

import { signOutAction } from '@/app/(auth)/signout/_components/sign-out-form/actions'
import { signOutAction } from '@/app/(auth)/actions/sign-out-action'

export default function SignOutForm() {
export function SignOutForm() {
return (
<form className="flex flex-col gap-2" action={signOutAction}>
<Button
Expand Down
8 changes: 4 additions & 4 deletions src/app/(auth)/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Metadata } from 'next'
import { redirect } from 'next/navigation'
import React from 'react'

import AuthCard from '@/app/(auth)/_components/auth-card/auth-card'
import AuthCardFooter from '@/app/(auth)/_components/auth-card/auth-card-footer'
import AuthCardHeader from '@/app/(auth)/_components/auth-card/auth-card-header'
import SignInEmailForm from '@/app/(auth)/signin/_components/sign-in-email-form/sign-in-email-form'
import { AuthCard } from '@/app/(auth)/components/auth-card'
import { AuthCardFooter } from '@/app/(auth)/components/auth-card-footer'
import { AuthCardHeader } from '@/app/(auth)/components/auth-card-header'
import { SignInEmailForm } from '@/app/(auth)/components/sign-in-email-form'
import { auth } from '@/lib/auth/auth'

export const metadata: Metadata = {
Expand Down
6 changes: 3 additions & 3 deletions src/app/(auth)/signout/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Metadata } from 'next'
import { redirect } from 'next/navigation'
import React from 'react'

import AuthCard from '@/app/(auth)/_components/auth-card/auth-card'
import AuthCardHeader from '@/app/(auth)/_components/auth-card/auth-card-header'
import SignOutForm from '@/app/(auth)/signout/_components/sign-out-form/sign-out-form'
import { AuthCard } from '@/app/(auth)/components/auth-card'
import { AuthCardHeader } from '@/app/(auth)/components/auth-card-header'
import { SignOutForm } from '@/app/(auth)/components/sign-out-form'
import { auth } from '@/lib/auth/auth'

export const metadata: Metadata = {
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,9 +4,9 @@ import Link from 'next/link'
import { redirect } from 'next/navigation'
import React from 'react'

import AuthCard from '@/app/(auth)/_components/auth-card/auth-card'
import AuthCardFooter from '@/app/(auth)/_components/auth-card/auth-card-footer'
import AuthCardHeader from '@/app/(auth)/_components/auth-card/auth-card-header'
import { AuthCard } from '@/app/(auth)/components/auth-card'
import { AuthCardFooter } from '@/app/(auth)/components/auth-card-footer'
import { AuthCardHeader } from '@/app/(auth)/components/auth-card-header'
import { auth } from '@/lib/auth/auth'

export const metadata: Metadata = {
Expand Down
43 changes: 0 additions & 43 deletions src/app/@modal/(.)search/_components/search-modal/hooks.ts

This file was deleted.

51 changes: 0 additions & 51 deletions src/app/@modal/(.)search/_components/search-modal/search-modal.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/app/@modal/(.)search/_components/search-modal/types.ts

This file was deleted.

25 changes: 0 additions & 25 deletions src/app/@modal/(.)search/_components/search-result/hooks.ts

This file was deleted.

Loading

0 comments on commit 0516283

Please sign in to comment.