refator: fix pre-commit hook

This commit is contained in:
fantasticit 2022-05-01 20:28:21 +08:00
parent 61762998fd
commit fd6e57e6a7
3 changed files with 26 additions and 58 deletions

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
pnpm run precommit

View File

@ -22,7 +22,9 @@
"pm2:client": "pnpm run --dir packages/client pm2", "pm2:client": "pnpm run --dir packages/client pm2",
"format": "concurrently \"pnpm:format:*\"", "format": "concurrently \"pnpm:format:*\"",
"format:ts": "prettier --write --parser typescript \"git status\"", "format:ts": "prettier --write --parser typescript \"git status\"",
"format:css": "stylelint --fix --formatter verbose --allow-empty-input \"packages/**/*.{css,scss,sass}\"" "format:css": "stylelint --fix --formatter verbose --allow-empty-input \"packages/**/*.{css,scss,sass}\"",
"prepare": "husky install",
"precommit": "lint-staged"
}, },
"dependencies": { "dependencies": {
"concurrently": "^7.0.0", "concurrently": "^7.0.0",
@ -34,8 +36,8 @@
"node": ">=16.5.0" "node": ">=16.5.0"
}, },
"devDependencies": { "devDependencies": {
"husky": "^7.0.4",
"lint-staged": "^12.4.1", "lint-staged": "^12.4.1",
"pre-commit": "^1.2.2",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"stylelint": "^14.6.1", "stylelint": "^14.6.1",
"stylelint-config-css-modules": "^4.1.0", "stylelint-config-css-modules": "^4.1.0",
@ -49,10 +51,5 @@
"lint-staged": { "lint-staged": {
"*.{ts,tsx,js,jsx}": "prettier --write", "*.{ts,tsx,js,jsx}": "prettier --write",
"*.{css,scss,sass}": " stylelint --fix --formatter verbose --allow-empty-input" "*.{css,scss,sass}": " stylelint --fix --formatter verbose --allow-empty-input"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
} }
} }

View File

