๐ฉโ๐ป Coding Convention - Team-Wordi/Wordi GitHub Wiki
์ฝ๋ฉ ์ปจ๋ฒค์
import ๊ท์น
- ์ธ๋ถ ๋ชจ๋๊ณผ ๋ด๋ถ๋ชจ๋์ ๊ตฌ๋ถํ์ฌ ์ฌ์ฉํ๋ค. ์ธ๋ถ๋ชจ๋๊ณผ ๋ด๋ถ๋ชจ๋ ์ ์ธ์ ๊ณต๋ฐฑ์ผ๋ก ๊ตฌ๋ถํ๋ค. ๋ด๋ถ๋ชจ๋์ ๊ฒฝ์ฐ ์ ๋ ๊ฒฝ๋ก๋ฅผ ์ฌ์ฉํ๋ ๋ชจ๋๊ณผ ์๋ ๊ฒฝ๋ก๋ฅผ ์ฌ์ฉํ๋ ๋ชจ๋์ ์ถ๊ฐ๋ก ๊ตฌ๋ถํ๋ค.
import axios from 'axios';
import router from '@service/router'
import util from './util'
๋ณ์, ํจ์, ํด๋์ค ๋ช ๋ช ๊ท์น
-
ํ์ผ๋ค์ด๋ฐ
- ์ปดํฌ๋ํธ โ
PascalCase
- ์ธ โ
cammelCase
- ์ปดํฌ๋ํธ โ
-
์์ โ
SNAKE_CASE
-
ํจ์ ๋ฐ ๋ณ์ โ
cammelCase
-
์ปดํฌ๋ํธ โ
PascalCase
-
์ฐฝ์์ ์ธ ๋จ์ด ์ฐ์ง ์๊ธฐ ๐ (์ ์ผ ๋ ์ค๋ฅด๊ธฐ ์ฝ๊ณ ๊ธฐ๋ณธ์ ์ธ ๋จ์ด)
-
๋ณ์๋ ๋ช ์ฌํ์ผ๋ก ์์ฑ
-
ํจ์๋ ์์ ํ์ผ๋ก ์์ฑ
๊ธฐํ ์ฝ๋ฉ ๊ท์น
- htmlํ๊ทธ ์ ์ธ ์ ์ต๋ํ ์๋ฉํฑํ ํ๊ทธ ์ฌ์ฉ
- ๋ชจ๋๊ฐ approve ํ ํ์ merge ํ ์ ์๋ค
- ์ฝ๋ ๋ฆฌ๋ทฐ๋ ํ์! ๊ผญ ํ์ธํ๊ธฐ! ๐
- html id + className์ snake_case๋ก ํ๋ค.
eslint & prettier
- ๊ธฐ๋ณธ์ ์ผ๋ก eslint airbnb๋ฅผ ๋ฐ๋ฅธ๋ค
- ์ถ๊ฐํ๊ณ ์ถ์ ๋ฃฐ์ด ์์ ๊ฒฝ์ฐ ์๊ฒฌ์ ์ ์ํด์ ๋ ผ์ ํ์ ๋ฐ์ ํ ์ ์๋ค
eslint
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'airbnb-base',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'linebreak-style': 0,
'import/prefer-default-export': 0,
'prettier/prettier': 0,
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
alias: {
map: [
['@api', './src/api'],
['@auth', './src/auth'],
['@config', './src/config'],
['@models', './src/models'],
['@util', './src/util/*'],
['@', './src'],
],
},
},
},
};
prettier
{
"singleQuote": true,
"parser": "typescript",
"semi": true,
"useTabs": false,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 100,
"arrowParens": "always"
}
tsconfig
{
"compilerOptions": {
"target": "es6",
"lib": ["es2015", "es2016", "es2017", "es2018", "es2019", "es2020"],
// sourceMap
"sourceMap": true,
// module
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
// lint
"strict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noFallthroughCasesInSwitch": true,
// more spec
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"baseUrl": ".",
"paths": {
"@api/*": ["src/api/*"],
"@auth/*": ["src/auth/*"],
"@config/*": ["src/config/*"],
"@models/*": ["src/models/*"],
"@util/*": ["src/util/*"],
"@/*": ["src/*"]
}
}
}