Skip to content

Commit

Permalink
add husky: enforce prettier, prompt for yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomEtc committed Oct 1, 2023
1 parent 55a965d commit c3cef2c
Show file tree
Hide file tree
Showing 5 changed files with 267 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 @@
_
8 changes: 8 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

CHANGED=$(git diff "$1" "$2" --stat -- ./yarn.lock | wc -l)
if (( CHANGED > 0 )); then
echo "📦 yarn.lock changed. Run yarn install to bring your dependencies up to date."
fi
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx git-branch-is --not main
npx lint-staged
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"serve:widget": "parcel serve ./src/*.html --dist-dir build",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"lint": "prettier --check . && eslint ."
"lint": "prettier --check . && eslint .",
"prepare": "husky install"
},
"browserslist": {
"production": [
Expand All @@ -34,6 +35,8 @@
"@typescript-eslint/parser": "^6.1.0",
"cypress": "^12.6.0",
"eslint": "^8.45.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"parcel": "v2.8.3",
"postcss": "^8.4.21",
"postcss-modules": "^6.0.0",
Expand All @@ -59,5 +62,8 @@
"sourceMap": false,
"publicUrl": "./"
}
},
"lint-staged": {
"**/*.{js,ts,json,md,css,html}": "prettier --write"
}
}
Loading

0 comments on commit c3cef2c

Please sign in to comment.