@ -7,8 +7,8 @@ importers:
concurrently: ^7.0.0 concurrently: ^7.0.0
cross-env: ^7.0.3 cross-env: ^7.0.3
fs-extra: ^10.0.0 fs-extra: ^10.0.0
husky: ^7.0.4
lint-staged: ^12.4.1 lint-staged: ^12.4.1
pre-commit: ^1.2.2
prettier: ^2.3.2 prettier: ^2.3.2
rimraf: ^3.0.2 rimraf: ^3.0.2
stylelint: ^14.6.1 stylelint: ^14.6.1
@ -25,8 +25,8 @@ importers:
fs-extra: 10.0.0 fs-extra: 10.0.0
rimraf: 3.0.2 rimraf: 3.0.2
devDependencies: devDependencies:
husky: 7.0.4
lint-staged: 12.4.1 lint-staged: 12.4.1
pre-commit: 1.2.2
prettier: 2.5.1 prettier: 2.5.1
stylelint: 14.6.1 stylelint: 14.6.1
stylelint-config-css-modules: 4.1.0_stylelint@14.6.1 stylelint-config-css-modules: 4.1.0_stylelint@14.6.1
@ -3166,6 +3166,7 @@ packages:
inherits: 2.0.4 inherits: 2.0.4
readable-stream: 2.3.7 readable-stream: 2.3.7
typedarray: 0.0.6 typedarray: 0.0.6
dev: false
/concurrently/7.0.0: /concurrently/7.0.0:
resolution: {integrity: sha512-WKM7PUsI8wyXpF80H+zjHP32fsgsHNQfPLw/e70Z5dYkV7hF+rf8q3D+ScWJIEr57CpkO3OWBko6hwhQLPR8Pw==} resolution: {integrity: sha512-WKM7PUsI8wyXpF80H+zjHP32fsgsHNQfPLw/e70Z5dYkV7hF+rf8q3D+ScWJIEr57CpkO3OWBko6hwhQLPR8Pw==}
@ -3233,6 +3234,7 @@ packages:
/core-util-is/1.0.3: /core-util-is/1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
dev: false
/cors/2.8.5: /cors/2.8.5:
resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}
@ -3276,14 +3278,6 @@ packages:
cross-spawn: 7.0.3 cross-spawn: 7.0.3
dev: false dev: false
/cross-spawn/5.1.0:
resolution: {integrity: sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=}
dependencies:
lru-cache: 4.1.5
shebang-command: 1.2.0
which: 1.3.1
dev: true
/cross-spawn/7.0.3: /cross-spawn/7.0.3:
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
@ -4422,6 +4416,12 @@ packages:
ms: 2.1.3 ms: 2.1.3
dev: false dev: false
/husky/7.0.4:
resolution: {integrity: sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==}
engines: {node: '>=12'}
hasBin: true
dev: true
/iconv-lite/0.4.24: /iconv-lite/0.4.24:
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -4803,6 +4803,7 @@ packages:
/isarray/1.0.0: /isarray/1.0.0:
resolution: {integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=} resolution: {integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=}
dev: false
/isarray/2.0.5: /isarray/2.0.5:
resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==}
@ -5744,6 +5745,7 @@ packages:
dependencies: dependencies:
pseudomap: 1.0.2 pseudomap: 1.0.2
yallist: 2.1.2 yallist: 2.1.2
dev: false
/lru-cache/5.1.1: /lru-cache/5.1.1:
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
@ -6290,11 +6292,6 @@ packages:
windows-release: 4.0.0 windows-release: 4.0.0
dev: true dev: true
/os-shim/0.1.3:
resolution: {integrity: sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=}
engines: {node: '>= 0.4.0'}
dev: true
/os-tmpdir/1.0.2: /os-tmpdir/1.0.2:
resolution: {integrity: sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=} resolution: {integrity: sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -6602,15 +6599,6 @@ packages:
source-map-js: 1.0.2 source-map-js: 1.0.2
dev: false dev: false
/pre-commit/1.2.2:
resolution: {integrity: sha1-287g7p3nI15X95xW186UZBpp7sY=}
requiresBuild: true
dependencies:
cross-spawn: 5.1.0
spawn-sync: 1.0.15
which: 1.2.14
dev: true
/prelude-ls/1.1.2: /prelude-ls/1.1.2:
resolution: {integrity: sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=} resolution: {integrity: sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=}
engines: {node: '>= 0.8.0'} engines: {node: '>= 0.8.0'}
@ -6639,6 +6627,7 @@ packages:
/process-nextick-args/2.0.1: /process-nextick-args/2.0.1:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
dev: false
/prompts/2.4.2: /prompts/2.4.2:
resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}
@ -6787,6 +6776,7 @@ packages:
/pseudomap/1.0.2: /pseudomap/1.0.2:
resolution: {integrity: sha1-8FKijacOYYkX7wqKw0wa5aaChrM=} resolution: {integrity: sha1-8FKijacOYYkX7wqKw0wa5aaChrM=}
dev: false
/psl/1.8.0: /psl/1.8.0:
resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==} resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==}
@ -7056,6 +7046,7 @@ packages:
safe-buffer: 5.1.2 safe-buffer: 5.1.2
string_decoder: 1.1.1 string_decoder: 1.1.1
util-deprecate: 1.0.2 util-deprecate: 1.0.2
dev: false
/readable-stream/3.6.0: /readable-stream/3.6.0:
resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==} resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==}
@ -7390,24 +7381,12 @@ packages:
safe-buffer: 5.2.1 safe-buffer: 5.2.1
dev: false dev: false
/shebang-command/1.2.0:
resolution: {integrity: sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=}
engines: {node: '>=0.10.0'}
dependencies:
shebang-regex: 1.0.0
dev: true
/shebang-command/2.0.0: /shebang-command/2.0.0:
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
engines: {node: '>=8'} engines: {node: '>=8'}
dependencies: dependencies:
shebang-regex: 3.0.0 shebang-regex: 3.0.0
/shebang-regex/1.0.0:
resolution: {integrity: sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=}
engines: {node: '>=0.10.0'}
dev: true
/shebang-regex/3.0.0: /shebang-regex/3.0.0:
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -7528,14 +7507,6 @@ packages:
resolution: {integrity: sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=} resolution: {integrity: sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=}
dev: false dev: false
/spawn-sync/1.0.15:
resolution: {integrity: sha1-sAeZVX63+wyDdsKdROih6mfldHY=}
requiresBuild: true
dependencies:
concat-stream: 1.6.2
os-shim: 0.1.3
dev: true
/spdx-correct/3.1.1: /spdx-correct/3.1.1:
resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==} resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==}
dependencies: dependencies:
@ -7660,6 +7631,7 @@ packages:
resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}
dependencies: dependencies:
safe-buffer: 5.1.2 safe-buffer: 5.1.2
dev: false
/string_decoder/1.3.0: /string_decoder/1.3.0:
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
@ -8306,6 +8278,7 @@ packages:
/typedarray/0.0.6: /typedarray/0.0.6:
resolution: {integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=} resolution: {integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=}
dev: false
/typeorm/0.2.41_ioredis@5.0.1+mysql2@2.3.3: /typeorm/0.2.41_ioredis@5.0.1+mysql2@2.3.3:
resolution: {integrity: sha512-/d8CLJJxKPgsnrZWiMyPI0rz2MFZnBQrnQ5XP3Vu3mswv2WPexb58QM6BEtmRmlTMYN5KFWUz8SKluze+wS9xw==} resolution: {integrity: sha512-/d8CLJJxKPgsnrZWiMyPI0rz2MFZnBQrnQ5XP3Vu3mswv2WPexb58QM6BEtmRmlTMYN5KFWUz8SKluze+wS9xw==}
@ -8700,13 +8673,6 @@ packages:
is-typed-array: 1.1.8 is-typed-array: 1.1.8
dev: false dev: false
/which/1.2.14:
resolution: {integrity: sha1-mofEN48D6CfOyvGs31bHNsAcFOU=}
hasBin: true
dependencies:
isexe: 2.0.0
dev: true
/which/1.3.1: /which/1.3.1:
resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==}
hasBin: true hasBin: true
@ -8881,6 +8847,7 @@ packages:
/yallist/2.1.2: /yallist/2.1.2:
resolution: {integrity: sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=} resolution: {integrity: sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=}
dev: false
/yallist/3.1.1: /yallist/3.1.1:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}