Skip to content

Commit 9da14b3

Browse files
committed
[FEATURE] Add husky pre-commit script for running lint-staged with prettier
1 parent 85bff92 commit 9da14b3

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

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

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
"version": "0.1.0",
44
"license": "MIT",
55
"scripts": {
6-
"prepare": "yarn build:dev:tailwindcss && poetry install",
6+
"prepare": "husky install && yarn build:dev:tailwindcss && poetry install",
77
"build:dev:tailwindcss": "tailwind build ./assets/css/tailwind.css -o ./static/css/tailwind.css && cleancss -o ./static/css/tailwind.min.css ./static/css/tailwind.css",
88
"dev": "webpack --mode development && poetry run python manage.py runserver",
99
"storybook": "start-storybook -p 6006",
1010
"build-storybook": "build-storybook"
1111
},
12+
"lint-staged": {
13+
"**/*.{js,jsx,ts,tsx,json,css,html,scss,md,mdx}": [
14+
"prettier --write"
15+
]
16+
},
1217
"devDependencies": {
1318
"@babel/core": "^7.12.13",
1419
"@babel/preset-env": "^7.12.13",

0 commit comments

Comments
 (0)