๐Ÿ™Œ๐Ÿปย ๋…ผ์˜ ์‚ฌํ•ญ

์ฝ”๋“œ ์ปจ๋ฒค์…˜ ์ •ํ•˜๊ธฐ

1. ๋ณ€์ˆ˜๋ช…, ํ•จ์ˆ˜๋ช…
๋ณ€์ˆ˜ / ํ•จ์ˆ˜ : camelCase
์ƒ์ˆ˜: SNAKE_CASE / ๋Œ€๋ฌธ์ž
์‹๋ณ„์ž/ํด๋ž˜์Šค/์ปดํฌ๋„ŒํŠธ/์ธํ„ฐํŽ˜์ด์Šค : PascalCase

(ts ํŒŒ์ผ์€ camelCase / tsx ํŒŒ์ผ์€ PascalCase)
ts ํŒŒ์ผ ๋‹ด์€ ๋””๋ ‰ํ† ๋ฆฌ๋ช… : camelCase
์ปดํฌ๋„ŒํŠธ(tsx) ๋””๋ ‰ํ† ๋ฆฌ๋ช… : PascalCase

2. ํ•จ์ˆ˜, ์ปดํฌ๋„ŒํŠธ ์ž‘์„ฑ
pages ์•ˆ ํŽ˜์ด์ง€ ๋ Œ๋”๋ง ํŒŒ์ผ๋“ค์€ camelCase
์ปดํฌ๋„ŒํŠธ ๋งŒ๋“ค ๋•Œ export default ํ•จ์ˆ˜ ๋ช… ์•ž์— ๋ถ™์ธ๋‹ค.
ํ•จ์ˆ˜ ์„ ์–ธ์‹ ์‚ฌ์šฉ function Button() {}
ex)
export function Button() {
	const handleClick = () => {}
	return <button onClick={handleClick }></button>
}

3. ์ด๋ฒคํŠธํ•ธ๋“ค๋Ÿฌ
camelCase(handleLoginButtonClick / onClickLoginButton)

prop์œผ๋กœ ๋„˜๊ฒจ์ฃผ๋Š” ์ด๋ฒคํŠธ: on(onClick)
์ง์ ‘ ์ฒ˜๋ฆฌํ•˜๋Š” ์ด๋ฒคํŠธ: handle(handleClick)
ex)
<Button onClick={handleClick} />
export function Button({ onClick }) {
	return <button onClick={onClick}></button>
}

4. import order
    - ๋ฆฌ์•กํŠธ ํ›…
    - ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
    - ์ปดํฌ๋„ŒํŠธ
    - ์ด๋ฏธ์ง€
    - css
    
5. ESLint
{
  "extends": ["next/core-web-vitals", "prettier"]
}

6. Prettier
{
  "arrowParens": "avoid",
  "bracketSpacing": true,
  "bracketSameLine": true,
  "jsxBracketSameLine": true,
  "jsxSingleQuote": false,
  "printWidth": 120,
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "es5",
  "endOfLine": "auto"
}

์ฐธ๊ณ . StyleLint
{
  "extends": [
    "stylelint-config-idiomatic-order",
    "stylelint-config-prettier-scss",
    "stylelint-config-standard-scss"
  ],
  "plugins": [
    "stylelint-scss",
    "stylelint-order"
  ],
  "ignoreFiles": [
    "@/src/styles/reset.scss"
  ],
  "rules": {
    "color-hex-length": "long",
    "selector-class-pattern": "^([a-z][a-zA-Z0-9]*)$",
    "scss/at-mixin-pattern": "^.[a-z]+(-[a-z0-9])*",
    "scss/dollar-variable-pattern": "^.[a-z]+(-[a-z0-9])*",
    "scss/percent-placeholder-pattern": "^.[a-z]+(-[a-z0-9])*"
  }
}

R&R

์ธ์ฆ&ํ”„๋กœํ•„ - 1, 2 =>์„œ์ธ

์ƒํ’ˆ ๋ชฉ๋ก(ํ™ˆ) - 3 => ๋ด‰์ฐฌ

์ƒํ’ˆ ์ƒ์„ธ(๊ธฐ๋ณธ) - 4.1, 4.4, 4.6 => ์†ก์€

์ƒํ’ˆ ์ƒ์„ธ(๊ณต๋™ ๊ตฌ๋งค) - 4.2, 4.3, 4.5 => ๋ฏผ์˜

๊ฒฐ์ œ(์ฃผ๋ฌธ์„œ) + ์žฅ๋ฐ”๊ตฌ๋‹ˆ - 5, 6 => ์ง€์›

์ดˆ๊ธฐ ์„ธํŒ…

๋ด‰์ฐฌ: ํด๋”๊ตฌ์กฐ / husky / github acrions

๋ฏผ์˜: prettier

์„œ์ธ: ๊นƒํ—ˆ๋ธŒ ์ด์Šˆ, PR ํ…œํ”Œ๋ฆฟ

๊ณตํ†ต ์ปดํฌ๋„ŒํŠธ

๐Ÿ™Œ๐Ÿปย ์ œ์•ˆ ์‚ฌํ•ญ

๋ฐ์ผ๋ฆฌ์Šคํฌ๋Ÿผ ํ˜•์‹ ์ œ์•ˆ โ‡’ ํšŒ์˜ ์ „์— ๋ฏธ๋ฆฌ ์ž‘์„ฑ

์ด์„œ์ธ