Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 0d419c4

Browse files
committed
migrate from husky to lefthook
1 parent 56b681b commit 0d419c4

File tree

3 files changed

+28
-206
lines changed

3 files changed

+28
-206
lines changed

lefthook.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
2+
3+
pre-commit:
4+
parallel: true
5+
commands:
6+
eslint:
7+
glob: '*.{js,jsx,ts,tsx}'
8+
run: npx eslint --config=.eslintrc.js --fix {staged_files}
9+
stylelint:
10+
glob: '*.{css,scss}'
11+
run: npx stylelint --config=stylelint.config.js --fix {staged_files}
12+
prettier:
13+
glob: '*.{md,html,json,yml}'
14+
run: npx prettier --config=prettier.config.js --write {staged_files}

package.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"dev": "yarn clean && next dev",
2525
"develop": "yarn dev",
2626
"export": "next export",
27-
"format": "npx prettier --config=prettier.config.js '**/*.{js,jsx,ts,tsx,md,html,css,scss,json}' --write || true",
27+
"format": "npx prettier --config=prettier.config.js '**/*.{js,jsx,ts,tsx,md,html,css,scss,json,yml}' --write || true",
2828
"lint": "yarn format && yarn lint:js && yarn lint:css",
2929
"lint:css": "npx stylelint --config=stylelint.config.js '**/*.css' --fix || true",
3030
"lint:js": "npx eslint --config=.eslintrc.js ./ --fix || true",
@@ -39,6 +39,7 @@
3939
},
4040
"devDependencies": {
4141
"@apollo/client": "^3.3.8",
42+
"@arkweid/lefthook": "^0.7.2",
4243
"@babel/core": "^7.12.13",
4344
"@storybook/addon-a11y": "^6.1.17",
4445
"@storybook/addon-essentials": "^6.1.17",
@@ -62,8 +63,6 @@
6263
"graphql": "^15.5.0",
6364
"graphql-anywhere": "^4.2.7",
6465
"hamburger-react": "^2.4.0",
65-
"husky": "^4.3.8",
66-
"lint-staged": "^10.5.4",
6766
"next-seo": "^4.19.0",
6867
"next-sitemap": "^1.4.19",
6968
"postcss-flexbugs-fixes": "^4.2.1",
@@ -80,15 +79,5 @@
8079
"stylelint-config-standard": "^20.0.0",
8180
"tailwindcss": "npm:@tailwindcss/postcss7-compat",
8281
"yup": "^0.32.8"
83-
},
84-
"husky": {
85-
"hooks": {
86-
"pre-commit": "lint-staged"
87-
}
88-
},
89-
"lint-staged": {
90-
"*.{js,jsx,ts,tsx}": "npx eslint --config=.eslintrc.js --fix",
91-
"*.{css,scss}": "npx stylelint --config=stylelint.config.js --fix",
92-
"*.{md,html,json}": "npx prettier --config=prettier.config.js --write"
9382
}
9483
}

0 commit comments

Comments
 (0)