Skip to content

Commit

Permalink
Fix: eslint 타입에러 (#125)
Browse files Browse the repository at this point in the history
* fix: eslint 타입에러

* fix: eslint 3가지 추가
  • Loading branch information
IM-HYUN-JEONG authored Mar 29, 2024
1 parent 88e8e48 commit bc018cc
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"eslint-plugin-import/no-cycle": "off",
"import/no-cycle":"off",
"no-param-reassign":"off",
"@typescript-eslint/no-unused-vars": "warn", //사용안한 변수는 경고처리
"react/jsx-curly-newline": "off", // jsx안에 }를 새로운 라인에 사용할 수 있다.
"@typescript-eslint/no-use-before-define": ["warn"], // 선언하기 전에 사용 한다면 경고
"jsx-a11y/label-has-associated-control": [
2,
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable import/order */

import Image from 'next/image';
import useCss from '@/hooks/common/useCss';
import BookmarkBorderIcon from '@mui/icons-material/BookmarkBorder';
Expand Down Expand Up @@ -31,7 +32,7 @@ function BottomSheetHeader({ data }: BottomSheetInnerProps) {
useCss('https://unpkg.com/react-spring-bottom-sheet/dist/style.css');

const onClickBookmark = () => {
console.log('====북마크 클릭, 클릭에따라 api보내야함');
// 북마크 클릭, 클릭에따라 api보내야함
};

const addressSplit = address.split(' ');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable function-paren-newline */

import { useToast } from '@/app/_components/ui/use-toast';
import { BottomSheetInnerProps } from '@/types/map/BottomSheetProps';
import { ChevronDown, Copy } from 'lucide-react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import Image from 'next/image';
import OneSiteUrl from '@/app/service/map/_components/bottom-sheet/OneSiteUrl';
import BarRatingChart from '@/app/service/map/_components/chart/BarRatingChart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function KakaoBackGroundMap({
lng: location.longitude,
};

console.log('mapInfo', mapInfo, mapInfo.center);
return (
<div className="h-full-size-omit-nav relative z-10">
<Map // 지도를 표시할 Container
Expand Down
35 changes: 35 additions & 0 deletions src/app/service/map/_components/kakao/Location.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* eslint-disable no-console */
/* eslint-disable lines-around-directive */
'use client';
import { useEffect, useState } from 'react';

export default function Location() {
const [location, setLocation] = useState<
{ lat: number; lng: number } | string
>('');

const success = (position: GeolocationPosition) => {
setLocation({
lat: position.coords.latitude,
lng: position.coords.longitude,
});
};

const handleError = () => {
setLocation({
lat: 37.483034,
lng: 126.902435,
});
console.log('Failed to retrieve location');
};

useEffect(() => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success, handleError);
} else {
handleError(); // geolocation이 없을때 에러처리
}
}, []);

return location;
}
1 change: 0 additions & 1 deletion src/app/service/map/_components/kakao/Locations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default function Location() {
latitude: 37.483034,
longitude: 126.902435,
});
console.log('Failed to retrieve location');
};

useEffect(() => {
Expand Down
7 changes: 1 addition & 6 deletions src/app/service/map/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* eslint-disable react/jsx-curly-newline */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable lines-around-directive */
/* eslint-disable react/button-has-type */
'use client';

import SearchBar from '@/app/service/map/_components/search/SearchBar';
Expand Down Expand Up @@ -66,7 +62,6 @@ function Page() {
};

useEffect(() => {
console.log('selectId', typeof selectId, selectId);
if (selectId && selectId !== 'undefined') {
const selectItem = data?.data.data.filter(
v => v.id === Number(selectId),
Expand All @@ -86,7 +81,6 @@ function Page() {
}, []);

useEffect(() => {
console.log('===============', mapInfo, mapInfo.center);
if (typeof location === 'object' && location !== null) {
// location이 object 이고 null이 아닌지 확인
setMapInfo({
Expand All @@ -104,6 +98,7 @@ function Page() {
<ImageModal />
<ImageSliderModal />
<button
type="button"
className="z-0"
onClick={() =>
setMapInfo({
Expand Down

0 comments on commit bc018cc

Please sign in to comment.