Skip to content

Commit

Permalink
chore: simplify eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
karthickthankyou committed Jul 24, 2023
1 parent 7b37940 commit 6d88cb2
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 63 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = {
},
extends: [
'plugin:react/recommended',
'airbnb',
'next/core-web-vitals',
'plugin:storybook/recommended',
'plugin:cypress/recommended',
Expand Down
4 changes: 1 addition & 3 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import Notifications from 'src/components/molecules/Notification'

import { useDebouncedDispatch, useLongHoverDispatch } from 'src/hooks'
import { useGetWishlisted } from 'src/store/userHome/userHomeHooks'
import UrqlProvider, {
ssrCache,
} from 'src/components/templates/UrqlProvider/UrqlProvider'
import UrqlProvider from 'src/components/templates/UrqlProvider/UrqlProvider'
import { store } from 'src/store'
import 'src/globals.css'
import React from 'react'
Expand Down
6 changes: 5 additions & 1 deletion pages/api/webhook/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* eslint-disable camelcase */
import Stripe from 'stripe'
import { buffer } from 'micro'
import { urqlAdminClient } from 'src/lib/client'
import { createClient } from 'urql'
import { SetHomePlanDocument } from 'src/generated/graphql'

export const urqlAdminClient = createClient({
url: process.env.NEXT_PUBLIC_API_URL,
})

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY)

