Skip to content

Commit f08a47d

Browse files
committed
Add Husky + Lint-staged
1 parent 79c8083 commit f08a47d

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
package-lock.json
22
dist/
3+
.idea
4+
node_modules

.husky/post-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
git update-index --again

.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+
npx lint-staged

package.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"lint": "eslint . --ext .ts",
99
"test": "mocha __tests__/**/*.test.ts",
1010
"test:browser": "karma start",
11-
"test:all": "npm run test; npm run test:browser"
11+
"test:all": "npm run test; npm run test:browser",
12+
"prepare": "husky install"
1213
},
1314
"author": {
1415
"name": "Mikhail Shustov",
@@ -54,13 +55,21 @@
5455
"karma-chrome-launcher": "^3.1.1",
5556
"karma-mocha": "^2.0.1",
5657
"karma-webpack": "^5.0.0",
58+
"lint-staged": "^13.0.3",
5759
"mocha": "^10.0.0",
5860
"prettier": "2.7.1",
5961
"sinon": "^14.0.0",
6062
"ts-loader": "^9.3.1",
6163
"ts-node": "^10.9.1",
6264
"typescript": "^4.7.4",
6365
"webpack": "^5.74.0",
64-
"webpack-cli": "^4.10.0"
66+
"webpack-cli": "^4.10.0",
67+
"husky": "^7.0.0"
68+
},
69+
"lint-staged": {
70+
"*.ts": [
71+
"prettier --write",
72+
"eslint --fix"
73+
]
6574
}
6675
}

0 commit comments

Comments
 (0)