Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: simplify pre-commit hook flow (#34637)

yyhb9c122e7f4ee
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 50dbde2aeed..a069b6cbc77 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -20,4 +20,4 @@
- [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
- [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
- [x] I've updated the documentation accordingly.
-- [x] I ran `make lint` and `make type-check` (backend) and `cd web && npx lint-staged` (frontend) to appease the lint gods
+- [x] I ran `make lint` and `make type-check` (backend) and `cd web && pnpm exec vp staged` (frontend) to appease the lint gods
diff --git a/.vite-hooks/pre-commit b/.vite-hooks/pre-commit
index a4b5531ab18..db5c5046060 100755
--- a/.vite-hooks/pre-commit
+++ b/.vite-hooks/pre-commit
@@ -95,31 +95,5 @@ if $web_modified; then
exit 1
fi
- echo "Running unit tests check"
- modified_files=$(git diff --cached --name-only -- utils | grep -v '\.spec\.ts$' || true)
-
- if [ -n "$modified_files" ]; then
- for file in $modified_files; do
- test_file="${file%.*}.spec.ts"
- echo "Checking for test file: $test_file"
-
- # check if the test file exists
- if [ -f "../$test_file" ]; then
- echo "Detected changes in $file, running corresponding unit tests..."
- pnpm run test "../$test_file"
-
- if [ $? -ne 0 ]; then
- echo "Unit tests failed. Please fix the errors before committing."
- exit 1
- fi
- echo "Unit tests for $file passed."
- else
- echo "Warning: $file does not have a corresponding test file."
- fi
-
- done
- echo "All unit tests for modified web/utils files have passed."
- fi
-
cd ../
fi
diff --git a/web/docs/lint.md b/web/docs/lint.md
index 0203964621c..4f1e819a034 100644
--- a/web/docs/lint.md
+++ b/web/docs/lint.md
@@ -38,7 +38,7 @@ Treat this as an escape hatch—fix these errors when time permits.
### The Auto-Fix Workflow and Suppression Strategy
To streamline your development process, we recommend configuring your editor to automatically fix lint errors on save.
-As a fallback, any remaining autofixable errors will be corrected automatically when you commit.
+As a fallback, the commit hook runs `vp staged`, which applies autofixable ESLint changes to staged files before the commit continues.
To prevent workflow disruptions, these commit hooks are intentionally bypassed when you are merging branches, rebasing, or cherry-picking.
Additionally, we currently track many existing legacy errors in eslint-suppressions.json.