Skip to content

Commit 8a8ff19

Browse files
authored
chore: enable running prettier on precommit using husky and lint-staged (#225)
docs: * Prettier pre-commit hook https://prettier.io/docs/en/precommit.html * Using lint-staged in a multi package monorepo http://bit.ly/2DFStRB * Limit running prettier to TS/MD/JSON files in packages folder as of now
1 parent 04592b7 commit 8a8ff19

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@
2626
},
2727
"devDependencies": {
2828
"generate-changelog": "^1.7.1",
29+
"husky": "^2.1.0",
2930
"jest": "^20.0.4",
3031
"lerna": "3.11.0",
32+
"lint-staged": "^8.1.5",
33+
"prettier": "1.17.0",
3134
"typescript": "^3.0.0"
3235
},
3336
"workspaces": [
@@ -50,5 +53,21 @@
5053
"<rootDir>/packages/client-.*",
5154
"/__fixtures__/"
5255
]
56+
},
57+
"husky": {
58+
"hooks": {
59+
"pre-commit": "lint-staged"
60+
}
61+
},
62+
"lint-staged": {
63+
"linters": {
64+
"packages/**/*.{ts,json}": [
65+
"prettier --write",
66+
"git add"
67+
]
68+
},
69+
"ignore": [
70+
"package.json"
71+
]
5372
}
5473
}

0 commit comments

Comments
 (0)