export const config = {
Expand Down
3 changes: 1 addition & 2 deletions pages/homes/edit/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ import { ParsedUrlQuery } from 'querystring'
import { client, ssrCache } from 'src/config/urqlClientWonka'
import { GetHomeDocument, useGetHomeQuery } from 'src/generated/graphql'
import { getQueryParam } from 'src/lib/util'
import { useHomesDetailed } from 'src/store/home/homeNetwork'

const EditPage: NextPage = () => {
const id = parseInt(getQueryParam(useRouter().query.id), 10)
const [home] = useGetHomeQuery({
variables: { where: { id } },
})

return <div>Hello edit page.</div>
return <div>Hello edit page. {home.data?.property.id} </div>
}

export async function getStaticPaths() {
Expand Down
1 change: 0 additions & 1 deletion pages/homes/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import { NextPage } from 'next'
import Container from 'src/components/atoms/Container'
import ProductPage from 'src/components/templates/ProductPage'
import { NextSeo } from 'next-seo'
import Head from 'next/head'
import { Style } from 'src/generated/graphql'

Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Image/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type IImageProps = React.ComponentProps<typeof NextImage> & {
}

const Image = (props: IImageProps) => {
const { src, fallbackSrc = fallbackImg, className, alt, ...rest } = props
const { src, fallbackSrc = fallbackImg, alt, ...rest } = props
const [imgSrc, setImgSrc] = useState(src)

return (
Expand Down
4 changes: 3 additions & 1 deletion src/components/atoms/Image2/Image.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export default {
component: Image,
} as ComponentMeta<typeof Image>

const Template: ComponentStory<typeof Image> = (args) => <Image {...args} />
const Template: ComponentStory<typeof Image> = ({ alt, ...args }) => (
<Image alt={alt} {...args} />
)

export const Fixed = Template.bind({})
Fixed.args = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/MyHomesCard/MyHomesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const setPublishedState = ({
else notify({ message: `Home unpublished. No one can view this home.` })
}
})
.catch((err) =>
.catch(() =>
notify({ message: `Oops. something went wrong.`, type: 'error' })
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import React from 'react'
import { ComponentStory, ComponentMeta } from '@storybook/react'
import { combineReducers, createStore } from '@reduxjs/toolkit'
import userReducer, {
initialState as userInitialState,
} from 'src/store/user/userSlice'
import { produce } from 'immer'
import { composedEnhancers } from 'src/store'
import { SbReduxProvider, SbUrqlProvider } from 'src/lib/sb'
import { mswWorker } from 'src/mocks/mswWorker'
import {
Expand All @@ -29,23 +23,6 @@ const Template: ComponentStory<typeof PopupHomesContent> = (args) => (
<PopupHomesContent {...args} />
)

const store = createStore(
combineReducers({
user: userReducer,
}),
{
user: produce(userInitialState, (draft) => {
// ! - Non-null assertion operator
draft.data.user = {
uid: '123456',
displayName: 'Rajini Kant',
email: '[email protected]',
}
}),
},
composedEnhancers
)

export const Primary = Template.bind({})
Primary.args = {
id: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { useAppSelector } from 'src/store'
import { selectHomesDetailed } from 'src/store/home/homeSlice'
import { selectDebouncedZoom } from 'src/store/map/mapSlice'

import { selectWishlistedHomes } from 'src/store/userHome/userHomeSlice'

import { Children } from 'src/types'
import PropertyCard from '../PropertyCard'
import { PropertyCardSkeleton } from '../PropertyCard/PropertyCard'

const Layout = ({ children }: { children: Children | undefined }) => (
<div className='grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-1 xl:grid-cols-2'>
{children}
</div>
)
// const Layout = ({ children }: { children: Children | undefined }) => (
// <div className='grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-1 xl:grid-cols-2'>
// {children}
// </div>
// )

const ProductListingResult = () => {
const { data: wishlistedHomes } = useAppSelector(selectWishlistedHomes)
Expand Down
4 changes: 2 additions & 2 deletions src/components/organisms/ZoomControls/ZoomControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ const GotoMarker = ({ viewport }: { viewport: Omit<Viewport, 'zoom'> }) => {
className='rounded-none hover:bg-white'
type='button'
onClick={() => {
const { lat, lng } = map?.getCenter() as { lng: number; lat: number }
map?.jumpTo({ center: [lat, lng] })
const { latitude, longitude } = viewport
map?.jumpTo({ center: [latitude, longitude] })
}}
>
<Pin className='w-8 h-8 p-1.5 ' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const AddNewHomeTemplate = () => {
imgs: uploadData.imgs,
address: uploadData.address,
})
const result = await stripe?.redirectToCheckout({
await stripe?.redirectToCheckout({
sessionId: checkoutSession.data.id,
})
} else {
Expand Down Expand Up @@ -273,7 +273,7 @@ const AddNewHomeTemplate = () => {
/>
}
>
<MapLocationPicker setValue={setValue} className='sm:col-span-2' />
<MapLocationPicker setValue={setValue} />

<Label title='Address' error={errors.address}>
<TextArea
Expand Down
15 changes: 3 additions & 12 deletions src/components/templates/AddNewHomeTemplate/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,7 @@ export const newHomeSchema = yup

export type NewHomeSchema = yup.InferType<typeof newHomeSchema>

export const MapLocationPicker = ({
setValue,
className,
}: {
setValue: Function
className?: string
}) => {
export const MapLocationPicker = ({ setValue }: { setValue: Function }) => {
const [marker, setMarker] = useState(() => ({
lat: 40,
lng: -100,
Expand All @@ -129,11 +123,8 @@ export const MapLocationPicker = ({
const [searchText, setSearchText] = useState('')
const [location, setLocation] = useState('')

const {
data: searchTextData,
loading: searchTextFetching,
error: searchTextError,
} = useSearchAddress({ searchText })
const { data: searchTextData, loading: searchTextFetching } =
useSearchAddress({ searchText })
const {
data: markerDragData,
loading: markerDragFetching,
Expand Down
6 changes: 1 addition & 5 deletions src/mocks/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* eslint-disable no-underscore-dangle */
import { graphql, rest } from 'msw'
import { getQueryParam } from 'src/lib/util'
import { graphql } from 'msw'
import {
namedOperations,
SearchHomesByLocationDetailedQuery,
Expand All @@ -10,8 +8,6 @@ import {
GetWishlistedHomesQueryVariables,
GetHomeByIdQuery,
GetHomeByIdQueryVariables,
GetRegionByIdQuery,
GetRegionByIdQueryVariables,
Style,
SearchHomesByLocationQueryVariables,
} from '../generated/graphql'
Expand Down
2 changes: 1 addition & 1 deletion src/store/user/userHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const useUserListener = () => {
onValue(metadataRef, async (data) => {
if (!data.exists) return

const token = await user.getIdToken(true)
await user.getIdToken(true)
const idTokenResult = await user.getIdTokenResult()
const hasuraClaim = idTokenResult.claims[
'https://hasura.io/jwt/claims'
Expand Down

1 comment on commit 6d88cb2

@vercel
Copy link

@vercel vercel bot commented on 6d88cb2 Jul 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.