Skip to content

Commit

Permalink
install lint-staged to automatically prettify files at commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Elindorath committed Oct 4, 2021
1 parent 70eb3ab commit 152fdf7
Show file tree
Hide file tree
Showing 5 changed files with 331 additions and 11 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'*.{js,css,md}': 'yarn prettify',
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"test": "mocha -r @babel/register -r @babel/polyfill --recursive test/*.test.js test/**/*.test.js",
"watch": "babel src -d dist -w",
"prettify": "prettier --write \"{src,test}/**/*.js\"",
"build": "yarn -s prettify && babel src -d dist"
"build": "yarn -s prettify && babel src -d dist",
"prepare": "husky install"
},
"files": [
"bin/",
Expand Down Expand Up @@ -61,6 +62,8 @@
"broccoli-funnel": "^3.0.4",
"chai": "^4.1.2",
"gulp": "^4.0.0",
"husky": ">=7.0.2",
"lint-staged": ">=11.1.2",
"mocha": "^9.0.0",
"nyc": "^15.1.0",
"prettier": "2.4.1",
Expand Down
Loading

0 comments on commit 152fdf7

Please sign in to comment.