Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all ESLint errors #70

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions src/components/userComponents/emailPopup/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React, { Fragment, useState } from 'react';
import React, { ChangeEventHandler, Fragment, useState } from 'react';
import { Dialog, Transition } from '@headlessui/react';
import { PiPaperPlaneTiltBold, PiSealCheck } from 'react-icons/pi';
import { VscClose } from 'react-icons/vsc';
Expand All @@ -10,8 +10,9 @@ import supabase from '../../../supabase/client';

/**
*
* @param root0
* @param root0.backLink
* @param props - props
* @param props.backLink - the link to the page the user will be directed to after they subscribe
* @returns an email pop up.
*/
function EmailSuccess({ backLink }: { backLink: string }) {
return (
Expand Down Expand Up @@ -47,20 +48,23 @@ function EmailSuccess({ backLink }: { backLink: string }) {

type EmailInputProps = {
inputValue: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
handleChange: (e: any) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
handleSubmit: (e: any) => void;
showError: boolean;
errorMsg: string;
};

/**
*
* @param root0
* @param root0.inputValue
* @param root0.handleChange
* @param root0.handleSubmit
* @param root0.showError
* @param root0.errorMsg
* @param props - props
* @param props.inputValue - the value of the email input
* @param props.handleChange - the function that handles the change of the email input
* @param props.handleSubmit - the function that handles the submission of the email input
* @param props.showError - a boolean that determines if the error message should be shown
* @param props.errorMsg - the error message that will be shown if showError is true
* @returns an email pop up.
*/
function EmailInput({
inputValue,
Expand Down Expand Up @@ -125,10 +129,8 @@ function EmailInput({
}

/**
* @param root0
* @param root0.backLink
* @param root0
* @param root0.backLink
* @param props - props
* @param props.backLink - the link to the page the user will be directed to after they subscribe
* @returns an email pop up.
* if no email is entered and the user clicks the submit button, an error message will pop up.
* if an invalid email is entered and the user clicks the submit button, another error message will pop up.
Expand All @@ -145,19 +147,21 @@ export default function EmailPopup({ backLink }: { backLink: string }) {
setIsOpen(false);
};

const handleChange = e => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleChange = (e : any) => {
setInputValue(e.target.value);
setShowError(false);
};

// const { error } = await supabase.from('emails').insert({ id: 1, name: 'Denmark' })

const isValidEmail = email => {
const isValidEmail = (email : string) => {
const emailRegex = /^[^\s@]+@[^\s@]+\.(com|ca)$/;
return emailRegex.test(email);
};

const handleSubmit = async e => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, consistent-return
const handleSubmit = async (e : any) => {
e.preventDefault();

if (!inputValue.trim()) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/userComponents/navBar/navBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function NavBar() {
href="/newsFeedPage"
className="text-night font-lato text-lg font-bold block relative left-4 mt-[1.25rem]"
>
News Feed
News
</Link>
</div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/supabase/category/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { CategoryRow } from '../../types/types';
// Assume this function is in `supabase/category/queries.js`
/**
*
* @param category category to retreive color

* @param id
* @param id category id to retreive color for
* @returns color for category, else null
*/
// eslint-disable-next-line import/prefer-default-export
Expand Down
4 changes: 2 additions & 2 deletions src/supabase/category/queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import supabase from '../client';
// Assume this function is in `supabase/category/queries.js`
/**
*
* @param category which category to get color from
* @returns color of category
* @param category - The category for which you want to fetch the color
* @returns The color for the category
*/
// eslint-disable-next-line import/prefer-default-export
export async function getCategoryColor1(category: string) {
Expand Down
10 changes: 6 additions & 4 deletions src/supabase/displays/queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DisplayRow } from '../../types/types';
import supabase from '../client';

/**
*
* @returns all displays from the database
*/
export async function fetchAllDisplays() {
const { data, error } = await supabase.from('displays').select('*');
Expand All @@ -16,7 +16,8 @@ export async function fetchAllDisplays() {

/**
*
* @param id
* @param id - display id
* @returns a display from the database
*/
export async function fetchDisplay(id: string) {
const { data, error } = await supabase
Expand All @@ -32,7 +33,7 @@ export async function fetchDisplay(id: string) {

/**
*
* @param id
* @param id - display id
*/
export async function deleteDisplay(id: string) {
const { error } = await supabase.from('displays').delete().eq('id', id);
Expand All @@ -46,7 +47,8 @@ export async function deleteDisplay(id: string) {

/**
*
* @param displayData
* @param displayData - the display row to create
* @returns the new display row
*/
export async function createDisplay(displayData: DisplayRow) {
const { data, error } = await supabase.from('displays').upsert([displayData]);
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const config: Config = {
},
},
},
// eslint-disable-next-line import/no-extraneous-dependencies, global-require
plugins: [require('daisyui')],
};
export default config;
Loading