Skip to content

Commit

Permalink
Wire up git commit hooks via husky + lint-staged
Browse files Browse the repository at this point in the history
Format CSS, JS, RB, and TF files on commit.
  • Loading branch information
matthinz committed Mar 28, 2022
1 parent 50c5885 commit 26c7308
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 8 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
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@
"build:css": "postcss ./app/assets/stylesheets/application.postcss.css -o ./app/assets/builds/application.css",
"lint:js": "prettier --check app/javascript",
"lint:css": "prettier --check app/assets/stylesheets",
"prettify": "prettier --write app/javascript app/assets/stylesheets"
"prettify": "prettier --write app/javascript app/assets/stylesheets",
"prepare": "husky install"
},
"devDependencies": {
"husky": ">=6",
"lint-staged": ">=10",
"pa11y-ci": "^3.0.1",
"prettier": "2.6.1"
},
"resolutions": {
"netlify-cms-app/**/trim": "0.0.3"
},
"lint-staged": {
"*.{jsx?,s?css}": "prettier --write",
"*.rb": "bundle exec standardrb --fix",
"*.tf": "terraform fmt"
}
}
Loading

0 comments on commit 26c7308

Please sign in to comment.