Skip to content

Commit 0808050

Browse files
refactor(fe): improve readability (#36)
* feat: replace .eslintrc.json with eslint.config.js * fix: update TypeScript configuration and ESLint settings * fix: remove unnecessary eslint-disable comments and improve clipboard copy handling * fix: enhance ESLint rules for React components and improve code complexity checks * fix: add eslint-plugin-react-hooks and update ESLint rules for hooks * fix: update lint script to run ESLint in quiet mode * fix: add React version detection to ESLint configuration * fix: refactor layout structure in multiple components for improved readability * refactor: restructure modal components to use Header, Body, and Footer for improved organization * chore: auto-fix linting and formatting issues --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 6595a87 commit 0808050

26 files changed

+1684
-1598
lines changed

apps/client/.eslintrc.json

Lines changed: 0 additions & 87 deletions
This file was deleted.

apps/client/eslint.config.js

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import pluginJs from '@eslint/js';
2+
import prettier from 'eslint-config-prettier';
3+
import pluginImport from 'eslint-plugin-import';
4+
import pluginReact from 'eslint-plugin-react';
5+
import pluginReactHooks from 'eslint-plugin-react-hooks'; // 추가
6+
import globals from 'globals';
7+
import tseslint from 'typescript-eslint';
8+
9+
/** @type {import('eslint').Linter.Config[]} */
10+
export default [
11+
{ files: ['**/*.{ts,tsx}'] },
12+
{
13+
ignores: [
14+
'postcss.config.js',
15+
'tailwind.config.js',
16+
'vite.config.ts',
17+
'vite-env.d.ts',
18+
'routeTree.gen.ts',
19+
'playwright.config.ts',
20+
],
21+
languageOptions: {
22+
parserOptions: {
23+
project: './tsconfig.app.json',
24+
ecmaVersion: 2020,
25+
ecmaFeatures: {
26+
jsx: true,
27+
},
28+
},
29+
globals: globals.browser,
30+
},
31+
},
32+
{
33+
plugins: {
34+
import: pluginImport,
35+
'react-hooks': pluginReactHooks,
36+
},
37+
settings: {
38+
react: {
39+
version: 'detect',
40+
},
41+
},
42+
rules: {
43+
'react/react-in-jsx-scope': 'off',
44+
'react/jsx-boolean-value': ['error', 'always'],
45+
'react/jsx-no-duplicate-props': ['error'],
46+
'react/jsx-no-undef': ['error'],
47+
'react/jsx-max-depth': ['error', { max: 4 }],
48+
49+
'react-hooks/rules-of-hooks': 'error',
50+
'react-hooks/exhaustive-deps': 'warn',
51+
52+
complexity: ['error', { max: 10 }],
53+
'max-depth': ['error', 3],
54+
'max-lines-per-function': ['error', { max: 30, skipBlankLines: true, skipComments: true }],
55+
56+
'import/extensions': 'off',
57+
'import/order': [
58+
'error',
59+
{
60+
groups: ['builtin', 'external', ['parent', 'sibling'], 'index'],
61+
pathGroups: [
62+
{
63+
pattern: '@/component/**',
64+
group: 'parent',
65+
position: 'before',
66+
},
67+
{
68+
pattern: '@/features/**',
69+
group: 'parent',
70+
position: 'before',
71+
},
72+
],
73+
named: true,
74+
alphabetize: {
75+
order: 'asc',
76+
caseInsensitive: true,
77+
},
78+
'newlines-between': 'always',
79+
},
80+
],
81+
'sort-imports': [
82+
'error',
83+
{
84+
ignoreCase: true,
85+
ignoreDeclarationSort: true,
86+
ignoreMemberSort: true,
87+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
88+
allowSeparatedGroups: true,
89+
},
90+
],
91+
},
92+
},
93+
{
94+
ignores: ['**.spec.ts'],
95+
rules: {
96+
'max-lines-per-function': 'off',
97+
},
98+
},
99+
pluginJs.configs.recommended,
100+
...tseslint.configs.recommended,
101+
pluginReact.configs.flat.recommended,
102+
pluginReact.configs.flat['jsx-runtime'],
103+
prettier,
104+
];

apps/client/package.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "vite --host",
88
"build": "tsc -b && vite build",
9-
"lint": "eslint . --fix",
9+
"lint": "eslint . --fix --ignore-pattern 'dist' --quiet",
1010
"format": "prettier --write .",
1111
"preview": "vite preview",
1212
"test": "pnpm exec playwright test",
@@ -30,10 +30,9 @@
3030
"zustand": "^5.0.1"
3131
},
3232
"devDependencies": {
33-
"@eslint/js": "^9.11.1",
33+
"@eslint/js": "^9.18.0",
3434
"@playwright/test": "^1.49.0",
3535
"@tailwindcss/typography": "^0.5.15",
36-
"@tanstack/eslint-plugin-query": "^5.59.7",
3736
"@tanstack/router-devtools": "^1.78.3",
3837
"@tanstack/router-plugin": "^1.78.3",
3938
"@types/node": "^20.3.1",
@@ -44,22 +43,18 @@
4443
"@vitejs/plugin-react": "^4.3.2",
4544
"autoprefixer": "^10.4.20",
4645
"eslint": "^8.57.1",
47-
"eslint-config-airbnb": "^19.0.4",
48-
"eslint-config-airbnb-typescript": "^18.0.0",
4946
"eslint-config-prettier": "^9.1.0",
5047
"eslint-plugin-import": "^2.31.0",
51-
"eslint-plugin-jsx-a11y": "^6.10.0",
52-
"eslint-plugin-react": "^7.37.1",
53-
"eslint-plugin-react-hooks": "^4.6.2",
54-
"eslint-plugin-react-refresh": "^0.4.12",
55-
"globals": "^15.9.0",
48+
"eslint-plugin-react": "^7.37.4",
49+
"eslint-plugin-react-hooks": "^5.1.0",
50+
"globals": "^15.14.0",
5651
"postcss": "^8.4.47",
5752
"prettier": "3.3.3",
5853
"prettier-plugin-tailwindcss": "^0.6.8",
5954
"rollup-plugin-visualizer": "^5.14.0",
6055
"tailwindcss": "^3.4.14",
6156
"typescript": "^5.5.3",
62-
"typescript-eslint": "^8.7.0",
57+
"typescript-eslint": "^8.20.0",
6358
"vite": "^5.4.8"
6459
}
6560
}

