Skip to content

Commit 9c218f1

Browse files
authored
Merge pull request #123 from oodd-team/dev
리팩토링 v1.1.0
2 parents a7bdcc9 + f889997 commit 9c218f1

215 files changed

Lines changed: 4608 additions & 14890 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.cjs

Lines changed: 100 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,109 @@
11
module.exports = {
22
root: true,
3-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
3+
extends: [
4+
'eslint:recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'plugin:import/typescript',
7+
'plugin:import/recommended',
8+
'plugin:prettier/recommended',
9+
],
410
parser: '@typescript-eslint/parser',
5-
parserOptions: { project: ['./tsconfig.json'] },
6-
plugins: ['@typescript-eslint'],
11+
parserOptions: {
12+
project: ['./tsconfig.app.json', './tsconfig.node.json'],
13+
},
14+
plugins: ['@typescript-eslint', 'eslint-plugin-import'],
15+
settings: {
16+
'import/resolver': {
17+
typescript: {
18+
project: ['./tsconfig.app.json', './tsconfig.node.json'],
19+
},
20+
},
21+
'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'] },
22+
},
23+
env: {
24+
node: true,
25+
},
726
rules: {
8-
'@typescript-eslint/strict-boolean-expressions': [
9-
2,
27+
'prettier/prettier': ['error', { endOfLine: 'auto' }],
28+
'import/extensions': [
29+
'error',
30+
'ignorePackages',
1031
{
11-
allowString: false,
12-
allowNumber: false,
32+
ts: 'never',
33+
tsx: 'never',
34+
},
35+
],
36+
'import/order': [
37+
'error',
38+
{
39+
groups: ['builtin', 'external', 'internal', 'index', 'type', 'parent', 'sibling', 'object'],
40+
alphabetize: {
41+
order: 'asc',
42+
caseInsensitive: true,
43+
},
44+
'newlines-between': 'always',
45+
pathGroups: [
46+
{
47+
pattern: 'react*',
48+
group: 'builtin',
49+
position: 'before',
50+
},
51+
{
52+
pattern: '@components/**/dto',
53+
group: 'type',
54+
},
55+
{
56+
pattern: '@styles/**',
57+
group: 'internal',
58+
position: 'before',
59+
},
60+
{
61+
pattern: '@assets/**',
62+
group: 'internal',
63+
position: 'after',
64+
},
65+
{
66+
pattern: '@components/Icons/**',
67+
group: 'internal',
68+
position: 'after',
69+
},
70+
{
71+
pattern: '@components/**',
72+
group: 'internal',
73+
position: 'after',
74+
},
75+
{
76+
pattern: '../**/dto',
77+
group: 'type',
78+
position: 'after',
79+
},
80+
{
81+
pattern: './**/dto',
82+
group: 'type',
83+
position: 'after',
84+
},
85+
{
86+
pattern: '../**/index',
87+
group: 'parent',
88+
position: 'before',
89+
},
90+
{
91+
pattern: './**/index',
92+
group: 'parent',
93+
position: 'before',
94+
},
95+
],
96+
pathGroupsExcludedImportTypes: ['react*'],
1397
},
1498
],
1599
},
16-
ignorePatterns: ['src/**/*.test.ts', 'src/frontend/generated/*'],
100+
overrides: [
101+
{
102+
files: ['*.ts', '*.tsx'],
103+
rules: {
104+
'import/order': 'error',
105+
},
106+
},
107+
],
108+
ignorePatterns: ['src/**/*.test.ts', 'src/frontend/generated/*', 'src/App.tsx'],
17109
};

.prettierrc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"trailingComma": "all",
3-
"tabWidth": 2,
4-
"semi": true,
5-
"singleQuote": true,
6-
"printWidth": 120,
7-
"arrowParens": "always",
8-
"useTabs": true
2+
"trailingComma": "all",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"printWidth": 120,
7+
"arrowParens": "always",
8+
"useTabs": true
99
}

