β
Coding Convention
React
- ν¨μν νλ‘κ·Έλλ°μΌλ‘ μμ
νλ€.
- νμ΄ν ν¨μλ₯Ό μ¬μ©νλ€.
- varλ₯Ό μ°μ§ μκ³ , constμ letμΌλ‘ ꡬμ±νλ€. κ·Έλ¦¬κ³ μ΄λ constλ₯Ό letλ³΄λ€ μμ μ μΈνλ€.
- λ³μλͺ
μ camelCaseλ‘ μμ±νλ€.
- λ°°μ΄κ³Ό κ°μ²΄λ λ°λμ 리ν°λ΄λ‘ μ μΈνλ€.
- λ³μ λ±μ μ‘°ν©ν΄μ λ¬Έμμ΄μ μμ±νλ κ²½μ° ν
νλ¦Ώ λ¬Έμμ΄μ μ΄μ©νλ€.
- 쑰건μ νμΈν λλ μΌμ€ λ±νΈ μ°μ°μμΈ === νΉμ !== λ§ μ¬μ©νλ€.
TailWind
- ν΄λμ€λͺ
μ μΌλ°₯μΌμ΄μ€λ‘ μ¬μ©
- μ¬μ¬μ© κ°λ₯ν λΆλΆμ ν΄λμ€λ‘ λ§λ€κΈ°
prettier
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": false,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "auto",
"editor.formatOnSave": false,
"editor.wordWrap": "on"
}
esLint
rules: {
// varλ μ¬μ©ν μ μλ€
'no-var': ['error'],
// μΈλ―Έμ½λ‘ μ μ¬μ©νμ§ μκ² λ€(νμ
μ€ν¬λ¦½νΈ νλ‘μ νΈμμ κΆμ₯)
semi: ['error', 'never'],
// Function.prototype.apply() λ₯Ό μ¬μ©ν λλ spread μ°μ°μλ₯Ό μ¬μ©ν΄μΌ νλ€
'prefer-spread': ['error'],
// μ μΈν ννμμ λ°λμ μ¬μ©ν΄μΌ νλ€
'no-unused-expressions': ['error'],
// Function κ°μ²΄μ new μ°μ°μλ₯Ό μ¬μ©ν μ μλ€
'no-new-func': ['error'],
// μμ±μ ν¨μλ returnμ ν μ μλ€
'no-constructor-return': ['error'],
// if λ¬Έμμ returnμ νλ©΄ else λ¬Έμμ returnμ ν μ μλ€
'no-else-return': ['error'],
// μμ νμ§ λͺ»ν μ΅μ
λ 체μ΄λμ ν μ μλ€
'no-unsafe-optional-chaining': ['error'],
// λΆνμν λ°λ³΅λ¬Έμ μ¬μ©ν μ μλ€
'no-unreachable-loop': ['error'],
// νλΌλ―Έν°λ μ½κΈ° μ μ©μ΄λ€
'no-param-reassign': ['error'],
// μ μΈνμ§ μμ μ½λλ₯Ό μ¬μ©ν μ μλ€
'no-use-before-define': ['error'],
// if ~ else μ€μ²©μ νμ©νμ§ μλλ€
'max-depth': [
'error',
{
max: 3,
},
],
// return λ¬Έ μ΄μ μλ λ°λμ λΉ μ€μ΄ μμ΄μΌ νλ€
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: '*',
next: 'return',
},
],
// λ¬Έμμ΄ μ μΈμλ νλ°μ΄νλ₯Ό μ¬μ©νλ€
quotes: [
'error',
'single',
{
avoidEscape: true,
},
],
// μ€μ²©λ object μλ€μλ κ³΅λ°±μ΄ μμ΄μΌ νλ€.
'object-curly-spacing': ['error', 'always'],
// μ€μ²©λ λ°°μ΄ μλ€μλ κ³΅λ°±μ΄ μμΌλ©΄ μλλ€
'array-bracket-spacing': ['error', 'never'],
// μ€κ΄νΈμ μ€νμΌμ ν΅μΌ
'brace-style': ['error'],
// no-alert λ£°κ³Ό μΆ©λνλ―λ‘ λ
'no-restricted-globals': ['off'],
// alert, confirm, prompt λ μ¬μ©μ κΆμ₯νμ§ μλλ€
'no-alert': ['warn'],
// console.log λ μ¬μ©ν μ μλ€
'no-console': [
'warn',
{
allow: ['warn', 'error'],
},
],
// jsxμλ μ λ°μ΄νλ₯Ό μ¬μ©ν΄μΌ νλ€.
'jsx-quotes': ['error', 'prefer-double'],
// λ¬Έμμ΄ μ°κ²°μλ ν
νλ¦Ώ λ¬Έμμ΄μ μ¬μ©ν΄μΌ νλ€
'prefer-template': ['error'],
// κ°μ²΄μ νλ‘νΌν° μ΄λ¦μ νμν λλ§ λ°μ΄νλ‘ κ°μΈμΌ νλ€
'quote-props': ['error', 'as-needed'],
}