apps/client/src/components/Header.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,27 @@ function Header() {
3737
.catch(console.error);
3838

3939
return (
40-
<>
41-
<div className='h-16 w-full bg-white px-4 py-4 shadow'>
42-
<div className='mx-auto flex h-full w-full max-w-[1194px] items-center justify-between px-4'>
43-
<Link to='/' className='font-header text-2xl'>
44-
<span className='text-indigo-600'>A</span>
45-
<span className='text-black'>sk-It</span>
46-
</Link>
47-
<div className='flex items-center justify-center gap-2.5'>
48-
<Button
49-
className='hover:bg-gray-200 hover:text-white hover:transition-all'
50-
onClick={isLogin ? handleLogout : openSignInModal}
51-
>
52-
<p className='text-base font-bold text-black'>{isLogin ? '로그아웃' : '로그인'}</p>
53-
</Button>
54-
<Button className='bg-indigo-600' onClick={isLogin ? () => navigate({ to: '/my' }) : openSignUpModal}>
55-
<p className='text-base font-bold text-white'>{isLogin ? '세션 기록' : '회원가입'}</p>
56-
</Button>
57-
</div>
40+
<div className='h-16 w-full bg-white px-4 py-4 shadow'>
41+
<div className='mx-auto flex h-full w-full max-w-[1194px] items-center justify-between px-4'>
42+
<Link to='/' className='font-header text-2xl'>
43+
<span className='text-indigo-600'>A</span>
44+
<span className='text-black'>sk-It</span>
45+
</Link>
46+
<div className='flex items-center justify-center gap-2.5'>
47+
<Button
48+
className='hover:bg-gray-200 hover:text-white hover:transition-all'
49+
onClick={isLogin ? handleLogout : openSignInModal}
50+
>
51+
<p className='text-base font-bold text-black'>{isLogin ? '로그아웃' : '로그인'}</p>
52+
</Button>
53+
<Button className='bg-indigo-600' onClick={isLogin ? () => navigate({ to: '/my' }) : openSignUpModal}>
54+
<p className='text-base font-bold text-white'>{isLogin ? '세션 기록' : '회원가입'}</p>
55+
</Button>
5856
</div>
5957
</div>
6058
{SignUp}
6159
{SignIn}
62-
</>
60+
</div>
6361
);
6462
}
6563

0 commit comments

Comments
 (0)