Skip to content

Commit 462a02d

Browse files
committed
style: add prettier task on pre-commit hook with husky and lint-staged
1 parent 3bcbfb3 commit 462a02d

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

.huskyrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"pre-commit": "lint-staged"
4+
}
5+
}

.lintstagedrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{ts,tsx}": ["npm run lint:fix", "prettier --write"],
3+
"*.{js,jsx,css,md}": ["prettier --write"]
4+
}

package.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"conventional-changelog-cli": "2.0.31",
2424
"fetch-mock": "6.5.2",
2525
"http-server": "0.12.1",
26+
"husky": "4.2.5",
2627
"istanbul-instrumenter-loader": "3.0.1",
2728
"karma": "5.0.1",
2829
"karma-chrome-launcher": "3.1.0",
@@ -83,17 +84,6 @@
8384
"Hovhannes Babayan <bhovhannes@gmail.com>",
8485
"Sassoun Derderian <citizen.sas@gmail.com>"
8586
],
86-
"lint-staged": {
87-
"*.{ts,tsx}": [
88-
"npm run lint:fix",
89-
"prettier --write",
90-
"git add"
91-
],
92-
"*.{js,jsx,css,md}": [
93-
"prettier --write",
94-
"git add"
95-
]
96-
},
9787
"license": "Apache-2.0",
9888
"bugs": {
9989
"url": "https://github.com/Workfront/workfront-api/issues"

0 commit comments

Comments
 (0)