package.json

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,38 @@
1414
"dependencies": {
1515
"@types/styled-components": "^5.1.34",
1616
"axios": "^1.7.2",
17-
"body-parser": "^1.20.2",
18-
"cors": "^2.8.5",
1917
"dayjs": "^1.11.12",
20-
"express": "^4.19.2",
2118
"firebase": "^10.13.0",
2219
"heic2any": "^0.0.4",
23-
"js-cookie": "^3.0.5",
20+
"lodash": "^4.17.21",
2421
"react": "^18.3.1",
2522
"react-dom": "^18.3.1",
26-
"react-error-overlay": "6.0.9",
2723
"react-responsive": "^10.0.0",
2824
"react-router-dom": "^6.24.1",
29-
"react-scripts": "4.0.3",
3025
"recoil": "^0.7.7",
3126
"recoil-persist": "^5.1.0",
32-
"request": "^2.88.2",
3327
"socket.io-client": "^4.7.5",
3428
"styled-components": "^6.1.11",
3529
"styled-reset": "^4.5.2",
3630
"swiper": "^11.1.8"
3731
},
3832
"devDependencies": {
39-
"@types/express": "^4.17.21",
40-
"@types/js-cookie": "^3.0.6",
33+
"@types/lodash": "^4.17.13",
4134
"@types/node": "^20.14.10",
4235
"@types/react": "^18.3.3",
4336
"@types/react-dom": "^18.3.0",
44-
"@typescript-eslint/eslint-plugin": "^7.16.1",
45-
"@typescript-eslint/parser": "^7.13.1",
37+
"@typescript-eslint/eslint-plugin": "^8.18.1",
38+
"@typescript-eslint/parser": "^8.18.1",
4639
"@vitejs/plugin-react": "^4.3.1",
47-
"eslint": "^9.7.0",
40+
"eslint": "^8.0.0",
4841
"eslint-config-prettier": "^9.1.0",
42+
"eslint-import-resolver-typescript": "^3.7.0",
43+
"eslint-plugin-import": "^2.31.0",
4944
"eslint-plugin-prettier": "^5.1.3",
50-
"eslint-plugin-react-hooks": "^4.6.2",
45+
"eslint-plugin-react-hooks": "^5.1.0",
5146
"eslint-plugin-react-refresh": "^0.4.7",
52-
"json-server": "^1.0.0-beta.1",
5347
"prettier": "^3.3.2",
54-
"typescript": "^5.2.2",
55-
"vite": "^5.3.1"
56-
},
57-
"proxy": "https://localhost:3001"
48+
"typescript": "^5.7.2",
49+
"vite": "^6.0.3"
50+
}
5851
}

src/App.tsx

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
import React from 'react';
22
import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom';
3-
import Home from './pages/Home';
4-
import Login from './pages/Login';
5-
import SignUp from './pages/SignUp';
6-
import LoginComplete from './pages/Login/components/LoginComplete';
7-
import TermsAgreement from './pages/TermsAgreement';
83

9-
import MyPage from './pages/MyPage';
10-
import ProfileEdit from './pages/ProfileEdit';
11-
import AccountSetting from './pages/AccountSetting';
12-
import AccountEdit from './pages/AccountEdit';
13-
import AccountCancel from './pages/AccountCancel';
14-
import Verification from './pages/verification';
4+
import Home from '@pages/Home';
5+
import Login from '@pages/Login';
6+
import LoginComplete from '@pages/Login/LoginComplete';
157

16-
import ProfileViewer from './pages/ProfileViewer';
8+
import SignUp from '@pages/SignUp';
9+
import TermsAgreement from '@pages/SignUp/TermsAgreement';
1710

18-
import Post from './pages/Post';
19-
import MyPost from './pages/MyPost';
20-
import PostUpload from './pages/PostUpload';
21-
import PostImageSelect from './pages/PostImageSelect';
22-
import PostInstaConnect from './pages/PostInstaConnect';
23-
import PostInstaFeedSelect from './pages/PostInstaFeedSelect';
11+
import Profile from '@pages/Profile';
12+
import ProfileEdit from '@pages/Profile/ProfileEdit';
2413

25-
import Chats from './pages/Chats';
26-
import ChatRoom from './pages/Chats/ChatRoom';
14+
import AccountSetting from '@pages/Account/AccountSetting';
15+
import AccountEdit from '@pages/Account/AccountEdit';
16+
import AccountCancel from '@pages/Account/AccountCancel';
17+
import Verification from '@pages/Account/Verification';
2718

28-
import NotFound from './pages/NotFound';
19+
import Post from '@pages/Post';
20+
import PostUpload from '@pages/Post/PostUpload';
21+
import PostImageSelect from '@pages/Post/PostImageSelect';
22+
import PostInstaConnect from '@pages/Post/PostInstaConnect';
23+
import PostInstaFeedSelect from '@pages/Post/PostInstaFeedSelect';
24+
25+
import Chats from '@pages/Chats';
26+
import ChatRoom from '@pages/Chats/ChatRoom';
27+
28+
import NotFound from '@pages/NotFound';
2929

