Skip to content

Commit

Permalink
chore(lint): 🧹 fix linting issues in utility function and button comp…
Browse files Browse the repository at this point in the history
…onent

- Fixed linting issue in utility function:
  - Changed the type of `value` in `isNullOrUndefined` from `any` to `unknown` to ensure stricter type checking.

- Fixed linting issue in Button component:
  - Updated the `onClick` handler to use `void` with the `signIn` function call for better type safety.
  • Loading branch information
Zyruks committed Sep 21, 2024
1 parent 21970a5 commit 9c373cf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
12 changes: 7 additions & 5 deletions apps/nextjs/src/common/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/**
* isNullOrUndefined
* @description - validate if an element is null or undefined
* isNullOrUndefined.
*
* - validate if an element is null or undefined.
*
* @function
* @param {any} value - Element to validate
* @return {boolean} Element is null or undefined.
* @param {any} value - Element to validate.
* @returns {boolean} Element is null or undefined.
*/
export const isNullOrUndefined = (value: any): boolean => value === undefined || value === null;
export const isNullOrUndefined = (value: unknown): boolean => value === undefined || value === null;
2 changes: 1 addition & 1 deletion apps/nextjs/src/pages/auth/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Signin: NextPage = () => {
<div className="relative flex flex-col items-center justify-center rounded-lg bg-slate-800 p-10">
<button
className="relative flex min-w-fit items-center justify-center overflow-hidden whitespace-nowrap rounded-lg bg-primary-200/20 px-4 py-2 text-center text-sm font-semibold text-primary-50 transition duration-100 ease-out hover:bg-primary-200/30"
onClick={() => signIn('twitter')}
onClick={() => void signIn('twitter')}
>
Log in with Twitter
</button>
Expand Down
17 changes: 4 additions & 13 deletions apps/nextjs/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { NextPage } from 'next';
import Head from 'next/head';
import Link from 'next/link';
import { Icon, IconCatalog } from '~/components';
import { signIn, useSession } from 'next-auth/react';
import { Button, ButtonSize, ButtonVariant } from 'side-ui';
import { Icon, IconCatalog } from '~/components';

const Home: NextPage = () => {
const { data: sessionData } = useSession();
Expand All @@ -18,26 +18,17 @@ const Home: NextPage = () => {
<main className="relative flex h-screen w-full flex-none flex-col items-center justify-center gap-10 overflow-hidden bg-slate-900 p-10">
<div className="relative flex h-min w-min flex-none flex-col flex-wrap items-center justify-center gap-4 overflow-hidden p-0">
<div className="mb-2 flex flex-row items-center gap-4 text-white">
<a
className="text-2xl font-semibold text-secondary-300 transition hover:opacity-80"
href="/"
>
<a className="text-2xl font-semibold text-secondary-300 transition hover:opacity-80" href="/">
Side Project Starter Kit
</a>
</div>
<div className="mb-4 w-96">
<h1 className="text-center text-3xl font-bold text-slate-50">
This is a starter kit template
</h1>
<h1 className="text-center text-3xl font-bold text-slate-50">This is a starter kit template</h1>
</div>
{sessionData ? (
<p className="text-lg text-white">{sessionData.user.name}</p>
) : (
<Button
variant={ButtonVariant.secondary}
size={ButtonSize.sm}
onClick={() => signIn('twitter')}
>
<Button variant={ButtonVariant.secondary} size={ButtonSize.sm} onClick={() => void signIn('twitter')}>
Log in with Twitter
</Button>
)}
Expand Down

0 comments on commit 9c373cf

Please sign in to comment.