Skip to content

Fix frontend pre-commit hook syntax error and improve reliability #1546#1547

Open
TheBinaryAVA wants to merge 1 commit into
SolaceLabs:mainfrom
TheBinaryAVA:frontend-precommit-hook
Open

Fix frontend pre-commit hook syntax error and improve reliability #1546#1547
TheBinaryAVA wants to merge 1 commit into
SolaceLabs:mainfrom
TheBinaryAVA:frontend-precommit-hook

Conversation

@TheBinaryAVA

Copy link
Copy Markdown

What is the purpose of this change?

This change fixes a syntax error in the frontend pre-commit hook script and improves its reliability. The issue was caused by invalid trailing text after exit 0, which could break script execution. The update also ensures the hook only runs when frontend files are staged and behaves more safely.

#closes 1546

How was this change implemented?
Removed invalid trailing text after exit 0
Improved staged file detection using a safer grep -q check
Added set -e to ensure the script fails fast on errors
Refactored structure for better readability and maintainability
Ensured the hook only runs for changes under client/webui/frontend/
Key Design Decisions (optional - delete if not applicable)
Used git diff --cached --name-only with grep -q instead of storing output in a variable for simplicity and reliability
Added set -e to enforce strict error handling rather than manually checking each command
Kept the script POSIX-compliant (/bin/sh) for maximum compatibility

How was this change tested?
Manual testing: staged frontend and non-frontend files and verified hook execution behavior
Unit tests: not applicable (shell hook script)
Integration tests: validated via local git commit flow
Known limitations: does not lint only changed files (runs full npm run precommit if triggered)
Is there anything the reviewers should focus on/be aware of?
Ensure hook triggers only for client/webui/frontend/ changes
Confirm no unintended execution for unrelated file changes
Verify npm script exit codes correctly propagate to git commit flow
Review POSIX compatibility assumptions if environment differs

Signed-off-by: TheBinaryAVA <avanthikapari1@gmail.com>
@TheBinaryAVA TheBinaryAVA changed the title Fix frontend pre-commit hook syntax error and improve reliability Fix frontend pre-commit hook syntax error and improve reliability #1546 May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant