Code Convention
Daeun Kim edited this page Apr 2, 2023
·
1 revision
-
๋ณ์๋ช ์ ๊ธฐ๋ณธ์ ์ผ๋ก
camelCase
๋ฅผ ์ฌ์ฉํ๋ค. -
boolean ํ์ ๊ฐ๋ ๋ณ์๋ ์์
is
๋ฅผ ๋ถ์ธ๋ค. -
css๋ ๊ธฐ๋ณธ์ ์ผ๋ก
kebab-case
๋ฅผ ์ฌ์ฉํ๋ค. -
ํ์ ์ด๋ฆ์ type์
~Types
๋ก ํ๋ค. -
์ธํฐํ์ด์ค ์ด๋ฆ์ props type์
~Props
๋ก ํ๋ค.-
API : ์๋ต
~Response
,~Request
-
์์ ์ฝ๋
//๋๊ธ ์กฐํ export interface CommentReadResponse extends BaseResponse { data?: PaginationResponse<CommentProps>; }
// base export interface BaseResponse { message?: string; status?: number; code?: string; } export interface PaginationResponse<T> { content: T[]; numberOfElements: number; //content์ ์์๊ฐ ๋ช๊ฐ์ธ์ง offset: number; // ํ์ฌ ํ์ด์ง์์ ์์ํ๋ ์์์ index ๋ฒํธ pageNumber: number; //ํ์ด์ง ๋๋ฒ pageSize: number; //ํ์ด์ง ์ฌ์ด์ฆ totalElements: number; // ์ ์ฒด ์์ ์ totalPage: number; }
-
-
props๋ก ๋ฐ๋ className string์
styleClass
๋ก ํต์ผํ๋ค.- className ์ฌ๋ฌ ๊ฐ ์ฌ์ฉํ๋ ์ปดํฌ๋ํธ๋
์ปดํฌ๋ํธ + style
๋ก ํต์ผํ๋ค.
- className ์ฌ๋ฌ ๊ฐ ์ฌ์ฉํ๋ ์ปดํฌ๋ํธ๋
- ํจ์๋ช
์ ๊ธฐ๋ณธ์ ์ผ๋ก
camelCase
๋ฅผ ์ฌ์ฉํ๋ค. - ๊ฐ๋ฅํ ๋์ฌ + ๋ช ์ฌ์ ํํ๋ฅผ ์ฌ์ฉํ๋ค.
- ํจ์๋ช ์ ์ถ์ฝํ์ง ์๋๋ค.
- ํจ์ํ ์ปดํฌ๋ํธ์ ๊ฒฝ์ฐ ์ฒซ ๊ธ์๋ฅผ ๋๋ฌธ์๋ก ์์ํ๋ค.
- ์ด๋ฒคํธ ํธ๋ค๋ฌ ํจ์ ์ด๋ฆ์
handle~
๋ก ํต์ผํ๋ค. - props ๋ด ์ด๋ฒคํธ ํธ๋ค๋ฌ๋
handleOn<EventName>
์ผ๋ก ํต์ผํ๋ค.
-
Component
์์๋ ๋ค์๊ณผ ๊ฐ์ด import, export ํ๋ค. ์ด ๋, import ํ ๊ฒฝ์ฐ์๋ ๋ฐ๋์[๊ฒฝ๋ก alias](https://github.com/dnd-side-project/dnd-8th-1-frontend/blob/develop/tsconfig.json)
๋ฅผ ์ฌ์ฉํ๋ค.import Layout from โ@componentsโ
export {Layout, Layout2...}
-
index
์์๋ ๋ค์๊ณผ ๊ฐ์ด import , export ํ๋ค.export { default as Layout } from './Layout';
export { default as Layout2 } from './Layout2';
- ์คํ์ผ ํด๋์ค ์ด๋ฆ์
kebab-case
๋ฅผ ์ด์ฉํ๋ค. -
Storybook
์ ํตํด ์ปดํฌ๋ํธ ๋ฌธ์ํ๋ฅผ ์งํํ๋ค.
- ๐ชฉ ์์ํ๊ธฐ
- ๐ ํ๋ก์ ํธ ๊ฐ์
- ๐๏ธ ํ ๋ฌธํ
- โ ๊ธฐ์ ์คํ ๋ฐ ์ ์ ์ด์
- โ ํ๋ก์ ํธ ์ค๊ณ
- ๐ท ํ์ด์ง ๋ณ ๊ธฐ๋ฅ
- ๐งฉ Code Review
- ๐ฅ Code Convention
- ๐ Git Convention
- ๐ ESLint + Prettier
- ๐ PR, Issue Template