Skip to content

Commit 6865457

Browse files
committed
chore: commitlint와 husky를 이용한 커밋 메세지 컨벤션 적용
commitlint와 husky를 이용하여 commit-msg hook에서 커밋 메세지의 내용을 확인하도록 하고, pre-commit hook에서 stage에 올려진 파일들을 대상으로 lint를 수행하도록 함 Signed-off-by: chayeoi <[email protected]>
1 parent 9614203 commit 6865457

File tree

4 files changed

+660
-25
lines changed

4 files changed

+660
-25
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
commitlint.config.js
12
gatsby-browser.js
23
gatsby-config.js
34
gatsby-node.js

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
"typeface-montserrat": "^0.0.75"
3838
},
3939
"devDependencies": {
40+
"@commitlint/cli": "^8.3.5",
41+
"@commitlint/config-conventional": "^8.3.4",
4042
"@types/lodash": "^4.14.149",
4143
"@types/node": "^13.7.0",
4244
"@types/react": "^16.9.19",
@@ -53,6 +55,8 @@
5355
"eslint-plugin-react": "^7.18.3",
5456
"eslint-plugin-react-hooks": "^2.3.0",
5557
"eslint-plugin-simple-import-sort": "^5.0.1",
58+
"husky": "^4.2.1",
59+
"lint-staged": "^10.0.7",
5660
"prettier": "^1.19.1",
5761
"typescript": "^3.7.5"
5862
},
@@ -77,5 +81,17 @@
7781
},
7882
"bugs": {
7983
"url": "https://github.com/chayeoi/blog"
84+
},
85+
"husky": {
86+
"hooks": {
87+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
88+
"pre-commit": "lint-staged"
89+
}
90+
},
91+
"lint-staged": {
92+
"src/**/*.{js,jsx,ts,tsx}": [
93+
"eslint",
94+
"git add"
95+
]
8096
}
8197
}

0 commit comments

Comments
 (0)