3030
const ProtectedRoute = ({ children }: { children: JSX.Element }) => {
3131
const isAuthenticated = Boolean(localStorage.getItem('new_jwt_token'));
@@ -36,21 +36,21 @@ const ProtectedRoute = ({ children }: { children: JSX.Element }) => {
3636
const protectedRoutes = [
3737
{ path: '/', element: <Home /> },
3838

39-
// 사용자 프로필 및 계정 관리
40-
{ path: '/mypage', element: <MyPage /> },
39+
// profile
40+
{ path: '/profile/:userId', element: <Profile /> },
4141
{ path: '/profile/edit', element: <ProfileEdit /> },
42-
{ path: '/account-setting', element: <AccountSetting /> },
43-
{ path: '/account-edit', element: <AccountEdit /> },
44-
{ path: '/account-cancel', element: <AccountCancel /> },
45-
{ path: '/verification', element: <Verification /> },
46-
{ path: '/users/:userId', element: <ProfileViewer /> },
42+
43+
// account
44+
{ path: '/account/setting', element: <AccountSetting /> },
45+
{ path: '/account/edit', element: <AccountEdit /> },
46+
{ path: '/account/cancel', element: <AccountCancel /> },
47+
{ path: '/account/verification', element: <Verification /> },
4748

4849
{ path: '/post/:postId', element: <Post /> },
49-
{ path: '/my-post/:postId', element: <MyPost /> },
50-
{ path: '/upload', element: <PostUpload /> },
51-
{ path: '/image-select', element: <PostImageSelect /> },
52-
{ path: '/insta-connect', element: <PostInstaConnect /> },
53-
{ path: '/insta-feed-select', element: <PostInstaFeedSelect /> },
50+
{ path: '/post/upload/photo/select', element: <PostImageSelect /> },
51+
{ path: '/post/upload/instagram/connect', element: <PostInstaConnect /> },
52+
{ path: '/post/upload/instagram/select', element: <PostInstaFeedSelect /> },
53+
{ path: '/post/upload/content', element: <PostUpload /> },
5454

5555
// 메시지/채팅
5656
{ path: '/chats', element: <Chats /> },
@@ -60,9 +60,10 @@ const protectedRoutes = [
6060
// 인증이 필요 없는 페이지 배열
6161
const publicRoutes = [
6262
{ path: '/login', element: <Login /> },
63-
{ path: '/signup', element: <SignUp /> },
6463
{ path: '/login/complete', element: <LoginComplete /> },
65-
{ path: '/terms-agreement', element: <TermsAgreement /> },
64+
65+
{ path: '/signup', element: <SignUp /> },
66+
{ path: '/signup/terms-agreement', element: <TermsAgreement /> },
6667
];
6768

6869
const App: React.FC = () => {

src/apis/auth/dto.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import { BaseSuccessResponse } from '../core/dto';
1+
import type { BaseSuccessResponse } from '@apis/core/dto';
22

33
// jwt를 이용한 사용자 정보 조회 응답
44
export type getUserInfoByJwtResponse = BaseSuccessResponse<getUserInfoByJwtData>;
55
// jwt를 이용한 사용자 정보 조회 응답 데이터
66
export interface getUserInfoByJwtData {
7-
userId: number;
7+
id: number;
88
name: string;
99
phoneNumber: string;
1010
email: string;
1111
nickname: string;
1212
profilePictureUrl: string;
1313
bio: string;
14+
birthDate: string;
1415
}

src/apis/auth/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getUserInfoByJwtResponse } from './dto';
2-
import { newRequest } from '../core';
1+
import { newRequest } from '@apis/core';
2+
import type { getUserInfoByJwtResponse } from './dto';
33

44
// jwt로 사용자 정보 조회 api /auth/me
55
export const getUserInfoByJwtApi = () => newRequest.get<getUserInfoByJwtResponse>('/auth/me');

src/apis/chat-room/dto.ts

Whitespace-only changes.

src/apis/chatting/dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// base response 형태를 따르지 않으므로 data 접미사를 사용했습니다.
33
// response
44
export interface ChatRoomData {
5-
chatRoomId: number;
5+
id: number;
66
otherUser: OtherUserDto;
77
latestMessage: LatestMessageDto;
88
}
99

1010
export interface OtherUserDto {
1111
id: number;
1212
nickname: string;
13-
profileUrl: string;
13+
profilePictureUrl: string;
1414
}
1515

1616
export interface LatestMessageDto {

src/apis/core/index.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import axios, {
55
AxiosResponse,
66
InternalAxiosRequestConfig,
77
} from 'axios';
8-
import { JWT_KEY, NEW_JWT_KEY } from '../../config/constant';
8+
import { NEW_JWT_KEY } from '../../config/constant';
99

1010
// 기존 서버 응답 타입
1111
export type BaseResponse<T = any> = {
@@ -71,40 +71,3 @@ newRequest.interceptors.response.use(
7171
return Promise.reject(error);
7272
},
7373
);
74-
75-
// 기존 서버 axios 인스턴스
76-
export const request: CustomInstance = axios.create({
77-
baseURL: import.meta.env.VITE_API_URL,
78-
timeout: 20000,
79-
headers: {
80-
accept: 'application/json',
81-
Authorization: `Bearer ${localStorage.getItem(JWT_KEY)}`,
82-
},
83-
});
84-
85-
request.interceptors.request.use(
86-
(config) => {
87-
const jwt = window.localStorage.getItem(JWT_KEY);
88-
config.headers.Authorization = `Bearer ${jwt}`;
89-
return config;
90-
},
91-
(error) => {
92-
return Promise.reject(error);
93-
},
94-
);
95-
96-
request.interceptors.response.use(
97-
(response) => {
98-
console.log('network log', response);
99-
if (response.status === 200 || response.status === 201) {
100-
return response.data;
101-
} else {
102-
return Promise.reject(response.data.message);
103-
}
104-
},
105-
(error) => {
106-
return Promise.reject(error.code === 'ERR_NETWORK' ? '허용되지 않은 네트워크 접근입니다.' : error);
107-
},
108-
);
109-
110-
export default request;

0 commit comments

Comments
 (0)