+
Skip to content

Move husky pre-commit hook to a more generic .githooks/ #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

staged_files=$(git diff --diff-filter=d --staged --name-only | grep -E '\.ts$')
if [ -n "$staged_files" ]
then
if ! npm run lint:fix
then
exit 1
fi

echo "$staged_files" | xargs git add
fi
3 changes: 0 additions & 3 deletions .husky/pre-commit

This file was deleted.

22 changes: 0 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
"compile": "webpack",
"watch": "webpack --watch",
"package": "webpack --mode production --devtool hidden-source-map",
"perepare": "husky install",
"prepare": "git config --local core.hooksPath .githooks",
"preinstall": "node ./node/binaryInstall.js",
"preuninstall": "node ./node/binaryUninstall.js",
"lint": "npm-run-all --parallel lint:js lint:sh",
Expand All @@ -304,7 +304,6 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"glob": "^8.0.3",
"husky": "^8.0.1",
"jest": "^29.2.2",
"jest-raw-loader": "^1.0.1",
"js-yaml": "^4.1.0",
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载