Code Convention
๐ต JavaScript
JavaScript Version
function
- ํ์ดํ ํจ์๋ฅผ ๊ธฐ๋ณธ์ผ๋ก ์ฌ์ฉํฉ๋๋ค.
import
- import๋ฌธ์ ์์๋ custom eslint rule์ ๋ฐ๋ฆ
๋๋ค.
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
pathGroups: [
{
pattern: '@/*',
group: 'internal',
position: 'after',
},
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
export
- export default๋ ๊ฐ์ฅ ํ๋จ์ ์์ฑํฉ๋๋ค.
- export๋ ๋ณ์ ์ ์ธ๊ณผ ํจ๊ป ์์ฑํฉ๋๋ค.
๐ต Naming Convention
constants
- ์์๋ ๋๋ฌธ์๋ก ์ฐ๋ฉฐ
_๋ก ๊ตฌ๋ถํฉ๋๋ค.
variables
- ์ฃผ๋ก camelCase๋ฅผ ์ฌ์ฉํฉ๋๋ค.
- ์ผ๋ฐ์ ์ผ๋ก๋ ๋ช
์ฌ๋ก ์์ํ๋ flag ๋ณ์์ผ ๊ฒฝ์ฐ is๋ has๋ก ์์ํฉ๋๋ค.
- button ๋ฑ์ ์์ด ๋จ์ด์ ๊ฒฝ์ฐ btn๊ฐ์ด ์ถ์ฝํ์ง ์๊ณ ๊ทธ๋๋ก ์์ฑํฉ๋๋ค.
function
- ๊ธฐ๋ณธ์ ์ผ๋ก camelCase๋ฅผ ์ฌ์ฉํฉ๋๋ค.
- ์์ฑ์ ํจ์์ ๊ฒฝ์ฐ, PascalCase๋ฅผ ์ฌ์ฉํฉ๋๋ค.
๋์ฌ๋ก ์์ํ๋ค.
- ์ด๋ฒคํธ ํธ๋ค๋ฌ์ ์ฝ๋ฐฑ ํจ์๋
handle[์ปดํฌ๋ํธ์ด๋ฆ][์ด๋ฒคํธ์ด๋ฆ]์ผ๋ก ์์ฑํฉ๋๋ค.
<DropDown onClick={handleDropDownClick}>
class
- PascalCase๋ฅผ ์ฌ์ฉํฉ๋๋ค.
interface, type
- PascalCase๋ฅผ ์ฌ์ฉํฉ๋๋ค.
- prefix(I, T์ ๊ฐ์)๋ฅผ ์ฌ์ฉํ์ง ์์ต๋๋ค.
๐ต Type Definition
- type alias๋ฅผ ๊ธฐ๋ณธ์ผ๋ก ์ฌ์ฉํฉ๋๋ค. ๊ทธ ์ด์ ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
- type alias๋ computed value๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
- type alias๋ IDE์์ ๋ง์ฐ์ค hover ์ ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ฅผ ๋ ์ ์ง์ํ๋ฏ๋ก ํธ๋ฆฌํฉ๋๋ค.
- type alias๋ ๊ฐ์ ์ด๋ฆ์ผ๋ก ์ค๋ณต ์ ์ธํ ์ ์์ผ๋ฏ๋ก ์์น ์๋ ์ ์ธ ๋ณํฉ์ ๋ง์์ค๋๋ค.
type names = 'firstName' | 'lastName'
type NameTypes = {
[key in names]: string
}
interface NameInterface {
[key in names]: string
}
const yc: NameTypes = { firstName: 'hi', lastName: 'yc' }
- ์ธํฐํ์ด์ค๊ฐ ํ์ํ ๊ฒฝ์ฐ, ์ธํฐํ์ด์ค๋ฅผ ์ฌ์ฉํฉ๋๋ค.
- Component์ Props ํ์
์ง์ ์ Props suffix๋ฅผ ๋ถ์ฌ์ ์์ฑํฉ๋๋ค.
Branch Strategy
- ์ ํฌ ํ๋ก์ ํธ์๋ Github Flow๋ก ํ๊ธฐ๋ก ๊ฒฐ์ ํ์ต๋๋ค.
- ๊ทผ๊ฑฐ
- git-flow์ ๋นํด ๊ด๋ฆฌํ๋ ๋ธ๋์น ๊ฐฏ์๊ฐ ์ ๊ธฐ ๋๋ฌธ์ ๋ฒ์ ๊ด๋ฆฌ๊ฐ ์ฝ์ต๋๋ค.
- PR์ ํตํด ํ์๊ณผ ์์ ํ mergeํด์ main ๋ธ๋์น์์ ๋ฐฐํฌํด๋ ์ถฉ๋ถํ๋ค๊ณ ์๊ฐํ๊ณ ์๊ฐํ์ต๋๋ค.
# main [Infinite Lifetime]
- ์ฌ์ฉ์์๊ฒ ๋ฐฐํฌ๋ ์ฝ๋๋ฅผ ๊ด๋ฆฌํ๋ ๋ธ๋์น
- Tag๋ฅผ ๋ถ์ฌ์ release ์ด๋ ฅ์ ๊ด๋ฆฌํฉ๋๋ค.
# feature, refactor, fix [Short Lifetime]
- main ๋ธ๋์น์์ ๋ถ๊ธฐ๋๋ค.
- ์ถ์๋ฅผ ํ๊ธฐ ์ํด main์ PR์ ๋ณด๋ด๋ฉด merge๋ ์ ์์ต๋๋ค.
- Example
- feature/#15-login
- refactor/#30-community-page
- fix/#54-navbar-bug