Skip to content

Commit 3792ecc

Browse files
committed
use husky, lint-staged, and prettier-plugin-solidity to format code on commit
1 parent fdb8e85 commit 3792ecc

File tree

4 files changed

+230
-12
lines changed

4 files changed

+230
-12
lines changed

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn run lint-staged

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ Install dependencies via Yarn:
7777
yarn install
7878
```
7979

80+
Setup Husky to format code on commit:
81+
82+
```bash
83+
yarn prepare
84+
```
85+
8086
Link local packages and install remaining dependencies via Lerna:
8187

8288
```bash

package.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
"license": "MIT",
66
"scripts": {
77
"lerna-publish": "yarn build && lerna publish",
8-
"build": "lerna run tsc"
8+
"build": "lerna run tsc",
9+
"prepare": "husky install"
10+
},
11+
"lint-staged": {
12+
"*.{js,sol}": [
13+
"prettier --write"
14+
]
915
},
1016
"devDependencies": {
1117
"@nomiclabs/hardhat-ethers": "^2.0.2",
@@ -23,8 +29,11 @@
2329
"hardhat-abi-exporter": "^2.2.1",
2430
"hardhat-gas-reporter": "^1.0.4",
2531
"hardhat-spdx-license-identifier": "^2.0.3",
32+
"husky": "^7.0.1",
2633
"lerna": "^4.0.0",
34+
"lint-staged": "^11.0.0",
2735
"prettier": "^2.3.2",
36+
"prettier-plugin-solidity": "^1.0.0-beta.14",
2837
"solidity-coverage": "^0.7.16",
2938
"ts-node": "^10.0.0",
3039
"typechain": "^5.1.1",

0 commit comments

Comments
 (0)